summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/aborted_clients.result6
-rw-r--r--mysql-test/r/adddate_454.result2
-rw-r--r--mysql-test/r/alias.result4
-rw-r--r--mysql-test/r/alter_table-big.result32
-rw-r--r--mysql-test/r/alter_table.result209
-rw-r--r--mysql-test/r/alter_table_mdev539_maria.result17
-rw-r--r--mysql-test/r/alter_table_mdev539_myisam.result17
-rw-r--r--mysql-test/r/alter_table_online.result54
-rw-r--r--mysql-test/r/alter_user.result93
-rw-r--r--mysql-test/r/analyze_debug.result10
-rw-r--r--mysql-test/r/analyze_format_json.result122
-rw-r--r--mysql-test/r/analyze_stmt_orderby.result85
-rw-r--r--mysql-test/r/assign_key_cache_debug.result5
-rw-r--r--mysql-test/r/auth_named_pipe.result3
-rw-r--r--mysql-test/r/auth_rpl.result9
-rw-r--r--mysql-test/r/auto_increment_ranges_innodb.result12
-rw-r--r--mysql-test/r/auto_increment_ranges_myisam.result12
-rw-r--r--mysql-test/r/bench_count_distinct.result2
-rw-r--r--mysql-test/r/bigint.result18
-rw-r--r--mysql-test/r/binary_to_hex.result12
-rw-r--r--mysql-test/r/bootstrap.result2
-rw-r--r--mysql-test/r/bug12427262.result4
-rw-r--r--mysql-test/r/bug39022.result20
-rw-r--r--mysql-test/r/bug46760.result2
-rw-r--r--mysql-test/r/bug58669.result4
-rw-r--r--mysql-test/r/cache_innodb.result15
-rw-r--r--mysql-test/r/cache_temporal_4265.result1
-rw-r--r--mysql-test/r/case.result68
-rw-r--r--mysql-test/r/cast.result36
-rw-r--r--mysql-test/r/change_user.result11
-rw-r--r--mysql-test/r/change_user_notembedded.result4
-rw-r--r--mysql-test/r/check.result19
-rw-r--r--mysql-test/r/check_constraint.result158
-rw-r--r--mysql-test/r/check_constraint_show.result17
-rw-r--r--mysql-test/r/client_xml.result8
-rw-r--r--mysql-test/r/comment_column.result1
-rw-r--r--mysql-test/r/comment_column2.result4
-rw-r--r--mysql-test/r/comment_index.result2
-rw-r--r--mysql-test/r/commit.result128
-rw-r--r--mysql-test/r/commit_1innodb.result6
-rw-r--r--mysql-test/r/compare.result4
-rw-r--r--mysql-test/r/compound.result2
-rw-r--r--mysql-test/r/compress.result7
-rw-r--r--mysql-test/r/concurrent_innodb_safelog.result130
-rw-r--r--mysql-test/r/concurrent_innodb_unsafelog.result130
-rw-r--r--mysql-test/r/connect.result84
-rw-r--r--mysql-test/r/connect2.result73
-rw-r--r--mysql-test/r/consistent_snapshot.result22
-rw-r--r--mysql-test/r/constraints.result31
-rw-r--r--mysql-test/r/create-big.result118
-rw-r--r--mysql-test/r/create-uca.result4
-rw-r--r--mysql-test/r/create.result154
-rw-r--r--mysql-test/r/create_drop_binlog.result4
-rw-r--r--mysql-test/r/create_drop_function.result2
-rw-r--r--mysql-test/r/create_drop_index.result2
-rw-r--r--mysql-test/r/create_drop_role.result4
-rw-r--r--mysql-test/r/create_drop_server.result15
-rw-r--r--mysql-test/r/create_drop_trigger.result1
-rw-r--r--mysql-test/r/create_drop_view.result8
-rw-r--r--mysql-test/r/create_or_replace.result27
-rw-r--r--mysql-test/r/create_or_replace2.result2
-rw-r--r--mysql-test/r/create_or_replace_permission.result3
-rw-r--r--mysql-test/r/create_user.result72
-rw-r--r--mysql-test/r/create_w_max_indexes_128.result256
-rw-r--r--mysql-test/r/create_w_max_indexes_64.result252
-rw-r--r--mysql-test/r/cte_grant.result123
-rw-r--r--mysql-test/r/cte_nonrecursive.result1464
-rw-r--r--mysql-test/r/cte_recursive.result3235
-rw-r--r--mysql-test/r/ctype_big5.result650
-rw-r--r--mysql-test/r/ctype_binary.result265
-rw-r--r--mysql-test/r/ctype_collate.result39
-rw-r--r--mysql-test/r/ctype_cp1250_ch.result56
-rw-r--r--mysql-test/r/ctype_cp1251.result258
-rw-r--r--mysql-test/r/ctype_cp932.result564
-rw-r--r--mysql-test/r/ctype_cp932_binlog_row.result1
-rw-r--r--mysql-test/r/ctype_cp932_binlog_stm.result18
-rw-r--r--mysql-test/r/ctype_errors.result13
-rw-r--r--mysql-test/r/ctype_eucjpms.result629
-rw-r--r--mysql-test/r/ctype_euckr.result622
-rw-r--r--mysql-test/r/ctype_gb2312.result610
-rw-r--r--mysql-test/r/ctype_gbk.result653
-rw-r--r--mysql-test/r/ctype_gbk_export_import.result3903
-rw-r--r--mysql-test/r/ctype_latin1.result932
-rw-r--r--mysql-test/r/ctype_latin1_de.result4
-rw-r--r--mysql-test/r/ctype_latin2.result6
-rw-r--r--mysql-test/r/ctype_latin2_ch.result82
-rw-r--r--mysql-test/r/ctype_ldml.result1859
-rw-r--r--mysql-test/r/ctype_like_range.result73
-rw-r--r--mysql-test/r/ctype_many.result3
-rw-r--r--mysql-test/r/ctype_mb.result2
-rw-r--r--mysql-test/r/ctype_nopad_8bit.result12771
-rw-r--r--mysql-test/r/ctype_recoding.result4
-rw-r--r--mysql-test/r/ctype_sjis.result636
-rw-r--r--mysql-test/r/ctype_swe7.result566
-rw-r--r--mysql-test/r/ctype_tis620.result640
-rw-r--r--mysql-test/r/ctype_uca.result140
-rw-r--r--mysql-test/r/ctype_uca_innodb.result10
-rw-r--r--mysql-test/r/ctype_uca_partitions.result4
-rw-r--r--mysql-test/r/ctype_ucs.result969
-rw-r--r--mysql-test/r/ctype_ucs2_uca.result590
-rw-r--r--mysql-test/r/ctype_ujis.result629
-rw-r--r--mysql-test/r/ctype_ujis_ucs2.result4
-rw-r--r--mysql-test/r/ctype_utf16.result592
-rw-r--r--mysql-test/r/ctype_utf16_uca.result612
-rw-r--r--mysql-test/r/ctype_utf16le.result590
-rw-r--r--mysql-test/r/ctype_utf32.result610
-rw-r--r--mysql-test/r/ctype_utf32_uca.result612
-rw-r--r--mysql-test/r/ctype_utf8.result1077
-rw-r--r--mysql-test/r/ctype_utf8_uca.result589
-rw-r--r--mysql-test/r/ctype_utf8mb4.result697
-rw-r--r--mysql-test/r/ctype_utf8mb4_heap.result57
-rw-r--r--mysql-test/r/ctype_utf8mb4_innodb.result65
-rw-r--r--mysql-test/r/ctype_utf8mb4_myisam.result65
-rw-r--r--mysql-test/r/ctype_utf8mb4_uca.result600
-rw-r--r--mysql-test/r/date_formats.result15
-rw-r--r--mysql-test/r/ddl_i18n_koi8r.result146
-rw-r--r--mysql-test/r/ddl_i18n_utf8.result146
-rw-r--r--mysql-test/r/deadlock_innodb.result38
-rw-r--r--mysql-test/r/debug_sync.result48
-rw-r--r--mysql-test/r/default.result3156
-rw-r--r--mysql-test/r/default_debug.result21
-rw-r--r--mysql-test/r/default_session.result94
-rw-r--r--mysql-test/r/delayed.result66
-rw-r--r--mysql-test/r/delete.result3
-rw-r--r--mysql-test/r/delete_returning_grant.result11
-rw-r--r--mysql-test/r/derived.result43
-rw-r--r--mysql-test/r/derived_cond_pushdown.result9047
-rw-r--r--mysql-test/r/derived_opt.result4
-rw-r--r--mysql-test/r/derived_view.result418
-rw-r--r--mysql-test/r/dirty_close.result17
-rw-r--r--mysql-test/r/distinct.result24
-rw-r--r--mysql-test/r/drop.result15
-rw-r--r--mysql-test/r/drop_debug.result25
-rw-r--r--mysql-test/r/dyncol.result127
-rw-r--r--mysql-test/r/empty_table.result8
-rw-r--r--mysql-test/r/empty_user_table.result1
-rw-r--r--mysql-test/r/enforce_storage_engine.result8
-rw-r--r--mysql-test/r/error_simulation.result9
-rw-r--r--mysql-test/r/errors.result6
-rw-r--r--mysql-test/r/events_1.result5
-rw-r--r--mysql-test/r/events_2.result12
-rw-r--r--mysql-test/r/events_bugs.result57
-rw-r--r--mysql-test/r/events_grant.result16
-rw-r--r--mysql-test/r/events_slowlog.result2
-rw-r--r--mysql-test/r/events_stress.result11
-rw-r--r--mysql-test/r/events_trans_notembedded.result3
-rw-r--r--mysql-test/r/explain.result82
-rw-r--r--mysql-test/r/explain_json.result215
-rw-r--r--mysql-test/r/explain_json_format_partitions.result8
-rw-r--r--mysql-test/r/explain_json_innodb.result4
-rw-r--r--mysql-test/r/explain_slowquerylog.result3
-rw-r--r--mysql-test/r/failed_auth_3909.result5
-rw-r--r--mysql-test/r/failed_auth_unixsocket.result1
-rw-r--r--mysql-test/r/features.result10
-rw-r--r--mysql-test/r/filesort_debug.result11
-rw-r--r--mysql-test/r/flush-innodb-notembedded.result25
-rw-r--r--mysql-test/r/flush-innodb.result94
-rw-r--r--mysql-test/r/flush.result118
-rw-r--r--mysql-test/r/flush2.result4
-rw-r--r--mysql-test/r/flush_block_commit.result39
-rw-r--r--mysql-test/r/flush_block_commit_notembedded.result22
-rw-r--r--mysql-test/r/flush_read_lock.result297
-rw-r--r--mysql-test/r/flush_read_lock_kill.result16
-rw-r--r--mysql-test/r/flush_table.result10
-rw-r--r--mysql-test/r/fulltext.result5
-rw-r--r--mysql-test/r/fulltext_distinct.result2
-rw-r--r--mysql-test/r/fulltext_update.result2
-rw-r--r--mysql-test/r/func_analyse.result26
-rw-r--r--mysql-test/r/func_compress.result34
-rw-r--r--mysql-test/r/func_crypt.result18
-rw-r--r--mysql-test/r/func_date_add.result47
-rw-r--r--mysql-test/r/func_default.result11
-rw-r--r--mysql-test/r/func_digest.result31
-rw-r--r--mysql-test/r/func_encrypt.result28
-rw-r--r--mysql-test/r/func_gconcat.result70
-rw-r--r--mysql-test/r/func_group.result27
-rw-r--r--mysql-test/r/func_hybrid_type.result182
-rw-r--r--mysql-test/r/func_if.result2
-rw-r--r--mysql-test/r/func_in.result22
-rw-r--r--mysql-test/r/func_isnull.result8
-rw-r--r--mysql-test/r/func_json.result741
-rw-r--r--mysql-test/r/func_like.result43
-rw-r--r--mysql-test/r/func_math.result180
-rw-r--r--mysql-test/r/func_misc.result120
-rw-r--r--mysql-test/r/func_op.result4
-rw-r--r--mysql-test/r/func_regexp_pcre.result8
-rw-r--r--mysql-test/r/func_set.result4
-rw-r--r--mysql-test/r/func_str.result485
-rw-r--r--mysql-test/r/func_system.result6
-rw-r--r--mysql-test/r/func_test.result39
-rw-r--r--mysql-test/r/func_time.result7
-rw-r--r--mysql-test/r/func_time_hires.result8
-rw-r--r--mysql-test/r/func_weight_string.result38
-rw-r--r--mysql-test/r/function_defaults.result372
-rw-r--r--mysql-test/r/function_defaults_innodb.result372
-rw-r--r--mysql-test/r/function_defaults_notembedded.result12
-rw-r--r--mysql-test/r/get_diagnostics.result31
-rw-r--r--mysql-test/r/gis-alter_table_online.result18
-rw-r--r--mysql-test/r/gis-debug.result11
-rw-r--r--mysql-test/r/gis-json.result109
-rw-r--r--mysql-test/r/gis-rt-precise.result2
-rw-r--r--mysql-test/r/gis-rtree.result56
-rw-r--r--mysql-test/r/gis.result392
-rw-r--r--mysql-test/r/gis2.result24
-rw-r--r--mysql-test/r/grant.result441
-rw-r--r--mysql-test/r/grant2.result126
-rw-r--r--mysql-test/r/grant3.result15
-rw-r--r--mysql-test/r/grant4.result13
-rw-r--r--mysql-test/r/grant5.result2
-rw-r--r--mysql-test/r/grant_4332.result4
-rw-r--r--mysql-test/r/grant_cache_no_prot.result38
-rw-r--r--mysql-test/r/grant_cache_ps_prot.result38
-rw-r--r--mysql-test/r/grant_explain_non_select.result32
-rw-r--r--mysql-test/r/grant_lowercase.result4
-rw-r--r--mysql-test/r/grant_lowercase_fs.result5
-rw-r--r--mysql-test/r/greedy_optimizer.result40
-rw-r--r--mysql-test/r/group_by.result48
-rw-r--r--mysql-test/r/group_min_max.result70
-rw-r--r--mysql-test/r/group_min_max_innodb.result4
-rw-r--r--mysql-test/r/having.result89
-rw-r--r--mysql-test/r/help.result16
-rw-r--r--mysql-test/r/index_intersect_innodb.result4
-rw-r--r--mysql-test/r/index_merge_innodb.result8
-rw-r--r--mysql-test/r/index_merge_myisam.result7
-rw-r--r--mysql-test/r/information_schema.result239
-rw-r--r--mysql-test/r/information_schema_all_engines.result44
-rw-r--r--mysql-test/r/information_schema_db.result25
-rw-r--r--mysql-test/r/information_schema_linux.result3
-rw-r--r--mysql-test/r/information_schema_parameters.result50
-rw-r--r--mysql-test/r/information_schema_part.result58
-rw-r--r--mysql-test/r/information_schema_routines.result108
-rw-r--r--mysql-test/r/init_connect.result63
-rw-r--r--mysql-test/r/init_connection_query_cache.result4
-rw-r--r--mysql-test/r/innodb_ext_key.result16
-rw-r--r--mysql-test/r/innodb_icp.result12
-rw-r--r--mysql-test/r/innodb_mysql_lock.result93
-rw-r--r--mysql-test/r/innodb_mysql_lock2.result88
-rw-r--r--mysql-test/r/innodb_mysql_sync.result111
-rw-r--r--mysql-test/r/insert.result34
-rw-r--r--mysql-test/r/insert_notembedded.result32
-rw-r--r--mysql-test/r/insert_select.result4
-rw-r--r--mysql-test/r/ipv4_and_ipv6.result6
-rw-r--r--mysql-test/r/ipv4_as_ipv6.result18
-rw-r--r--mysql-test/r/ipv6.result9
-rw-r--r--mysql-test/r/join.result14
-rw-r--r--mysql-test/r/join_cache.result30
-rw-r--r--mysql-test/r/join_nested.result30
-rw-r--r--mysql-test/r/join_nested_jcl6.result30
-rw-r--r--mysql-test/r/join_outer.result44
-rw-r--r--mysql-test/r/join_outer_innodb.result2
-rw-r--r--mysql-test/r/join_outer_jcl6.result44
-rw-r--r--mysql-test/r/key.result24
-rw-r--r--mysql-test/r/keyread.result6
-rw-r--r--mysql-test/r/keywords.result56
-rw-r--r--mysql-test/r/kill-2.result2
-rw-r--r--mysql-test/r/kill.result150
-rw-r--r--mysql-test/r/last_value.result10
-rw-r--r--mysql-test/r/limit.result4
-rw-r--r--mysql-test/r/limit_rows_examined.result172
-rw-r--r--mysql-test/r/loaddata.result12
-rw-r--r--mysql-test/r/loaddata_autocom_innodb.result4
-rw-r--r--mysql-test/r/loadxml.result3
-rw-r--r--mysql-test/r/locale.result18
-rw-r--r--mysql-test/r/lock.result47
-rw-r--r--mysql-test/r/lock_multi.result289
-rw-r--r--mysql-test/r/lock_multi_bug38499.result9
-rw-r--r--mysql-test/r/lock_multi_bug38691.result7
-rw-r--r--mysql-test/r/lock_sync.result299
-rw-r--r--mysql-test/r/lock_tables_lost_commit.result7
-rw-r--r--mysql-test/r/locked_temporary-5955.result2
-rw-r--r--mysql-test/r/log_slow.result6
-rw-r--r--mysql-test/r/log_state.result17
-rw-r--r--mysql-test/r/log_tables-big.result8
-rw-r--r--mysql-test/r/log_tables.result75
-rw-r--r--mysql-test/r/lowercase_fs_off.result18
-rw-r--r--mysql-test/r/lowercase_fs_on.result2
-rw-r--r--mysql-test/r/lowercase_table2.result2
-rw-r--r--mysql-test/r/lowercase_view.result70
-rw-r--r--mysql-test/r/mdev-504.result1
-rw-r--r--mysql-test/r/mdev375.result14
-rw-r--r--mysql-test/r/mdl.result22
-rw-r--r--mysql-test/r/mdl_sync.result1328
-rw-r--r--mysql-test/r/merge-big.result9
-rw-r--r--mysql-test/r/merge.result59
-rw-r--r--mysql-test/r/merge_debug.result1
-rw-r--r--mysql-test/r/metadata.result2
-rw-r--r--mysql-test/r/mix2_myisam.result60
-rw-r--r--mysql-test/r/mrr_derived_crash_4610.result4
-rw-r--r--mysql-test/r/mrr_icp_extra.result26
-rw-r--r--mysql-test/r/multi_update.result121
-rw-r--r--mysql-test/r/multi_update_innodb.result94
-rw-r--r--mysql-test/r/myisam-big.result6
-rw-r--r--mysql-test/r/myisam-blob.result3
-rw-r--r--mysql-test/r/myisam-optimize.result14
-rw-r--r--mysql-test/r/myisam.result80
-rw-r--r--mysql-test/r/myisam_debug.result10
-rw-r--r--mysql-test/r/myisam_enable_keys-10506.result1
-rw-r--r--mysql-test/r/myisam_explain_non_select_all.result90
-rw-r--r--mysql-test/r/myisam_icp.result10
-rw-r--r--mysql-test/r/myisam_icp_notembedded.result3
-rw-r--r--mysql-test/r/myisam_optimize.result7
-rw-r--r--mysql-test/r/myisam_recover.result22
-rw-r--r--mysql-test/r/mysql-bug41486.result3
-rw-r--r--mysql-test/r/mysql-bug45236.result3
-rw-r--r--mysql-test/r/mysql5613mysql.result38
-rw-r--r--mysql-test/r/mysql57_virtual.result38
-rw-r--r--mysql-test/r/mysql_comments.result16
-rw-r--r--mysql-test/r/mysql_upgrade-6984.result1
-rw-r--r--mysql-test/r/mysql_upgrade.result3
-rw-r--r--mysql-test/r/mysqlbinlog-innodb.result8
-rw-r--r--mysql-test/r/mysqlbinlog.result64
-rw-r--r--mysql-test/r/mysqlbinlog_row_big.result7
-rw-r--r--mysql-test/r/mysqlbinlog_row_compressed.result477
-rw-r--r--mysql-test/r/mysqlbinlog_row_minimal.result188
-rw-r--r--mysql-test/r/mysqlbinlog_stmt_compressed.result207
-rw-r--r--mysql-test/r/mysqlcheck.result8
-rw-r--r--mysql-test/r/mysqld--help,win.rdiff96
-rw-r--r--mysql-test/r/mysqld--help.result155
-rw-r--r--mysql-test/r/mysqldump-max.result21
-rw-r--r--mysql-test/r/mysqldump-nl.result2
-rw-r--r--mysql-test/r/mysqldump.result209
-rw-r--r--mysql-test/r/mysqlhotcopy_myisam.result6
-rw-r--r--mysql-test/r/mysqltest.result22
-rw-r--r--mysql-test/r/mysqltest_ps.result6
-rw-r--r--mysql-test/r/named_pipe.result9
-rw-r--r--mysql-test/r/negation_elimination.result6
-rw-r--r--mysql-test/r/no_password_column-mdev-11170.result168
-rw-r--r--mysql-test/r/non_blocking_api.result4
-rw-r--r--mysql-test/r/not_embedded_server.result8
-rw-r--r--mysql-test/r/null.result118
-rw-r--r--mysql-test/r/null_key.result2
-rw-r--r--mysql-test/r/old-mode.result16
-rw-r--r--mysql-test/r/openssl_1.result48
-rw-r--r--mysql-test/r/openssl_6975,tlsv10.result12
-rw-r--r--mysql-test/r/openssl_6975,tlsv12.result12
-rw-r--r--mysql-test/r/order_by-mdev-10122.result127
-rw-r--r--mysql-test/r/order_by.result68
-rw-r--r--mysql-test/r/order_by_innodb.result73
-rw-r--r--mysql-test/r/order_by_optimizer.result30
-rw-r--r--mysql-test/r/order_by_optimizer_innodb.result4
-rw-r--r--mysql-test/r/order_by_zerolength-4285.result5
-rw-r--r--mysql-test/r/outfile.resultbin2139 -> 2323 bytes
-rw-r--r--mysql-test/r/overflow.result4
-rw-r--r--mysql-test/r/packet.result8
-rw-r--r--mysql-test/r/parser.result479
-rw-r--r--mysql-test/r/parser_not_embedded.result10
-rw-r--r--mysql-test/r/partition.result232
-rw-r--r--mysql-test/r/partition_alter.result40
-rw-r--r--mysql-test/r/partition_bug18198.result3
-rw-r--r--mysql-test/r/partition_cache.result15
-rw-r--r--mysql-test/r/partition_cache_innodb.result22
-rw-r--r--mysql-test/r/partition_cache_myisam.result22
-rw-r--r--mysql-test/r/partition_column.result82
-rw-r--r--mysql-test/r/partition_csv.result3
-rw-r--r--mysql-test/r/partition_datatype.result68
-rw-r--r--mysql-test/r/partition_debug_sync.result40
-rw-r--r--mysql-test/r/partition_default.result1267
-rw-r--r--mysql-test/r/partition_error.result69
-rw-r--r--mysql-test/r/partition_example.result12
-rw-r--r--mysql-test/r/partition_exchange.result148
-rw-r--r--mysql-test/r/partition_explicit_prune.result106
-rw-r--r--mysql-test/r/partition_grant.result16
-rw-r--r--mysql-test/r/partition_innodb.result83
-rw-r--r--mysql-test/r/partition_innodb_plugin.result47
-rw-r--r--mysql-test/r/partition_innodb_semi_consistent.result39
-rw-r--r--mysql-test/r/partition_innodb_stmt.result10
-rw-r--r--mysql-test/r/partition_list.result40
-rw-r--r--mysql-test/r/partition_mgm.result24
-rw-r--r--mysql-test/r/partition_mgm_err.result4
-rw-r--r--mysql-test/r/partition_myisam.result10
-rw-r--r--mysql-test/r/partition_not_windows.result4
-rw-r--r--mysql-test/r/partition_pruning.result16
-rw-r--r--mysql-test/r/partition_range.result92
-rw-r--r--mysql-test/r/partition_symlink.result17
-rw-r--r--mysql-test/r/partition_sync.result26
-rw-r--r--mysql-test/r/partition_utf8.result14
-rw-r--r--mysql-test/r/plugin_auth.result65
-rw-r--r--mysql-test/r/plugin_auth_qa_1.result35
-rw-r--r--mysql-test/r/plugin_not_embedded.result5
-rw-r--r--mysql-test/r/plugin_vars.result10
-rw-r--r--mysql-test/r/pool_of_threads.result14
-rw-r--r--mysql-test/r/processlist.result8
-rw-r--r--mysql-test/r/ps.result931
-rw-r--r--mysql-test/r/ps_1general.result34
-rw-r--r--mysql-test/r/ps_2myisam.result364
-rw-r--r--mysql-test/r/ps_3innodb.result364
-rw-r--r--mysql-test/r/ps_4heap.result364
-rw-r--r--mysql-test/r/ps_5merge.result728
-rw-r--r--mysql-test/r/ps_ddl.result14
-rw-r--r--mysql-test/r/ps_grant.result8
-rw-r--r--mysql-test/r/ps_qc_innodb.result6
-rw-r--r--mysql-test/r/query_cache.result51
-rw-r--r--mysql-test/r/query_cache_28249.result25
-rw-r--r--mysql-test/r/query_cache_debug.result81
-rw-r--r--mysql-test/r/query_cache_innodb.result90
-rw-r--r--mysql-test/r/query_cache_notembedded.result24
-rw-r--r--mysql-test/r/query_cache_ps_no_prot.result46
-rw-r--r--mysql-test/r/query_cache_ps_ps_prot.result46
-rw-r--r--mysql-test/r/quick_select_4161.result5
-rw-r--r--mysql-test/r/range.result684
-rw-r--r--mysql-test/r/range_interrupted-13751.result16
-rw-r--r--mysql-test/r/range_mrr_icp.result694
-rw-r--r--mysql-test/r/range_vs_index_merge_innodb.result72
-rw-r--r--mysql-test/r/read_only.result13
-rw-r--r--mysql-test/r/read_only_innodb.result18
-rw-r--r--mysql-test/r/rename.result11
-rw-r--r--mysql-test/r/reopen_temp_table.result192
-rw-r--r--mysql-test/r/replace.result2
-rw-r--r--mysql-test/r/round.result32
-rw-r--r--mysql-test/r/row-checksum-old.result8
-rw-r--r--mysql-test/r/row-checksum.result8
-rw-r--r--mysql-test/r/row.result24
-rw-r--r--mysql-test/r/rpl_mysqldump_slave.result6
-rw-r--r--mysql-test/r/schema.result52
-rw-r--r--mysql-test/r/select.result44
-rw-r--r--mysql-test/r/select_found.result20
-rw-r--r--mysql-test/r/select_jcl6.result42
-rw-r--r--mysql-test/r/select_pkeycache.result44
-rw-r--r--mysql-test/r/selectivity.result80
-rw-r--r--mysql-test/r/selectivity_innodb.result108
-rw-r--r--mysql-test/r/selectivity_no_engine.result32
-rw-r--r--mysql-test/r/set_statement.result26
-rw-r--r--mysql-test/r/set_statement_debug.result1
-rw-r--r--mysql-test/r/set_statement_notembedded_binlog.result16
-rw-r--r--mysql-test/r/shm.result7
-rw-r--r--mysql-test/r/show_check.result323
-rw-r--r--mysql-test/r/show_create_user.result39
-rw-r--r--mysql-test/r/show_explain.result131
-rw-r--r--mysql-test/r/show_explain_non_select.result11
-rw-r--r--mysql-test/r/show_explain_ps.result19
-rw-r--r--mysql-test/r/shutdown.result9
-rw-r--r--mysql-test/r/signal.result12
-rw-r--r--mysql-test/r/skip_grants.result4
-rw-r--r--mysql-test/r/skip_name_resolve.result3
-rw-r--r--mysql-test/r/sp-code.result124
-rw-r--r--mysql-test/r/sp-destruct.result4
-rw-r--r--mysql-test/r/sp-dynamic.result2
-rw-r--r--mysql-test/r/sp-error.result130
-rw-r--r--mysql-test/r/sp-innodb.result3
-rw-r--r--mysql-test/r/sp-lock.result258
-rw-r--r--mysql-test/r/sp-security.result181
-rw-r--r--mysql-test/r/sp-threads.result28
-rw-r--r--mysql-test/r/sp-ucs2.result12
-rw-r--r--mysql-test/r/sp.result136
-rw-r--r--mysql-test/r/sp_notembedded.result53
-rw-r--r--mysql-test/r/sp_sync.result36
-rw-r--r--mysql-test/r/sp_trans.result14
-rw-r--r--mysql-test/r/sql_mode.result53
-rw-r--r--mysql-test/r/ssl-big.result5
-rw-r--r--mysql-test/r/ssl.result7
-rw-r--r--mysql-test/r/ssl_8k_key.result4
-rw-r--r--mysql-test/r/ssl_ca.result18
-rw-r--r--mysql-test/r/ssl_cipher.result3
-rw-r--r--mysql-test/r/ssl_compress.result7
-rw-r--r--mysql-test/r/ssl_timeout-9836.result2
-rw-r--r--mysql-test/r/ssl_timeout.result3
-rw-r--r--mysql-test/r/stat_tables_innodb.result4
-rw-r--r--mysql-test/r/stat_tables_innodb_debug.result25
-rw-r--r--mysql-test/r/stat_tables_myisam_debug.result24
-rw-r--r--mysql-test/r/stat_tables_par.result42
-rw-r--r--mysql-test/r/stat_tables_par_innodb.result42
-rw-r--r--mysql-test/r/stat_tables_rbr.result3
-rw-r--r--mysql-test/r/stat_tables_repl.result10
-rw-r--r--mysql-test/r/statistics.result199
-rw-r--r--mysql-test/r/status.result63
-rw-r--r--mysql-test/r/status2.result4
-rw-r--r--mysql-test/r/status_bug17954.result1
-rw-r--r--mysql-test/r/strict.result7
-rw-r--r--mysql-test/r/subselect.result187
-rw-r--r--mysql-test/r/subselect2.result6
-rw-r--r--mysql-test/r/subselect3.result30
-rw-r--r--mysql-test/r/subselect3_jcl6.result30
-rw-r--r--mysql-test/r/subselect4.result12
-rw-r--r--mysql-test/r/subselect_cache.result178
-rw-r--r--mysql-test/r/subselect_exists2in.result42
-rw-r--r--mysql-test/r/subselect_extra.result4
-rw-r--r--mysql-test/r/subselect_extra_no_semijoin.result12
-rw-r--r--mysql-test/r/subselect_innodb.result2
-rw-r--r--mysql-test/r/subselect_mat.result122
-rw-r--r--mysql-test/r/subselect_mat_cost_bugs.result6
-rw-r--r--mysql-test/r/subselect_no_exists_to_in.result191
-rw-r--r--mysql-test/r/subselect_no_mat.result187
-rw-r--r--mysql-test/r/subselect_no_opts.result181
-rw-r--r--mysql-test/r/subselect_no_scache.result187
-rw-r--r--mysql-test/r/subselect_no_semijoin.result185
-rw-r--r--mysql-test/r/subselect_partial_match.result2
-rw-r--r--mysql-test/r/subselect_sj.result48
-rw-r--r--mysql-test/r/subselect_sj2.result17
-rw-r--r--mysql-test/r/subselect_sj2_jcl6.result19
-rw-r--r--mysql-test/r/subselect_sj2_mat.result35
-rw-r--r--mysql-test/r/subselect_sj_jcl6.result48
-rw-r--r--mysql-test/r/subselect_sj_mat.result118
-rw-r--r--mysql-test/r/symlink-aria-11902.result4
-rw-r--r--mysql-test/r/symlink-myisam-11902.result4
-rw-r--r--mysql-test/r/symlink.result10
-rw-r--r--mysql-test/r/synchronization.result55
-rw-r--r--mysql-test/r/system_mysql_db.result32
-rw-r--r--mysql-test/r/system_mysql_db_fix40123.result32
-rw-r--r--mysql-test/r/system_mysql_db_fix50030.result34
-rw-r--r--mysql-test/r/system_mysql_db_fix50117.result32
-rw-r--r--mysql-test/r/system_mysql_db_refs.result12
-rw-r--r--mysql-test/r/table_elim.result16
-rw-r--r--mysql-test/r/tc_heuristic_recover.result3
-rw-r--r--mysql-test/r/temp_table.result237
-rw-r--r--mysql-test/r/thread_id_overflow.result23
-rw-r--r--mysql-test/r/timezone_grant.result12
-rw-r--r--mysql-test/r/trans_read_only.result8
-rw-r--r--mysql-test/r/trigger-compat.result40
-rw-r--r--mysql-test/r/trigger-trans.result9
-rw-r--r--mysql-test/r/trigger.result103
-rw-r--r--mysql-test/r/trigger_no_defaults-11698.result2
-rw-r--r--mysql-test/r/trigger_notembedded.result190
-rw-r--r--mysql-test/r/trigger_wl3253.result502
-rw-r--r--mysql-test/r/truncate.result2
-rw-r--r--mysql-test/r/truncate_coverage.result83
-rw-r--r--mysql-test/r/type_binary.result4
-rw-r--r--mysql-test/r/type_bit.result6
-rw-r--r--mysql-test/r/type_bit_innodb.result6
-rw-r--r--mysql-test/r/type_blob.result74
-rw-r--r--mysql-test/r/type_date.result44
-rw-r--r--mysql-test/r/type_datetime.result89
-rw-r--r--mysql-test/r/type_datetime_hires.result18
-rw-r--r--mysql-test/r/type_decimal.result86
-rw-r--r--mysql-test/r/type_enum.result99
-rw-r--r--mysql-test/r/type_float.result198
-rw-r--r--mysql-test/r/type_int.result61
-rw-r--r--mysql-test/r/type_json.result39
-rw-r--r--mysql-test/r/type_newdecimal.result231
-rw-r--r--mysql-test/r/type_num.result41
-rw-r--r--mysql-test/r/type_num_innodb.result107
-rw-r--r--mysql-test/r/type_ranges.result46
-rw-r--r--mysql-test/r/type_set.result5
-rw-r--r--mysql-test/r/type_temporal_innodb.result12
-rw-r--r--mysql-test/r/type_temporal_mysql56.result2
-rw-r--r--mysql-test/r/type_time.result176
-rw-r--r--mysql-test/r/type_time_6065.result166
-rw-r--r--mysql-test/r/type_time_hires.result6
-rw-r--r--mysql-test/r/type_timestamp.result54
-rw-r--r--mysql-test/r/type_timestamp_hires.result97
-rw-r--r--mysql-test/r/type_uint.result4
-rw-r--r--mysql-test/r/type_varchar.result12
-rw-r--r--mysql-test/r/type_year.result59
-rw-r--r--mysql-test/r/udf.result22
-rw-r--r--mysql-test/r/udf_debug_sync.result8
-rw-r--r--mysql-test/r/union.result103
-rw-r--r--mysql-test/r/unsafe_binlog_innodb.result66
-rw-r--r--mysql-test/r/update.result8
-rw-r--r--mysql-test/r/upgrade.result2
-rw-r--r--mysql-test/r/user_limits.result60
-rw-r--r--mysql-test/r/user_var-binlog.result4
-rw-r--r--mysql-test/r/user_var.result6
-rw-r--r--mysql-test/r/userstat-badlogin-4824.result5
-rw-r--r--mysql-test/r/userstat.result3
-rw-r--r--mysql-test/r/variables-notembedded.result3
-rw-r--r--mysql-test/r/variables.result50
-rw-r--r--mysql-test/r/view.result851
-rw-r--r--mysql-test/r/view_alias.result2
-rw-r--r--mysql-test/r/view_debug.result5
-rw-r--r--mysql-test/r/view_grant.result265
-rw-r--r--mysql-test/r/wait_timeout.result16
-rw-r--r--mysql-test/r/wait_timeout_not_windows.result4
-rw-r--r--mysql-test/r/warnings.result47
-rw-r--r--mysql-test/r/win.result3301
-rw-r--r--mysql-test/r/win_as_arg_to_aggregate_func.result114
-rw-r--r--mysql-test/r/win_avg.result95
-rw-r--r--mysql-test/r/win_big-mdev-10092.result328
-rw-r--r--mysql-test/r/win_big-mdev-11697.result71
-rw-r--r--mysql-test/r/win_big.result111
-rw-r--r--mysql-test/r/win_bit.result117
-rw-r--r--mysql-test/r/win_empty_over.result145
-rw-r--r--mysql-test/r/win_first_last_value.result131
-rw-r--r--mysql-test/r/win_i_s.result38
-rw-r--r--mysql-test/r/win_insert_select.result93
-rw-r--r--mysql-test/r/win_lead_lag.result229
-rw-r--r--mysql-test/r/win_min_max.result864
-rw-r--r--mysql-test/r/win_nth_value.result120
-rw-r--r--mysql-test/r/win_ntile.result435
-rw-r--r--mysql-test/r/win_orderby.result26
-rw-r--r--mysql-test/r/win_percent_cume.result62
-rw-r--r--mysql-test/r/win_rank.result104
-rw-r--r--mysql-test/r/win_std.result293
-rw-r--r--mysql-test/r/win_sum.result95
-rw-r--r--mysql-test/r/xa.result70
-rw-r--r--mysql-test/r/xa_sync.result18
-rw-r--r--mysql-test/r/xml.result21
-rw-r--r--mysql-test/r/xtradb_mrr.result4
586 files changed, 80978 insertions, 10979 deletions
diff --git a/mysql-test/r/aborted_clients.result b/mysql-test/r/aborted_clients.result
index 7111a0c98db..8eb6df59653 100644
--- a/mysql-test/r/aborted_clients.result
+++ b/mysql-test/r/aborted_clients.result
@@ -1,9 +1,15 @@
FLUSH STATUS;
+connect con1,localhost,root,,;
+disconnect con1;
+connection default;
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients';
VARIABLE_VALUE
0
+connect con2,localhost,root,,;
KILL CONNECTION_ID();
ERROR 70100: Connection was killed
+disconnect con2;
+connection default;
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients';
VARIABLE_VALUE
1
diff --git a/mysql-test/r/adddate_454.result b/mysql-test/r/adddate_454.result
index 8b7c17cd47e..851292121f2 100644
--- a/mysql-test/r/adddate_454.result
+++ b/mysql-test/r/adddate_454.result
@@ -3,7 +3,7 @@ insert into t1 values ('2012-00-00');
select * from t1;
d
2012-00-00
-update t1 set d = adddate(d, interval 1 day);
+update ignore t1 set d = adddate(d, interval 1 day);
Warnings:
Warning 1292 Incorrect datetime value: '2012-00-00'
select * from t1;
diff --git a/mysql-test/r/alias.result b/mysql-test/r/alias.result
index 9d826dd9bd7..defd44f2548 100644
--- a/mysql-test/r/alias.result
+++ b/mysql-test/r/alias.result
@@ -212,5 +212,9 @@ drop table t4;
create table t4 select t2.*, d as 'x', d as 'z' from t2;
drop table t4;
drop table t1,t2,t3;
+connect c1,localhost,root,,;
+connection c1;
DELETE ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZROM t1 WHERE 1=1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't1 WHERE 1=1' at line 1
+connection default;
+disconnect c1;
diff --git a/mysql-test/r/alter_table-big.result b/mysql-test/r/alter_table-big.result
index f7a3ec6502e..32689daa3a6 100644
--- a/mysql-test/r/alter_table-big.result
+++ b/mysql-test/r/alter_table-big.result
@@ -1,5 +1,8 @@
drop table if exists t1, t2;
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),
@@ -10,10 +13,15 @@ insert into t1 values (1, 2, 3);
reset master;
set debug_sync='alter_table_enable_indexes SIGNAL parked WAIT_FOR go';
alter table t1 enable keys;;
+connection addconroot;
set debug_sync='now WAIT_FOR parked';
insert into t2 values (1);
insert into t1 values (1, 1, 1);;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot;
+connection default;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
@@ -25,36 +33,60 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into t1 values (1, 1, 1)
master-bin.000001 # Query # # COMMIT
drop tables t1, t2;
+disconnect addconroot;
+disconnect addconroot2;
set debug_sync='RESET';
End of 5.0 tests
drop table if exists t1, t2, t3;
+connect addconroot, localhost, root,,;
+connect addconroot2, localhost, root,,;
+connection default;
create table t1 (i int);
reset master;
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
alter table t1 change i c char(10) default 'Test1';;
+connection addconroot;
set debug_sync='now WAIT_FOR parked';
insert into t1 values ();;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot;
+connection default;
select * from t1;
c
Test1
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
alter table t1 change c vc varchar(100) default 'Test2';;
+connection addconroot;
set debug_sync='now WAIT_FOR parked';
rename table t1 to t2;;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot;
+connection default;
drop table t2;
create table t1 (i int);
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
alter table t1 change i c char(10) default 'Test3', rename to t2;;
+connection addconroot;
set debug_sync='now WAIT_FOR parked';
insert into t2 values();;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot;
+connection default;
select * from t2;
c
Test3
alter table t2 change c vc varchar(100) default 'Test2', rename to t1;;
+connection addconroot;
+connection default;
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';
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 17e2dc9b009..0845459f6b6 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -292,7 +292,7 @@ t2 CREATE TABLE `t2` (
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`)
drop table if exists t1, t2;
create table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
-insert into t1 (a) values(1);
+insert ignore into t1 (a) values(1);
Warnings:
Warning 1364 Field 'b' doesn't have a default value
Warning 1364 Field 'c' doesn't have a default value
@@ -311,7 +311,7 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I
t1 MyISAM 10 Fixed 1 37 X X X X X X X X latin1_swedish_ci NULL
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 into t1 (a) values(1);
+insert ignore into t1 (a) values(1);
Warnings:
Warning 1364 Field 'b' doesn't have a default value
Warning 1364 Field 'c' doesn't have a default value
@@ -393,15 +393,15 @@ default charset latin1 collate latin1_general_cs;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `myblob` longblob,
- `mytext` longtext COLLATE latin1_general_cs
+ `myblob` longblob DEFAULT NULL,
+ `mytext` longtext COLLATE latin1_general_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs
alter table t1 character set latin2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `myblob` longblob,
- `mytext` longtext CHARACTER SET latin1 COLLATE latin1_general_cs
+ `myblob` longblob DEFAULT NULL,
+ `mytext` longtext CHARACTER SET latin1 COLLATE latin1_general_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin2
drop table t1;
CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE);
@@ -414,12 +414,12 @@ t1 CREATE TABLE `t1` (
UNIQUE KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 DROP PRIMARY KEY;
-ERROR 42000: Can't DROP 'PRIMARY'; check that column/key exists
+ERROR 42000: Can't DROP INDEX `PRIMARY`; check that it exists
DROP TABLE t1;
create table t1 (a int, b int, key(a));
insert into t1 values (1,1), (2,2);
alter table t1 drop key no_such_key;
-ERROR 42000: Can't DROP 'no_such_key'; check that column/key exists
+ERROR 42000: Can't DROP INDEX `no_such_key`; check that it exists
alter table t1 drop key a;
drop table t1;
CREATE TABLE T12207(a int) ENGINE=MYISAM;
@@ -900,7 +900,7 @@ alter table t1 convert to character set utf8;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` text
+ `a` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
drop table t1;
create table t1 (a mediumtext character set latin1);
@@ -908,7 +908,7 @@ alter table t1 convert to character set utf8;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` longtext
+ `a` longtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
drop table t1;
End of 5.0 tests
@@ -1383,7 +1383,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
- `consultant_id` int(11) NOT NULL DEFAULT '2'
+ `consultant_id` int(11) NOT NULL DEFAULT 2
) ENGINE=MyISAM DEFAULT CHARSET=utf8
DROP TABLE t1;
CREATE TABLE t1 (
@@ -1426,7 +1426,7 @@ Note 1060 Duplicate column name 'lol'
ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
Warnings:
-Note 1091 Can't DROP 'lol'; check that column/key exists
+Note 1091 Can't DROP COLUMN `lol`; check that it exists
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
Warnings:
@@ -1437,7 +1437,7 @@ Note 1054 Unknown column 'lol' in 't1'
DROP INDEX IF EXISTS x_param ON t1;
DROP INDEX IF EXISTS x_param ON t1;
Warnings:
-Note 1091 Can't DROP 'x_param'; check that column/key exists
+Note 1091 Can't DROP INDEX `x_param`; check that it exists
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
Warnings:
@@ -1468,7 +1468,7 @@ Note 1060 Duplicate column name 'lol'
ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
Warnings:
-Note 1091 Can't DROP 'lol'; check that column/key exists
+Note 1091 Can't DROP COLUMN `lol`; check that it exists
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
Warnings:
@@ -1479,7 +1479,7 @@ Note 1054 Unknown column 'lol' in 't1'
DROP INDEX IF EXISTS x_param ON t1;
DROP INDEX IF EXISTS x_param ON t1;
Warnings:
-Note 1091 Can't DROP 'x_param'; check that column/key exists
+Note 1091 Can't DROP INDEX `x_param`; check that it exists
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
Warnings:
@@ -1499,7 +1499,7 @@ Note 1061 Duplicate key name 'fk'
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS fk;
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS fk;
Warnings:
-Note 1091 Can't DROP 'fk'; check that column/key exists
+Note 1091 Can't DROP FOREIGN KEY `fk`; check that it exists
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -1513,7 +1513,7 @@ Note 1061 Duplicate key name 't2_ibfk_1'
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS t2_ibfk_1;
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS t2_ibfk_1;
Warnings:
-Note 1091 Can't DROP 't2_ibfk_1'; check that column/key exists
+Note 1091 Can't DROP FOREIGN KEY `t2_ibfk_1`; check that it exists
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -1538,10 +1538,10 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t2 DROP KEY k_id, DROP KEY IF EXISTS k_id;
Warnings:
-Note 1091 Can't DROP 'k_id'; check that column/key exists
+Note 1091 Can't DROP INDEX `k_id`; check that it exists
ALTER TABLE t2 DROP COLUMN a, DROP COLUMN IF EXISTS a;
Warnings:
-Note 1091 Can't DROP 'a'; check that column/key exists
+Note 1091 Can't DROP COLUMN `a`; check that it exists
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -1556,7 +1556,7 @@ ALTER TABLE t1 DROP KEY IF EXISTS transaction_id, ADD PRIMARY KEY IF NOT EXISTS
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `transaction_id` int(11) NOT NULL DEFAULT '0',
+ `transaction_id` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`transaction_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -1596,17 +1596,17 @@ ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= DEFAULT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
-Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release
ALTER TABLE t1 ADD INDEX i3(b), ALGORITHM= COPY;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 1
Warnings:
-Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release
ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= INPLACE;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
-Note 1831 Duplicate index `i4`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i4`. This is deprecated and will be disallowed in a future release
ALTER TABLE t1 ADD INDEX i5(b), ALGORITHM= INVALID;
ERROR HY000: Unknown ALGORITHM 'INVALID'
ALTER TABLE m1 ENABLE KEYS;
@@ -1631,17 +1631,17 @@ ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= DEFAULT;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 1
Warnings:
-Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release
ALTER TABLE t1 ADD INDEX i3(b), ALGORITHM= COPY;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 1
Warnings:
-Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release
ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= INPLACE;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
-Note 1831 Duplicate index `i4`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i4`. This is deprecated and will be disallowed in a future release
SET SESSION old_alter_table= 0;
affected rows: 0
ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
@@ -1663,24 +1663,24 @@ ALTER TABLE t1 ADD INDEX i2(b), LOCK= NONE;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
-Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release
ALTER TABLE t1 ADD INDEX i3(b), LOCK= SHARED;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
-Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release
ALTER TABLE t1 ADD INDEX i4(b), LOCK= EXCLUSIVE;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
-Note 1831 Duplicate index `i4`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i4`. This is deprecated and will be disallowed in a future release
ALTER TABLE t1 ADD INDEX i5(b), LOCK= INVALID;
ERROR HY000: Unknown LOCK type 'INVALID'
ALTER TABLE m1 ENABLE KEYS, LOCK= DEFAULT;
ALTER TABLE m1 ENABLE KEYS, LOCK= NONE;
-ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE.
+ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE
ALTER TABLE m1 ENABLE KEYS, LOCK= SHARED;
-ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE.
+ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE
ALTER TABLE m1 ENABLE KEYS, LOCK= EXCLUSIVE;
ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
#
@@ -1693,32 +1693,34 @@ ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= INPLACE, LOCK= SHARED;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
-Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release
ALTER TABLE t1 ADD INDEX i3(b), ALGORITHM= INPLACE, LOCK= EXCLUSIVE;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
-Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release
ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= COPY, LOCK= NONE;
-ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED.
+ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED
ALTER TABLE t1 ADD INDEX i5(b), ALGORITHM= COPY, LOCK= SHARED;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 1
Warnings:
-Note 1831 Duplicate index `i5`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i5`. This is deprecated and will be disallowed in a future release
ALTER TABLE t1 ADD INDEX i6(b), ALGORITHM= COPY, LOCK= EXCLUSIVE;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 1
Warnings:
-Note 1831 Duplicate index `i6`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i6`. This is deprecated and will be disallowed in a future release
ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= NONE;
-ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE.
+ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE
ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= SHARED;
-ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE.
+ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE
ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= EXCLUSIVE;
affected rows: 0
ALTER TABLE m1 ENABLE KEYS, ALGORITHM= COPY, LOCK= NONE;
-ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED.
+ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED
+ALTER ONLINE TABLE m1 ADD COLUMN c int;
+ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
ALTER TABLE m1 ENABLE KEYS, ALGORITHM= COPY, LOCK= SHARED;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 0
@@ -1733,16 +1735,17 @@ 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);
-# Connection con1
+connect con1, localhost, root;
# Sending:
ALTER TABLE t1 DISABLE KEYS;
-# Connection default
+connection default;
# Waiting until ALTER TABLE is blocked.
UPDATE t1 SET b = 4;
COMMIT;
-# Connection con1
+connection con1;
# Reaping: ALTER TABLE t1 DISABLE KEYS
-# Connection default
+disconnect con1;
+connection default;
DROP TABLE t1;
#
# 7: Which operations require copy and which can be done in-place?
@@ -1820,7 +1823,7 @@ ALTER TABLE tm1 ADD FULLTEXT INDEX im4 (d2);
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 0
ALTER TABLE ti1 ADD PRIMARY KEY(a), ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY
ALTER TABLE ti1 ADD PRIMARY KEY(a);
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 0
@@ -1909,8 +1912,8 @@ ALTER TABLE tm1 MODIFY COLUMN c INT NULL;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 0
ALTER TABLE ti1 MODIFY COLUMN h VARCHAR(30);
-affected rows: 2
-info: Records: 2 Duplicates: 0 Warnings: 0
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE tm1 MODIFY COLUMN h VARCHAR(30);
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 0
@@ -2112,7 +2115,7 @@ tab1 CREATE TABLE `tab1` (
`field6` varchar(32) NOT NULL,
`field7` varchar(32) NOT NULL,
`field8` varchar(32) NOT NULL,
- `field9` int(11) NOT NULL DEFAULT '1',
+ `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) DEFAULT NULL,
@@ -2130,10 +2133,10 @@ tab1 CREATE TABLE `tab1` (
`field6` varchar(32) NOT NULL,
`field7` varchar(32) NOT NULL,
`field8` varchar(32) NOT NULL,
- `field9` int(11) NOT NULL DEFAULT '1',
+ `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,
+ `v_col` varchar(128) GENERATED ALWAYS 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`))) STORED,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE `tab1`;
@@ -2200,3 +2203,111 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# MDEV-10421 duplicate CHECK CONSTRAINTs
+#
+CREATE TABLE t1 (a INT, b INT) engine=myisam;
+ALTER TABLE t1 ADD CONSTRAINT IF NOT EXISTS `min` CHECK (a+b > 100);
+ALTER TABLE t1 ADD CONSTRAINT `min` CHECK (a+b > 100);
+ERROR HY000: Duplicate CHECK constraint name 'min'
+ALTER TABLE t1 ADD CONSTRAINT IF NOT EXISTS `min` CHECK (a+b > 100);
+Warnings:
+Note 1826 Duplicate CHECK constraint name 'min'
+ALTER TABLE t1 ADD CONSTRAINT `mini` CHECK (a+b > 100);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ CONSTRAINT `min` CHECK (`a` + `b` > 100),
+ CONSTRAINT `mini` CHECK (`a` + `b` > 100)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a INT, b INT, CONSTRAINT min check (a>5),
+CONSTRAINT min check (b>5));
+ERROR HY000: Duplicate CHECK constraint name 'min'
+create table t1 (a int, b int, check(a>b));
+alter table t1 drop column a;
+ERROR 42S22: Unknown column 'a' in 'CHECK'
+alter table t1 drop column b, add column b bigint first;
+ERROR 42S22: Unknown column 'b' in 'CHECK'
+alter table t1 drop column a, drop constraint constraint_1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a int, b int, check(a>0));
+alter table t1 drop column a;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a int, b int, c int, unique(a));
+alter table t1 drop column a;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a int, b int, c int, unique(a,b));
+alter table t1 drop column a;
+ERROR 42000: Key column 'a' doesn't exist in table
+alter table t1 drop column a, drop index a;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+#
+# MDEV-13508 Check that rename of columns changes defaults, virtual
+# columns and constraints
+#
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `b` int(11) DEFAULT NULL,
+ `a` int(11) DEFAULT NULL,
+ CONSTRAINT `CONSTRAINT_1` CHECK (`b` > `a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `new_b` int(11) NOT NULL,
+ `c` int(11) DEFAULT (`a` + `new_b`) CHECK (`a` + `new_b` > 0),
+ `d` int(11) GENERATED ALWAYS AS (`a` + `new_b`) VIRTUAL,
+ `b` char(1) DEFAULT NULL,
+ PRIMARY KEY (`a`),
+ KEY `b` (`new_b`),
+ CONSTRAINT `test` CHECK (`a` + `new_b` > 1),
+ CONSTRAINT `new` CHECK (length(`b`) > 0)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/alter_table_mdev539_maria.result b/mysql-test/r/alter_table_mdev539_maria.result
index 703908825d2..0206f4070a0 100644
--- a/mysql-test/r/alter_table_mdev539_maria.result
+++ b/mysql-test/r/alter_table_mdev539_maria.result
@@ -3,6 +3,7 @@ set @@storage_engine= Aria;
#
# mdev-539: fast build of unique/primary indexes for MyISAM/Aria
#
+call mtr.add_suppression("Can't find record in '.*'");
DROP DATABASE IF EXISTS dbt3_s001;
CREATE DATABASE dbt3_s001;
use dbt3_s001;
@@ -10,10 +11,10 @@ drop index `primary` on lineitem;
show create table lineitem;
Table Create Table
lineitem CREATE TABLE `lineitem` (
- `l_orderkey` int(11) NOT NULL DEFAULT '0',
+ `l_orderkey` int(11) NOT NULL DEFAULT 0,
`l_partkey` int(11) DEFAULT NULL,
`l_suppkey` int(11) DEFAULT NULL,
- `l_linenumber` int(11) NOT NULL DEFAULT '0',
+ `l_linenumber` int(11) NOT NULL DEFAULT 0,
`l_quantity` double DEFAULT NULL,
`l_extendedprice` double DEFAULT NULL,
`l_discount` double DEFAULT NULL,
@@ -39,10 +40,10 @@ alter table lineitem add primary key (l_orderkey, l_linenumber);
show create table lineitem;
Table Create Table
lineitem CREATE TABLE `lineitem` (
- `l_orderkey` int(11) NOT NULL DEFAULT '0',
+ `l_orderkey` int(11) NOT NULL DEFAULT 0,
`l_partkey` int(11) DEFAULT NULL,
`l_suppkey` int(11) DEFAULT NULL,
- `l_linenumber` int(11) NOT NULL DEFAULT '0',
+ `l_linenumber` int(11) NOT NULL DEFAULT 0,
`l_quantity` double DEFAULT NULL,
`l_extendedprice` double DEFAULT NULL,
`l_discount` double DEFAULT NULL,
@@ -80,10 +81,10 @@ ERROR 23000: Duplicate entry '1-2' for key 'PRIMARY'
show create table lineitem;
Table Create Table
lineitem CREATE TABLE `lineitem` (
- `l_orderkey` int(11) NOT NULL DEFAULT '0',
+ `l_orderkey` int(11) NOT NULL DEFAULT 0,
`l_partkey` int(11) DEFAULT NULL,
`l_suppkey` int(11) DEFAULT NULL,
- `l_linenumber` int(11) NOT NULL DEFAULT '0',
+ `l_linenumber` int(11) NOT NULL DEFAULT 0,
`l_quantity` double DEFAULT NULL,
`l_extendedprice` double DEFAULT NULL,
`l_discount` double DEFAULT NULL,
@@ -114,10 +115,10 @@ alter table lineitem add primary key (l_orderkey, l_linenumber);
show create table lineitem;
Table Create Table
lineitem CREATE TABLE `lineitem` (
- `l_orderkey` int(11) NOT NULL DEFAULT '0',
+ `l_orderkey` int(11) NOT NULL DEFAULT 0,
`l_partkey` int(11) DEFAULT NULL,
`l_suppkey` int(11) DEFAULT NULL,
- `l_linenumber` int(11) NOT NULL DEFAULT '0',
+ `l_linenumber` int(11) NOT NULL DEFAULT 0,
`l_quantity` double DEFAULT NULL,
`l_extendedprice` double DEFAULT NULL,
`l_discount` double DEFAULT NULL,
diff --git a/mysql-test/r/alter_table_mdev539_myisam.result b/mysql-test/r/alter_table_mdev539_myisam.result
index 7140c544836..0339a64c9c7 100644
--- a/mysql-test/r/alter_table_mdev539_myisam.result
+++ b/mysql-test/r/alter_table_mdev539_myisam.result
@@ -3,6 +3,7 @@ set @@storage_engine= MyISAM;
#
# mdev-539: fast build of unique/primary indexes for MyISAM/Aria
#
+call mtr.add_suppression("Can't find record in '.*'");
DROP DATABASE IF EXISTS dbt3_s001;
CREATE DATABASE dbt3_s001;
use dbt3_s001;
@@ -10,10 +11,10 @@ drop index `primary` on lineitem;
show create table lineitem;
Table Create Table
lineitem CREATE TABLE `lineitem` (
- `l_orderkey` int(11) NOT NULL DEFAULT '0',
+ `l_orderkey` int(11) NOT NULL DEFAULT 0,
`l_partkey` int(11) DEFAULT NULL,
`l_suppkey` int(11) DEFAULT NULL,
- `l_linenumber` int(11) NOT NULL DEFAULT '0',
+ `l_linenumber` int(11) NOT NULL DEFAULT 0,
`l_quantity` double DEFAULT NULL,
`l_extendedprice` double DEFAULT NULL,
`l_discount` double DEFAULT NULL,
@@ -39,10 +40,10 @@ alter table lineitem add primary key (l_orderkey, l_linenumber);
show create table lineitem;
Table Create Table
lineitem CREATE TABLE `lineitem` (
- `l_orderkey` int(11) NOT NULL DEFAULT '0',
+ `l_orderkey` int(11) NOT NULL DEFAULT 0,
`l_partkey` int(11) DEFAULT NULL,
`l_suppkey` int(11) DEFAULT NULL,
- `l_linenumber` int(11) NOT NULL DEFAULT '0',
+ `l_linenumber` int(11) NOT NULL DEFAULT 0,
`l_quantity` double DEFAULT NULL,
`l_extendedprice` double DEFAULT NULL,
`l_discount` double DEFAULT NULL,
@@ -80,10 +81,10 @@ ERROR 23000: Duplicate entry '1-2' for key 'PRIMARY'
show create table lineitem;
Table Create Table
lineitem CREATE TABLE `lineitem` (
- `l_orderkey` int(11) NOT NULL DEFAULT '0',
+ `l_orderkey` int(11) NOT NULL DEFAULT 0,
`l_partkey` int(11) DEFAULT NULL,
`l_suppkey` int(11) DEFAULT NULL,
- `l_linenumber` int(11) NOT NULL DEFAULT '0',
+ `l_linenumber` int(11) NOT NULL DEFAULT 0,
`l_quantity` double DEFAULT NULL,
`l_extendedprice` double DEFAULT NULL,
`l_discount` double DEFAULT NULL,
@@ -114,10 +115,10 @@ alter table lineitem add primary key (l_orderkey, l_linenumber);
show create table lineitem;
Table Create Table
lineitem CREATE TABLE `lineitem` (
- `l_orderkey` int(11) NOT NULL DEFAULT '0',
+ `l_orderkey` int(11) NOT NULL DEFAULT 0,
`l_partkey` int(11) DEFAULT NULL,
`l_suppkey` int(11) DEFAULT NULL,
- `l_linenumber` int(11) NOT NULL DEFAULT '0',
+ `l_linenumber` int(11) NOT NULL DEFAULT 0,
`l_quantity` double DEFAULT NULL,
`l_extendedprice` double DEFAULT NULL,
`l_discount` double DEFAULT NULL,
diff --git a/mysql-test/r/alter_table_online.result b/mysql-test/r/alter_table_online.result
index 4c338a1ebe6..54df4e0c96c 100644
--- a/mysql-test/r/alter_table_online.result
+++ b/mysql-test/r/alter_table_online.result
@@ -20,21 +20,21 @@ drop table t2;
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);
alter online table t1 drop column b, add b int;
-ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED.
+ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 modify b bigint;
-ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED.
+ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 modify e enum('c','a','b');
-ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED.
+ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 modify c varchar(50);
-ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED.
+ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 modify c varchar(100);
-ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED.
+ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 add f int;
-ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED.
+ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 engine=memory;
-ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED.
+ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED
alter online table t1 rename to t2;
-ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE.
+ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE
alter table t1 engine=innodb;
alter table t1 add index (b);
alter online table t1 add index c (c);
@@ -59,7 +59,7 @@ 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);
alter online table t3 union=(t1,t2);
-ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE.
+ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE
drop table t1,t2,t3;
create table t1 (i int) partition by hash(i) partitions 2;
alter online table t1 comment 'test';
@@ -114,75 +114,75 @@ ALTER TABLE t1 MODIFY a LONGTEXT, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10));
ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_bin, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10));
ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_bin, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a TINYTEXT);
ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMTEXT);
ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a TEXT);
ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a LONGTEXT);
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10) COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a TINYTEXT COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMTEXT COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a TEXT COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a LONGTEXT COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10) COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a TINYTEXT COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMTEXT COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a TEXT COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a LONGTEXT COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
select @@global.delay_key_write;
@@global.delay_key_write
diff --git a/mysql-test/r/alter_user.result b/mysql-test/r/alter_user.result
new file mode 100644
index 00000000000..ac668bba8fa
--- /dev/null
+++ b/mysql-test/r/alter_user.result
@@ -0,0 +1,93 @@
+select * from mysql.user where user = 'root' and host = 'localhost';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+localhost root Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 0 0 0 0 N N 0.000000
+# Test syntax
+#
+# 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';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+localhost root Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 0 0 0 0 N N 0.000000
+alter user CURRENT_USER();
+select * from mysql.user where user = 'root' and host = 'localhost';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+localhost root Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 0 0 0 0 N N 0.000000
+create user foo;
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N N 0.000000
+alter user foo;
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N N 0.000000
+# 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;
+# Currently no super privileges.
+connect a, localhost, foo;
+select @@global.read_only;
+@@global.read_only
+1
+alter user foo;
+ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
+# Grant super privilege to the user.
+connection default;
+grant super on *.* to foo;
+# 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;
+# Test inexistant user.
+alter user boo;
+ERROR HY000: Operation ALTER USER failed for 'boo'
+#--warning ER_CANNOT_USER
+alter if exists user boo;
+Warnings:
+Error 1133 Can't find any matching row in the user table
+Note 1396 Operation ALTER USER failed for 'boo'
+# Test password related altering.
+alter user foo identified by 'something';
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N 0 0 0 0 N N 0.000000
+alter user foo identified by 'something2';
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo *9CD58369E930E28C8996A89DB18B63294E6DC10C N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N 0 0 0 0 N N 0.000000
+alter user foo identified by password '*88C89BE093D4ECF72D039F62EBB7477EA1FD4D63';
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N 0 0 0 0 N N 0.000000
+alter user foo identified with 'somecoolplugin';
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N 0 0 0 0 somecoolplugin N N 0.000000
+alter user foo identified with 'somecoolplugin' using 'somecoolpassphrase';
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N 0 0 0 0 somecoolplugin somecoolpassphrase N N 0.000000
+# Test ssl related altering.
+alter user foo identified by 'something' require SSL;
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N ANY 0 0 0 0 N N 0.000000
+alter user foo identified by 'something' require X509;
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N X509 0 0 0 0 N N 0.000000
+alter user foo identified by 'something'
+require cipher 'text' issuer 'foo_issuer' subject 'foo_subject';
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N SPECIFIED text foo_issuer foo_subject 0 0 0 0 N N 0.000000
+# 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';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N SPECIFIED text foo_issuer foo_subject 10 20 30 40 N N 0.000000
+drop user foo;
diff --git a/mysql-test/r/analyze_debug.result b/mysql-test/r/analyze_debug.result
new file mode 100644
index 00000000000..2a11578a841
--- /dev/null
+++ b/mysql-test/r/analyze_debug.result
@@ -0,0 +1,10 @@
+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;
+Table Op Msg_type Msg_text
+test.t1 analyze status Operation failed
+drop table t1;
+SET use_stat_tables= @save_use_stat_tables;
diff --git a/mysql-test/r/analyze_format_json.result b/mysql-test/r/analyze_format_json.result
index ea9afd9215f..307fb734026 100644
--- a/mysql-test/r/analyze_format_json.result
+++ b/mysql-test/r/analyze_format_json.result
@@ -18,7 +18,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 30,
- "attached_condition": "(t0.a < 3)"
+ "attached_condition": "t0.a < 3"
}
}
}
@@ -46,7 +46,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 0,
- "attached_condition": "((t0.a > 9) and (t0.a is not null))"
+ "attached_condition": "t0.a > 9 and t0.a is not null"
},
"table": {
"table_name": "t1",
@@ -86,7 +86,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
- "attached_condition": "(t0.a is not null)"
+ "attached_condition": "t0.a is not null"
},
"table": {
"table_name": "t1",
@@ -102,7 +102,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 40,
- "attached_condition": "(t1.b < 4)"
+ "attached_condition": "t1.b < 4"
}
}
}
@@ -128,7 +128,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 20,
- "attached_condition": "(tbl1.b < 20)"
+ "attached_condition": "tbl1.b < 20"
},
"block-nl-join": {
"table": {
@@ -140,7 +140,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 60,
- "attached_condition": "(tbl2.b < 60)"
+ "attached_condition": "tbl2.b < 60"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
@@ -166,7 +166,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 20,
- "attached_condition": "(tbl1.b < 20)"
+ "attached_condition": "tbl1.b < 20"
},
"block-nl-join": {
"table": {
@@ -178,12 +178,12 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 60,
- "attached_condition": "(tbl2.b < 60)"
+ "attached_condition": "tbl2.b < 60"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
- "attached_condition": "(tbl1.c > tbl2.c)",
+ "attached_condition": "tbl1.c > tbl2.c",
"r_filtered": 15.833
}
}
@@ -213,7 +213,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
- "attached_condition": "(t1.a is not null)"
+ "attached_condition": "t1.a is not null"
},
"table": {
"table_name": "t2",
@@ -242,6 +242,8 @@ insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
select database();
database()
test
+connect con1,localhost,root,,*NO-ONE*;
+connection con1;
select database();
database()
NULL
@@ -261,10 +263,12 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 50,
- "attached_condition": "(test.t1.a < 5)"
+ "attached_condition": "test.t1.a < 5"
}
}
}
+disconnect con1;
+connection default;
drop table t1;
#
# MDEV-7812: ANALYZE FORMAT=JSON UPDATE/DELETE doesnt print
@@ -316,8 +320,8 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 50,
- "index_condition": "(t1.pk < 10)",
- "attached_condition": "(t1.b > 4)"
+ "index_condition": "t1.pk < 10",
+ "attached_condition": "t1.b > 4"
}
}
}
@@ -340,7 +344,7 @@ ANALYZE
"r_rows": 10,
"r_filtered": 50,
"r_total_time_ms": "REPLACED",
- "attached_condition": "((t1.pk < 10) and (t1.b > 4))"
+ "attached_condition": "t1.pk < 10 and t1.b > 4"
}
}
}
@@ -440,7 +444,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 50,
- "attached_condition": "(tbl1.a < 5)"
+ "attached_condition": "tbl1.a < 5"
}
}
},
@@ -458,7 +462,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 20,
- "attached_condition": "(tbl2.a in (2,3))"
+ "attached_condition": "tbl2.a in (2,3)"
}
}
}
@@ -488,8 +492,9 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "having_condition": "(TOP > a)",
+ "having_condition": "TOP > t2.a",
"filesort": {
+ "sort_key": "t2.a",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"r_used_priority_queue": false,
@@ -519,6 +524,7 @@ ANALYZE
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"filesort": {
+ "sort_key": "t2.a",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"r_used_priority_queue": false,
@@ -559,6 +565,7 @@ ANALYZE
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"filesort": {
+ "sort_key": "t2.a",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"r_used_priority_queue": false,
@@ -619,6 +626,7 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
+ "attached_condition": "<in_optimizer>(t2.b,t2.b in (subquery#2))",
"r_filtered": null
},
"subqueries": [
@@ -664,18 +672,20 @@ ANALYZE
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"filesort": {
+ "sort_key": "group_concat(t3.f3 separator ',')",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"r_used_priority_queue": false,
"r_output_rows": 0,
"r_buffer_size": "REPLACED",
- "filesort": {
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "r_used_priority_queue": false,
- "r_output_rows": 0,
- "r_buffer_size": "REPLACED",
- "temporary_table": {
+ "temporary_table": {
+ "filesort": {
+ "sort_key": "(subquery#2)",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 0,
+ "r_buffer_size": "REPLACED",
"temporary_table": {
"table": {
"table_name": "t2",
@@ -697,7 +707,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 0,
- "attached_condition": "(t3.f3 in (1,2))"
+ "attached_condition": "t3.f3 in (1,2)"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
@@ -733,7 +743,7 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
- "attached_condition": "(t2.f2 = t3.f3)",
+ "attached_condition": "t2.f2 = t3.f3",
"r_filtered": null
}
}
@@ -747,3 +757,63 @@ ANALYZE
}
}
drop table t1,t2,t3;
+#
+# MDEV-13286: Floating point exception in Filesort_tracker::print_json_members(Json_writer*)
+#
+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;
+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;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 0,
+ "attached_condition": "t1.a < 0"
+ },
+ "subqueries": [
+ {
+ "expression_cache": {
+ "state": "uninitialized",
+ "r_loops": 0,
+ "query_block": {
+ "select_id": 2,
+ "read_sorted_file": {
+ "r_rows": null,
+ "filesort": {
+ "sort_key": "t2.c",
+ "r_loops": null,
+ "r_limit": null,
+ "r_used_priority_queue": null,
+ "r_output_rows": null,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "rows": 10,
+ "r_rows": null,
+ "filtered": 100,
+ "r_filtered": null,
+ "attached_condition": "t2.a < t1.a"
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+}
+drop table t0,t1,t2;
diff --git a/mysql-test/r/analyze_stmt_orderby.result b/mysql-test/r/analyze_stmt_orderby.result
index be1f01a2a52..8d904a4419b 100644
--- a/mysql-test/r/analyze_stmt_orderby.result
+++ b/mysql-test/r/analyze_stmt_orderby.result
@@ -79,7 +79,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 8,
- "attached_condition": "(t2.a < 10)"
+ "attached_condition": "t2.a < 10"
}
}
}
@@ -104,7 +104,7 @@ ANALYZE
"r_rows": 10,
"r_filtered": 100,
"r_total_time_ms": "REPLACED",
- "attached_condition": "(t2.a < 10)"
+ "attached_condition": "t2.a < 10"
}
}
}
@@ -172,14 +172,14 @@ EXPLAIN
"query_block": {
"select_id": 1,
"filesort": {
+ "sort_key": "t2.b",
"temporary_table": {
- "function": "buffer",
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"filtered": 100,
- "attached_condition": "(t0.a is not null)"
+ "attached_condition": "t0.a is not null"
},
"table": {
"table_name": "t2",
@@ -205,6 +205,7 @@ ANALYZE
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"filesort": {
+ "sort_key": "t2.b",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"r_limit": 4,
@@ -220,7 +221,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
- "attached_condition": "(t0.a is not null)"
+ "attached_condition": "t0.a is not null"
},
"table": {
"table_name": "t2",
@@ -257,12 +258,13 @@ EXPLAIN
"select_id": 1,
"read_sorted_file": {
"filesort": {
+ "sort_key": "t0.a",
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"filtered": 100,
- "attached_condition": "(t0.a is not null)"
+ "attached_condition": "t0.a is not null"
}
}
},
@@ -290,6 +292,7 @@ ANALYZE
"read_sorted_file": {
"r_rows": 10,
"filesort": {
+ "sort_key": "t0.a",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"r_used_priority_queue": false,
@@ -304,7 +307,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 1,
- "attached_condition": "(t0.a is not null)"
+ "attached_condition": "t0.a is not null"
}
}
},
@@ -346,6 +349,7 @@ ANALYZE
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"filesort": {
+ "sort_key": "t2.c",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"r_used_priority_queue": false,
@@ -361,7 +365,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 50,
- "attached_condition": "((t2.a % 2) = 0)"
+ "attached_condition": "t2.a % 2 = 0"
}
}
}
@@ -424,7 +428,7 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
- "attached_condition": "(t3.a = t0.a)",
+ "attached_condition": "t3.a = t0.a",
"r_filtered": 10
}
}
@@ -455,18 +459,20 @@ ANALYZE
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"filesort": {
+ "sort_key": "count(distinct t5.b)",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"r_limit": 1,
"r_used_priority_queue": true,
"r_output_rows": 2,
- "filesort": {
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "r_used_priority_queue": false,
- "r_output_rows": 6,
- "r_buffer_size": "REPLACED",
- "temporary_table": {
+ "temporary_table": {
+ "filesort": {
+ "sort_key": "t5.a",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 6,
+ "r_buffer_size": "REPLACED",
"temporary_table": {
"table": {
"table_name": "t6",
@@ -477,7 +483,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 80,
- "attached_condition": "((t6.b > 0) and (t6.a <= 5))"
+ "attached_condition": "t6.b > 0 and t6.a <= 5"
},
"block-nl-join": {
"table": {
@@ -493,7 +499,7 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
- "attached_condition": "(t5.a = t6.a)",
+ "attached_condition": "t5.a = t6.a",
"r_filtered": 21.429
}
}
@@ -511,26 +517,31 @@ EXPLAIN
"query_block": {
"select_id": 1,
"filesort": {
+ "sort_key": "count(distinct t5.b)",
"temporary_table": {
- "function": "buffer",
- "table": {
- "table_name": "t6",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "((t6.b > 0) and (t6.a <= 5))"
- },
- "block-nl-join": {
- "table": {
- "table_name": "t5",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100
- },
- "buffer_type": "flat",
- "buffer_size": "256Kb",
- "join_type": "BNL",
- "attached_condition": "(t5.a = t6.a)"
+ "filesort": {
+ "sort_key": "t5.a",
+ "temporary_table": {
+ "table": {
+ "table_name": "t6",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t6.b > 0 and t6.a <= 5"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t5",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "t5.a = t6.a"
+ }
+ }
}
}
}
diff --git a/mysql-test/r/assign_key_cache_debug.result b/mysql-test/r/assign_key_cache_debug.result
index 4a0fc58cd4f..c4cb56f3f72 100644
--- a/mysql-test/r/assign_key_cache_debug.result
+++ b/mysql-test/r/assign_key_cache_debug.result
@@ -1,12 +1,17 @@
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';
cache index t1 in kc1;
+connection default;
set debug_sync='assign_key_cache_op_lock signal op_locked wait_for assigned';
cache index t1 in kc1;
+connection con1;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
set debug_sync='now signal assigned';
+disconnect con1;
+connection default;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
drop table t1;
diff --git a/mysql-test/r/auth_named_pipe.result b/mysql-test/r/auth_named_pipe.result
index 3268b760a22..fb190ccd149 100644
--- a/mysql-test/r/auth_named_pipe.result
+++ b/mysql-test/r/auth_named_pipe.result
@@ -1,8 +1,11 @@
INSTALL SONAME 'auth_named_pipe';
CREATE USER 'USERNAME' IDENTIFIED WITH named_pipe;
+connect pipe_con,localhost,$USERNAME,,,,,PIPE;
SELECT USER(),CURRENT_USER();
USER() CURRENT_USER()
USERNAME@localhost USERNAME@%
+disconnect pipe_con;
+connection default;
DROP USER 'USERNAME';
CREATE USER nosuchuser IDENTIFIED WITH named_pipe;
ERROR 28000: Access denied for user 'nosuchuser'@'localhost'
diff --git a/mysql-test/r/auth_rpl.result b/mysql-test/r/auth_rpl.result
index 70626b02b2b..a3da7985da1 100644
--- a/mysql-test/r/auth_rpl.result
+++ b/mysql-test/r/auth_rpl.result
@@ -1,16 +1,18 @@
include/master-slave.inc
[connection master]
-[connection slave]
+connection slave;
include/stop_slave.inc
-[connection master]
+connection master;
CREATE USER 'plug_user' IDENTIFIED WITH 'test_plugin_server' AS 'plug_user';
GRANT REPLICATION SLAVE ON *.* TO plug_user;
FLUSH PRIVILEGES;
-[connection slave]
+connection slave;
CHANGE MASTER TO
MASTER_USER= 'plug_user',
MASTER_PASSWORD= 'plug_user';
include/start_slave.inc
+connection master;
+connection slave;
# Slave in-sync with master now.
SELECT user, plugin, authentication_string FROM mysql.user WHERE user LIKE 'plug_user';
user plugin authentication_string
@@ -20,5 +22,6 @@ include/stop_slave.inc
CHANGE MASTER TO MASTER_USER='root';
DROP USER 'plug_user';
# Cleanup (on master).
+connection master;
DROP USER 'plug_user';
include/rpl_end.inc
diff --git a/mysql-test/r/auto_increment_ranges_innodb.result b/mysql-test/r/auto_increment_ranges_innodb.result
index fb936ddfd2b..1d827a5a166 100644
--- a/mysql-test/r/auto_increment_ranges_innodb.result
+++ b/mysql-test/r/auto_increment_ranges_innodb.result
@@ -25,7 +25,7 @@ truncate table t1;
insert into t1 values(32767-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
-insert into t1 values(32767+1);
+insert ignore into t1 values(32767+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
@@ -59,7 +59,7 @@ truncate table t1;
insert into t1 values(65535-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
-insert into t1 values(65535+1);
+insert ignore into t1 values(65535+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
@@ -93,7 +93,7 @@ truncate table t1;
insert into t1 values(2147483647-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
-insert into t1 values(2147483647+1);
+insert ignore into t1 values(2147483647+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
@@ -127,7 +127,7 @@ truncate table t1;
insert into t1 values(4294967295-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
-insert into t1 values(4294967295+1);
+insert ignore into t1 values(4294967295+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
@@ -161,7 +161,7 @@ truncate table t1;
insert into t1 values(cast(9223372036854775807 as unsigned)-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
-insert into t1 values(cast(9223372036854775807 as unsigned)+1);
+insert ignore into t1 values(cast(9223372036854775807 as unsigned)+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
@@ -245,7 +245,7 @@ DROP TABLE t1;
#
CREATE TABLE t1 (a smallint AUTO_INCREMENT, PRIMARY KEY (a));
INSERT INTO t1 VALUES (2);
-INSERT INTO t1 VALUES (32768);
+INSERT IGNORE INTO t1 VALUES (32768);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
INSERT INTO t1 VALUES (NULL);
diff --git a/mysql-test/r/auto_increment_ranges_myisam.result b/mysql-test/r/auto_increment_ranges_myisam.result
index 5101321c864..e849e980083 100644
--- a/mysql-test/r/auto_increment_ranges_myisam.result
+++ b/mysql-test/r/auto_increment_ranges_myisam.result
@@ -26,7 +26,7 @@ truncate table t1;
insert into t1 values(32767-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
-insert into t1 values(32767+1);
+insert ignore into t1 values(32767+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
@@ -61,7 +61,7 @@ truncate table t1;
insert into t1 values(65535-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
-insert into t1 values(65535+1);
+insert ignore into t1 values(65535+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
@@ -96,7 +96,7 @@ truncate table t1;
insert into t1 values(2147483647-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
-insert into t1 values(2147483647+1);
+insert ignore into t1 values(2147483647+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
@@ -131,7 +131,7 @@ truncate table t1;
insert into t1 values(4294967295-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
-insert into t1 values(4294967295+1);
+insert ignore into t1 values(4294967295+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
@@ -166,7 +166,7 @@ truncate table t1;
insert into t1 values(cast(9223372036854775807 as unsigned)-1),(NULL),(NULL);
ERROR 22003: Out of range value for column 'a' at row 3
truncate table t1;
-insert into t1 values(cast(9223372036854775807 as unsigned)+1);
+insert ignore into t1 values(cast(9223372036854775807 as unsigned)+1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
@@ -251,7 +251,7 @@ DROP TABLE t1;
#
CREATE TABLE t1 (a smallint AUTO_INCREMENT, PRIMARY KEY (a));
INSERT INTO t1 VALUES (2);
-INSERT INTO t1 VALUES (32768);
+INSERT IGNORE INTO t1 VALUES (32768);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
INSERT INTO t1 VALUES (NULL);
diff --git a/mysql-test/r/bench_count_distinct.result b/mysql-test/r/bench_count_distinct.result
index 79e12afd237..8b67e4be38a 100644
--- a/mysql-test/r/bench_count_distinct.result
+++ b/mysql-test/r/bench_count_distinct.result
@@ -5,7 +5,7 @@ count(distinct n)
100
explain extended select count(distinct n) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 index NULL n 4 NULL 200 100.00 Using index
+1 SIMPLE t1 range NULL n 4 NULL 10 100.00 Using index for group-by
Warnings:
Note 1003 select count(distinct `test`.`t1`.`n`) AS `count(distinct n)` from `test`.`t1`
drop table t1;
diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result
index f21a1a763a3..8f4b287ab21 100644
--- a/mysql-test/r/bigint.result
+++ b/mysql-test/r/bigint.result
@@ -60,6 +60,7 @@ min(big) max(big) max(big)-1
select min(big),max(big),max(big)-1 from t1 group by a;
min(big) max(big) max(big)-1
-1 9223372036854775807 9223372036854775806
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 modify big bigint unsigned not null;
Warnings:
Warning 1264 Out of range value for column 'big' at row 1
@@ -90,6 +91,7 @@ min(big) max(big) max(big)-1
select min(big),max(big),max(big)-1 from t1 group by a;
min(big) max(big) max(big)-1
0 18446744073709551615 18446744073709551614
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 modify big bigint not null;
Warnings:
Warning 1264 Out of range value for column 'big' at row 5
@@ -208,7 +210,7 @@ a b c d
18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
drop table t1;
create table t1 ( quantity decimal(2) unsigned);
-insert into t1 values (500), (-500), (~0), (-1);
+insert ignore into t1 values (500), (-500), (~0), (-1);
Warnings:
Warning 1264 Out of range value for column 'quantity' at row 1
Warning 1264 Out of range value for column 'quantity' at row 2
@@ -362,12 +364,12 @@ select cast(19999999999999999999 as signed);
cast(19999999999999999999 as signed)
9223372036854775807
Warnings:
-Warning 1916 Got overflow when converting '19999999999999999999' to INT. Value truncated.
+Warning 1916 Got overflow when converting '19999999999999999999' to INT. Value truncated
select cast(-19999999999999999999 as signed);
cast(-19999999999999999999 as signed)
-9223372036854775808
Warnings:
-Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated
select -9223372036854775808;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def -9223372036854775808 8 20 20 N 32897 0 63
@@ -385,7 +387,7 @@ def -((9223372036854775808)) 8 20 20 N 32897 0 63
-9223372036854775808
select -(-(9223372036854775808));
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def -(-(9223372036854775808)) 246 21 19 N 32897 0 63
+def -(-(9223372036854775808)) 246 20 19 N 32897 0 63
-(-(9223372036854775808))
9223372036854775808
select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;
@@ -420,22 +422,22 @@ UPDATE t1 SET b = a;
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = 18446744073709551615 AND TRIM(a) = b;
SHOW WARNINGS;
Level Code Message
-Note 1003 select 1 AS `1` from `test`.`t1` where ((`test`.`t1`.`a` = 18446744073709551615) and ('18446744073709551615' = `test`.`t1`.`b`))
+Note 1003 select 1 AS `1` from `test`.`t1` where `test`.`t1`.`a` = 18446744073709551615 and '18446744073709551615' = `test`.`t1`.`b`
# 8000000000000000
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = 9223372036854775808 AND TRIM(a) = b;
SHOW WARNINGS;
Level Code Message
-Note 1003 select 1 AS `1` from `test`.`t1` where ((`test`.`t1`.`a` = 9223372036854775808) and ('9223372036854775808' = `test`.`t1`.`b`))
+Note 1003 select 1 AS `1` from `test`.`t1` where `test`.`t1`.`a` = 9223372036854775808 and '9223372036854775808' = `test`.`t1`.`b`
# 7FFFFFFFFFFFFFFF
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = 9223372036854775807 AND TRIM(a) = b;
SHOW WARNINGS;
Level Code Message
-Note 1003 select 1 AS `1` from `test`.`t1` where ((`test`.`t1`.`a` = 9223372036854775807) and ('9223372036854775807' = `test`.`t1`.`b`))
+Note 1003 select 1 AS `1` from `test`.`t1` where `test`.`t1`.`a` = 9223372036854775807 and '9223372036854775807' = `test`.`t1`.`b`
# 0
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = 0 AND TRIM(a) = b;
SHOW WARNINGS;
Level Code Message
-Note 1003 select 1 AS `1` from `test`.`t1` where ((`test`.`t1`.`a` = 0) and ('0' = `test`.`t1`.`b`))
+Note 1003 select 1 AS `1` from `test`.`t1` where `test`.`t1`.`a` = 0 and '0' = `test`.`t1`.`b`
DROP TABLE t1;
# End of 5.1 tests
#
diff --git a/mysql-test/r/binary_to_hex.result b/mysql-test/r/binary_to_hex.result
index a6b68834da8..345df1de538 100644
--- a/mysql-test/r/binary_to_hex.result
+++ b/mysql-test/r/binary_to_hex.result
@@ -12,11 +12,11 @@ c9 GEOMETRY) CHARACTER SET = binary;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` tinyblob,
- `c2` blob,
- `c3` mediumblob,
- `c4` longblob,
- `c5` blob,
+ `c1` tinyblob DEFAULT NULL,
+ `c2` blob DEFAULT NULL,
+ `c3` mediumblob DEFAULT NULL,
+ `c4` longblob DEFAULT NULL,
+ `c5` blob DEFAULT NULL,
`c6` bit(1) DEFAULT NULL,
`c7` binary(1) DEFAULT NULL,
`c8` varbinary(10) DEFAULT NULL,
@@ -32,7 +32,7 @@ Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) DEFAULT NULL,
`col1` binary(10) DEFAULT NULL,
- `col2` blob
+ `col2` blob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t2 VALUES (1, X'AB1234', X'123ABC'), (2, X'DE1234', X'123DEF');
#Print the table contents when binary-as-hex option is off.
diff --git a/mysql-test/r/bootstrap.result b/mysql-test/r/bootstrap.result
index bb80cf28b56..5cefc281996 100644
--- a/mysql-test/r/bootstrap.result
+++ b/mysql-test/r/bootstrap.result
@@ -3,7 +3,7 @@ drop table t1;
drop table t1;
ERROR 42S02: Unknown table 'test.t1'
set @my_max_allowed_packet= @@max_allowed_packet;
-set global max_allowed_packet=100*@@max_allowed_packet;
+set global max_allowed_packet=64*@@max_allowed_packet;
set global max_allowed_packet=@my_max_allowed_packet;
drop table t1;
End of 5.1 tests
diff --git a/mysql-test/r/bug12427262.result b/mysql-test/r/bug12427262.result
index c541ba0f664..8ec14efc45e 100644
--- a/mysql-test/r/bug12427262.result
+++ b/mysql-test/r/bug12427262.result
@@ -33,7 +33,7 @@ like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/fi
into @count_read_after;
select @count_read_after-@count_read_before;
@count_read_after-@count_read_before
-0.000000000000000000000000000000
+0.00000000000000000000000000000000000000
show full tables;
Tables_in_show_table_lw_db Table_type
t1 BASE TABLE
@@ -51,6 +51,6 @@ like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/fi
into @count_read_after;
select @count_read_after-@count_read_before;
@count_read_after-@count_read_before
-10.000000000000000000000000000000
+10.00000000000000000000000000000000000000
drop table t1;
drop database show_table_lw_db;
diff --git a/mysql-test/r/bug39022.result b/mysql-test/r/bug39022.result
index 75899ed686b..599808ca7d7 100644
--- a/mysql-test/r/bug39022.result
+++ b/mysql-test/r/bug39022.result
@@ -1,6 +1,7 @@
#
# Bug #39022: Mysql randomly crashing in lock_sec_rec_cons_read_sees
#
+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),
@@ -8,25 +9,30 @@ INSERT INTO t1 VALUES (13,0),(8,1),(9,2),(6,3),
(12,13),(7,14);
INSERT INTO t2 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
(11),(12),(13),(14);
-# in thread1
+connect thread1, localhost, root,,;
+connect thread2, localhost, root,,;
+connection thread1;
START TRANSACTION;
-# in thread2
+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;
d
-# in thread1
+connection thread1;
REPLACE INTO t1(a,b) VALUES (67,20);
-# in thread2
+connection thread2;
COMMIT;
START TRANSACTION;
REPLACE INTO t1(a,b) VALUES (65,-50);
REPLACE INTO t2 VALUES (-91);
SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE;
-# in thread1
+connection thread1;
# should not crash
SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
-# in thread2
+connection thread2;
d
-# in thread1;
+disconnect thread2;
+connection thread1;
+disconnect thread1;
+connection default;
DROP TABLE t1,t2;
diff --git a/mysql-test/r/bug46760.result b/mysql-test/r/bug46760.result
index 46b8c23b95c..f05d6c5ef99 100644
--- a/mysql-test/r/bug46760.result
+++ b/mysql-test/r/bug46760.result
@@ -18,7 +18,7 @@ info: Records: 0 Duplicates: 0 Warnings: 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) DEFAULT '10'
+ `a` int(11) DEFAULT 10
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
#
diff --git a/mysql-test/r/bug58669.result b/mysql-test/r/bug58669.result
index c9bd43e244b..a7d1d7b5581 100644
--- a/mysql-test/r/bug58669.result
+++ b/mysql-test/r/bug58669.result
@@ -5,6 +5,8 @@ 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();
CURRENT_USER()
user1@localhost
@@ -13,5 +15,7 @@ Variable_name Value
read_only ON
INSERT INTO db1.t1 VALUES (1);
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
+connection default;
+disconnect con1;
DROP DATABASE db1;
DROP USER user1@localhost;
diff --git a/mysql-test/r/cache_innodb.result b/mysql-test/r/cache_innodb.result
index 971750e3da2..18ae0ac8a83 100644
--- a/mysql-test/r/cache_innodb.result
+++ b/mysql-test/r/cache_innodb.result
@@ -131,9 +131,10 @@ select t1.* from t1, t2, t3 where t3.state & 1 = 0 and t3.t1_id = t1.id and t3.t
id a
1 me
drop table t3,t2,t1;
+connect connection1,localhost,root,,;
SET SESSION STORAGE_ENGINE = InnoDB;
SET @@autocommit=1;
-connection default
+connection default;
SHOW VARIABLES LIKE 'have_query_cache';
Variable_name Value
have_query_cache YES
@@ -155,7 +156,7 @@ count(*)
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
-connection connection1
+connection connection1;
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
@@ -171,7 +172,7 @@ count(*)
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
-connection default
+connection default;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
@@ -185,7 +186,7 @@ count(*)
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
-connection connection1
+connection connection1;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
@@ -197,7 +198,7 @@ INSERT INTO t2 VALUES (6,'w');
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
3
-connection default
+connection default;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
@@ -210,7 +211,7 @@ SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
COMMIT;
-connection connection1
+connection connection1;
COMMIT;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
@@ -221,6 +222,8 @@ Qcache_queries_in_cache 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 1
+disconnect connection1;
+connection default;
set @@global.query_cache_size = @save_query_cache_size;
drop table t2;
SET global query_cache_type=default;
diff --git a/mysql-test/r/cache_temporal_4265.result b/mysql-test/r/cache_temporal_4265.result
index 980bb957e19..7f215de43fb 100644
--- a/mysql-test/r/cache_temporal_4265.result
+++ b/mysql-test/r/cache_temporal_4265.result
@@ -7,7 +7,6 @@ a
2002-03-04
Warnings:
Note 1003 2000-01-01
-Note 1003 2000-01-06
set debug_dbug='';
drop table t1;
create table t1 (id int not null, ut timestamp(6) not null);
diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result
index 6fc1c9628b3..5a453ebe815 100644
--- a/mysql-test/r/case.result
+++ b/mysql-test/r/case.result
@@ -27,7 +27,7 @@ explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" E
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select (case 1 when 1 then 'one' when 2 then 'two' else 'more' end) AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END`
+Note 1003 select case 1 when 1 then 'one' when 2 then 'two' else 'more' end AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END`
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END;
CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END
two
@@ -40,15 +40,23 @@ 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;
case 1/0 when "a" then "true" else "false" END
false
+Warnings:
+Warning 1365 Division by 0
select case 1/0 when "a" then "true" END;
case 1/0 when "a" then "true" END
NULL
+Warnings:
+Warning 1365 Division by 0
select (case 1/0 when "a" then "true" END) | 0;
(case 1/0 when "a" then "true" END) | 0
NULL
+Warnings:
+Warning 1365 Division by 0
select (case 1/0 when "a" then "true" END) + 0.0;
(case 1/0 when "a" then "true" END) + 0.0
NULL
+Warnings:
+Warning 1365 Division by 0
select case when 1>0 then "TRUE" else "FALSE" END;
case when 1>0 then "TRUE" else "FALSE" END
TRUE
@@ -66,7 +74,7 @@ explain extended select case a when 1 then 2 when 2 then 3 else 0 end as fcase,
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort
Warnings:
-Note 1003 select (case `test`.`t1`.`a` when 1 then 2 when 2 then 3 else 0 end) AS `fcase`,count(0) AS `count(*)` from `test`.`t1` group by (case `test`.`t1`.`a` when 1 then 2 when 2 then 3 else 0 end)
+Note 1003 select case `test`.`t1`.`a` when 1 then 2 when 2 then 3 else 0 end AS `fcase`,count(0) AS `count(*)` from `test`.`t1` group by case `test`.`t1`.`a` when 1 then 2 when 2 then 3 else 0 end
select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase;
fcase count(*)
nothing 2
@@ -99,8 +107,8 @@ CASE WHEN 1 THEN 0.1e1 else '1' END AS c12
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL,
- `c2` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL,
+ `c1` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci DEFAULT NULL,
+ `c2` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci DEFAULT NULL,
`c3` varchar(1) NOT NULL,
`c4` varchar(1) NOT NULL,
`c5` varchar(4) NOT NULL,
@@ -147,7 +155,7 @@ COALESCE('a' COLLATE latin1_bin,'b');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce('a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,'1') AS `COALESCE(1,'1')`,coalesce(1.1,'1') AS `COALESCE(1.1,'1')`,coalesce(('a' collate latin1_bin),'b') AS `COALESCE('a' COLLATE latin1_bin,'b')`
+Note 1003 select coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce('a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,'1') AS `COALESCE(1,'1')`,coalesce(1.1,'1') AS `COALESCE(1.1,'1')`,coalesce('a' collate latin1_bin,'b') AS `COALESCE('a' COLLATE latin1_bin,'b')`
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -157,7 +165,7 @@ t1 CREATE TABLE `t1` (
`COALESCE(1,1.0)` decimal(2,1) NOT NULL,
`COALESCE(1,'1')` varchar(1) NOT NULL,
`COALESCE(1.1,'1')` varchar(4) NOT NULL,
- `COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL
+ `COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 SELECT IFNULL('a' COLLATE latin1_swedish_ci, 'b' COLLATE latin1_bin);
@@ -286,7 +294,7 @@ SELECT * FROM t1 WHERE CASE a WHEN 1 THEN 1 ELSE 0 END AND a='5';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '5') and (case `test`.`t1`.`a` when 1 then 1 else 0 end))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '5' and case `test`.`t1`.`a` when 1 then 1 else 0 end
DROP TABLE t1;
CREATE TABLE t1 (a ENUM('a','b','100'));
INSERT INTO t1 VALUES ('a'),('b'),('100');
@@ -305,7 +313,7 @@ SELECT * FROM t1 WHERE CASE a WHEN 'a' THEN 1 ELSE 0 END AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
SELECT * FROM t1 WHERE a=3;
a
100
@@ -323,7 +331,7 @@ SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a=3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((case `test`.`t1`.`a` when 3 then 1 else 0 end) and (`test`.`t1`.`a` = 3))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where case `test`.`t1`.`a` when 3 then 1 else 0 end and `test`.`t1`.`a` = 3
SELECT * FROM t1 WHERE a=3;
a
100
@@ -339,7 +347,7 @@ SELECT * FROM t1 WHERE CASE a WHEN '100' THEN 1 ELSE 0 END AND a=3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((case `test`.`t1`.`a` when '100' then 1 else 0 end) and (`test`.`t1`.`a` = 3))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where case `test`.`t1`.`a` when '100' then 1 else 0 end and `test`.`t1`.`a` = 3
SELECT * FROM t1 WHERE a='100';
a
100
@@ -355,7 +363,7 @@ SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a='100';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '100') and (case `test`.`t1`.`a` when 3 then 1 else 0 end))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '100' and case `test`.`t1`.`a` when 3 then 1 else 0 end
SELECT * FROM t1 WHERE a='100';
a
100
@@ -371,7 +379,7 @@ SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a='
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '100') and (case `test`.`t1`.`a` when 3 then 1 when '100' then 1 else 0 end))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '100' and case `test`.`t1`.`a` when 3 then 1 when '100' then 1 else 0 end
SELECT * FROM t1 WHERE a=3;
a
100
@@ -387,7 +395,7 @@ SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a=3
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((case `test`.`t1`.`a` when 3 then 1 when '100' then 1 else 0 end) and (`test`.`t1`.`a` = 3))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where case `test`.`t1`.`a` when 3 then 1 when '100' then 1 else 0 end and `test`.`t1`.`a` = 3
DROP TABLE t1;
#
# End of MDEV-8752
@@ -395,3 +403,37 @@ DROP TABLE t1;
#
# End of 10.1 test
#
+select case 'foo' when time'10:00:00' then 'never' when '0' then 'bug' else 'ok' end;
+case 'foo' when time'10:00:00' then 'never' when '0' then 'bug' else 'ok' end
+ok
+Warnings:
+Warning 1292 Truncated incorrect time value: 'foo'
+select 'foo' in (time'10:00:00','0');
+'foo' in (time'10:00:00','0')
+0
+Warnings:
+Warning 1292 Truncated incorrect time value: 'foo'
+create table t1 (a time);
+insert t1 values (100000), (102030), (203040);
+select case 'foo' when a then 'never' when '0' then 'bug' else 'ok' end from t1;
+case 'foo' when a then 'never' when '0' then 'bug' else 'ok' end
+ok
+ok
+ok
+Warnings:
+Warning 1292 Truncated incorrect time value: 'foo'
+Warning 1292 Truncated incorrect time value: 'foo'
+Warning 1292 Truncated incorrect time value: 'foo'
+select 'foo' in (a,'0') from t1;
+'foo' in (a,'0')
+0
+0
+0
+Warnings:
+Warning 1292 Truncated incorrect time value: 'foo'
+Warning 1292 Truncated incorrect time value: 'foo'
+Warning 1292 Truncated incorrect time value: 'foo'
+drop table t1;
+select case '20:10:05' when date'2020-10-10' then 'never' when time'20:10:5' then 'ok' else 'bug' end;
+case '20:10:05' when date'2020-10-10' then 'never' when time'20:10:5' then 'ok' else 'bug' end
+bug
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index ab784b5afc2..13ce2e53367 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -33,7 +33,7 @@ explain extended select ~5, cast(~5 as signed);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select ~(5) AS `~5`,cast(~(5) as signed) AS `cast(~5 as signed)`
+Note 1003 select ~5 AS `~5`,cast(~5 as signed) AS `cast(~5 as signed)`
select cast(18446744073709551615 as signed);
cast(18446744073709551615 as signed)
-1
@@ -43,6 +43,8 @@ cast(5 as unsigned) -6.0
select cast(NULL as signed), cast(1/0 as signed);
cast(NULL as signed) cast(1/0 as signed)
NULL NULL
+Warnings:
+Warning 1365 Division by 0
select cast(1 as double(5,2));
cast(1 as double(5,2))
1.00
@@ -160,6 +162,8 @@ cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time(6))
select cast(NULL as unsigned), cast(1/0 as unsigned);
cast(NULL as unsigned) cast(1/0 as unsigned)
NULL NULL
+Warnings:
+Warning 1365 Division by 0
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
cast("A" as binary) = "a" cast(BINARY "a" as CHAR) = "A"
0 1
@@ -382,17 +386,17 @@ cast('' as signed)
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
select cast(1 as double(5,6));
-ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '').
+ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '')
select cast(1 as decimal(5,6));
-ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '').
+ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '')
select cast(1 as double(66,6));
-ERROR 42000: Too big precision 66 specified for '1'. Maximum is 65.
+ERROR 42000: Too big precision 66 specified for '1'. Maximum is 65
select cast(1 as decimal(66,6));
-ERROR 42000: Too big precision 66 specified for '1'. Maximum is 65.
+ERROR 42000: Too big precision 66 specified for '1'. Maximum is 65
select cast(1 as decimal(64,63));
-ERROR 42000: Too big scale 63 specified for '1'. Maximum is 30.
+ERROR 42000: Too big scale 63 specified for '1'. Maximum is 38
select cast(1 as double(64,63));
-ERROR 42000: Too big scale 63 specified for '1'. Maximum is 30.
+ERROR 42000: Too big scale 63 specified for '1'. Maximum is 38
set names binary;
select cast(_latin1'test' as char character set latin2);
cast(_latin1'test' as char character set latin2)
@@ -404,7 +408,7 @@ create table t1 select cast(_koi8r'ÔÅÓÔ' as char character set cp1251) as t;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `t` varchar(4) CHARACTER SET cp1251 NOT NULL
+ `t` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select
@@ -423,6 +427,7 @@ cast(1000 as CHAR(3))
100
Warnings:
Warning 1292 Truncated incorrect BINARY(3) value: '1000'
+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,
@@ -456,6 +461,7 @@ c1 c2 c3 c4 c5
Warnings:
Warning 1292 Truncated incorrect CHAR(2) value: 'фгх'
Warning 1292 Truncated incorrect CHAR(2) value: 'Ñ„ '
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t1 select
cast(_koi8r'ÆÇ' AS nchar) as c1,
cast(_koi8r'Æ ' AS nchar) as c2,
@@ -586,8 +592,8 @@ t1 CREATE TABLE `t1` (
`cast(1 as signed)` int(2) NOT NULL,
`cast(1 as double(5,2))` double(5,2) DEFAULT NULL,
`cast(1 as decimal(5,3))` decimal(5,3) NOT NULL,
- `cast("A" as binary)` varbinary(1) NOT NULL,
- `cast("A" as char(100))` varbinary(100) NOT NULL,
+ `cast("A" as binary)` varbinary(1) DEFAULT NULL,
+ `cast("A" as char(100))` varbinary(100) DEFAULT NULL,
`cast("2001-1-1" as DATE)` date DEFAULT NULL,
`cast("2001-1-1" as DATETIME)` datetime DEFAULT NULL,
`cast("1:2:3" as TIME)` time DEFAULT NULL
@@ -601,8 +607,8 @@ double_val cast_val
-1e30 -9223372036854775808
1e30 9223372036854775807
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-1e30'
-Warning 1292 Truncated incorrect INTEGER value: '1e30'
+Warning 1916 Got overflow when converting '-1e30' to INT. Value truncated
+Warning 1916 Got overflow when converting '1e30' to INT. Value truncated
DROP TABLE t1;
select isnull(date(NULL)), isnull(cast(NULL as DATE));
isnull(date(NULL)) isnull(cast(NULL as DATE))
@@ -713,6 +719,7 @@ DROP TABLE t1;
SET @@GLOBAL.max_allowed_packet=2048;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+connect newconn, localhost, root,,;
SELECT CONVERT('a', BINARY(2049));
CONVERT('a', BINARY(2049))
a
@@ -728,6 +735,8 @@ length(CONVERT(repeat('a',2048), CHAR(2049)))
2048
Warnings:
Warning 1301 Result of cast_as_char() was larger than max_allowed_packet (2048) - truncated
+connection default;
+disconnect newconn;
SET @@GLOBAL.max_allowed_packet=default;
#
# Bug#13519724 63793: CRASH IN DTCOLLATION::SET(DTCOLLATION &SET)
@@ -743,6 +752,7 @@ DROP TABLE t1;
# LONGTEXT, UNION, USER VARIABLE
# Bug#14096619 UNABLE TO RESTORE DATABASE DUMP
#
+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));
Warnings:
@@ -801,7 +811,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
- `b` char(5) AS (cast("a" as char(10) binary) + a) VIRTUAL
+ `b` char(5) GENERATED ALWAYS AS (cast('a' as char(10) charset latin1) + `a`) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select collation(cast("a" as char(10) binary));
diff --git a/mysql-test/r/change_user.result b/mysql-test/r/change_user.result
index 1de97ed02e6..fa934fbf09a 100644
--- a/mysql-test/r/change_user.result
+++ b/mysql-test/r/change_user.result
@@ -90,3 +90,14 @@ NULL
FLUSH STATUS;
Value of com_select did not change
set global secure_auth=default;
+set timestamp=unix_timestamp('2010-10-10 10:10:10');
+select now();
+now()
+2010-10-10 10:10:10
+select year(now()) > 2011;
+year(now()) > 2011
+0
+change_user
+select year(now()) > 2011;
+year(now()) > 2011
+1
diff --git a/mysql-test/r/change_user_notembedded.result b/mysql-test/r/change_user_notembedded.result
index 896a6045481..41a154f8d3d 100644
--- a/mysql-test/r/change_user_notembedded.result
+++ b/mysql-test/r/change_user_notembedded.result
@@ -1,6 +1,10 @@
+connect test,localhost,root,,;
+connection test;
ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES)
ERROR 28000: Access denied for user 'foo'@'localhost' (using password: NO)
ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES)
ERROR 08S01: Unknown command
ERROR 08S01: Unknown command
+disconnect test;
+connection default;
that's all
diff --git a/mysql-test/r/check.result b/mysql-test/r/check.result
index 715fe032b53..341c4411298 100644
--- a/mysql-test/r/check.result
+++ b/mysql-test/r/check.result
@@ -1,14 +1,22 @@
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
drop table if exists t1,t2;
drop view if exists v1;
create table t1(n int not null, key(n), key(n), key(n), key(n));
Warnings:
-Note 1831 Duplicate index `n_2`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `n_3`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `n_4`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `n_2`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `n_3`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `n_4`. This is deprecated and will be disallowed in a future release
check table t1 extended;
+connection con2;
insert into t1 values (200000);
+connection con1;
Table Op Msg_type Msg_text
test.t1 check status OK
+connection default;
+disconnect con1;
+disconnect con2;
drop table t1;
Create table t1(f1 int);
Create table t2(f1 int);
@@ -34,12 +42,13 @@ DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT);
LOCK TABLE t1 WRITE;
-# Connection con1
+connect con1, localhost, root;
SET lock_wait_timeout= 1;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Error Lock wait timeout exceeded; try restarting transaction
test.t1 check status Operation failed
-# Connection default
+connection default;
UNLOCK TABLES;
DROP TABLE t1;
+disconnect con1;
diff --git a/mysql-test/r/check_constraint.result b/mysql-test/r/check_constraint.result
new file mode 100644
index 00000000000..70d64cd6ff7
--- /dev/null
+++ b/mysql-test/r/check_constraint.result
@@ -0,0 +1,158 @@
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL CHECK (`a` > 10),
+ `b` int(11) DEFAULT NULL CHECK (`b` > 20),
+ CONSTRAINT `min` CHECK (`a` + `b` > 100),
+ CONSTRAINT `max` CHECK (`a` + `b` < 500)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values (100,100);
+insert into t1 values (1,1);
+ERROR 23000: CONSTRAINT `a` failed for `test`.`t1`
+insert into t1 values (20,1);
+ERROR 23000: CONSTRAINT `b` failed for `test`.`t1`
+insert into t1 values (20,30);
+ERROR 23000: CONSTRAINT `min` failed for `test`.`t1`
+insert into t1 values (500,500);
+ERROR 23000: CONSTRAINT `max` failed for `test`.`t1`
+insert into t1 values (101,101),(102,102),(600,600),(103,103);
+ERROR 23000: CONSTRAINT `max` failed for `test`.`t1`
+select * from t1;
+a b
+100 100
+101 101
+102 102
+truncate table t1;
+insert ignore into t1 values (101,101),(102,102),(600,600),(103,103);
+Warnings:
+Warning 4025 CONSTRAINT `max` failed for `test`.`t1`
+select * from t1;
+a b
+101 101
+102 102
+103 103
+set check_constraint_checks=0;
+truncate table t1;
+insert into t1 values (101,101),(102,102),(600,600),(103,103);
+select * from t1;
+a b
+101 101
+102 102
+600 600
+103 103
+set check_constraint_checks=@save_check_constraint;
+alter table t1 add c int default 0 check (c < 10);
+ERROR 23000: CONSTRAINT `max` failed for table
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL CHECK (`a` > 10),
+ `b` int(11) DEFAULT NULL CHECK (`b` > 20),
+ `c` int(11) DEFAULT 0 CHECK (`c` < 10),
+ CONSTRAINT `min` CHECK (`a` + `b` > 100),
+ CONSTRAINT `max` CHECK (`a` + `b` < 500),
+ CONSTRAINT `CONSTRAINT_1` CHECK (`a` + `b` + `c` < 500)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values(105,105,105);
+ERROR 23000: CONSTRAINT `c` failed for `test`.`t1`
+insert into t1 values(249,249,9);
+ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
+insert into t1 values(105,105,9);
+select * from t1;
+a b c
+101 101 0
+102 102 0
+600 600 0
+103 103 0
+105 105 9
+create table t2 like t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL CHECK (`a` > 10),
+ `b` int(11) DEFAULT NULL CHECK (`b` > 20),
+ `c` int(11) DEFAULT 0 CHECK (`c` < 10),
+ CONSTRAINT `min` CHECK (`a` + `b` > 100),
+ CONSTRAINT `max` CHECK (`a` + `b` < 500),
+ CONSTRAINT `CONSTRAINT_1` CHECK (`a` + `b` + `c` < 500)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t2 drop constraint c;
+ERROR 42000: Can't DROP CONSTRAINT `c`; check that it exists
+alter table t2 drop constraint if exists c;
+Warnings:
+Note 1091 Can't DROP CONSTRAINT `c`; check that it exists
+alter table t2 drop constraint min;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL CHECK (`a` > 10),
+ `b` int(11) DEFAULT NULL CHECK (`b` > 20),
+ `c` int(11) DEFAULT 0 CHECK (`c` < 10),
+ CONSTRAINT `max` CHECK (`a` + `b` < 500),
+ CONSTRAINT `CONSTRAINT_1` CHECK (`a` + `b` + `c` < 500)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1,t2;
+create or replace table t1 (a int, b int, constraint check (a>b));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ CONSTRAINT `CONSTRAINT_1` CHECK (`a` > `b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 (a int, b int,
+constraint CONSTRAINT_1 check (a>1),
+constraint check (b>1));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ CONSTRAINT `CONSTRAINT_1` CHECK (`a` > 1),
+ CONSTRAINT `CONSTRAINT_2` CHECK (`b` > 1)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ CONSTRAINT `CONSTRAINT_1` CHECK (`a` > 1),
+ CONSTRAINT `CONSTRAINT_3` CHECK (`b` > 1),
+ CONSTRAINT `CONSTRAINT_2` CHECK (`a` > `b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1(c1 int, c2 int as (c1 + 1), check (c2 > 2));
+insert into t1(c1) values(1);
+ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
+insert into t1(c1) values(2);
+drop table t1;
+create or replace table t1( c1 int auto_increment primary key, check( c1 > 0 or c1 is null ) );
+ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the CHECK clause of `c1`
+create table t1 (a int check (@b in (select user from mysql.user)));
+ERROR HY000: Function or expression 'select ...' cannot be used in the CHECK clause of `a`
+create table t1 (a int check (a > @b));
+ERROR HY000: Function or expression '@b' cannot be used in the CHECK clause of `a`
+create table t1 (a int check (a = 1));
+insert t1 values (1);
+insert t1 values (2);
+ERROR 23000: CONSTRAINT `a` failed for `test`.`t1`
+insert t1 values (NULL);
+select * from t1;
+a
+1
+NULL
+drop table t1;
+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/r/check_constraint_show.result b/mysql-test/r/check_constraint_show.result
new file mode 100644
index 00000000000..def1c488758
--- /dev/null
+++ b/mysql-test/r/check_constraint_show.result
@@ -0,0 +1,17 @@
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL CHECK (`c1` > 0),
+ `c2` int(11) DEFAULT NULL CHECK (`c2` > 0),
+ `c3` int(11) DEFAULT NULL,
+ PRIMARY KEY (`c1`),
+ CONSTRAINT `range` CHECK (`c3` >= `c1` and `c3` <= `c2`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from information_schema.table_constraints where table_name = 't1';
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
+def test PRIMARY test t1 PRIMARY KEY
+def test c1 test t1 CHECK
+def test c2 test t1 CHECK
+def test range test t1 CHECK
+drop table t1;
diff --git a/mysql-test/r/client_xml.result b/mysql-test/r/client_xml.result
index 7f74a092af7..6f91c18318c 100644
--- a/mysql-test/r/client_xml.result
+++ b/mysql-test/r/client_xml.result
@@ -3,7 +3,7 @@ set @@global.concurrent_insert= 0;
drop table if exists t1;
create table t1 (
`a&b` int,
-`a<b` int,
+`a<b` int NOT NULL,
`a>b` text
);
insert into t1 values (1, 2, 'a&b a<b a>b');
@@ -21,9 +21,9 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="test">
<table_structure name="t1">
- <field Field="a&amp;b" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
- <field Field="a&lt;b" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
- <field Field="a&gt;b" Type="text" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="a&amp;b" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
+ <field Field="a&lt;b" Type="int(11)" Null="NO" Key="" Extra="" Comment="" />
+ <field Field="a&gt;b" Type="text" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
</table_structure>
<table_data name="t1">
<row>
diff --git a/mysql-test/r/comment_column.result b/mysql-test/r/comment_column.result
index 552a83da472..a270b30573f 100644
--- a/mysql-test/r/comment_column.result
+++ b/mysql-test/r/comment_column.result
@@ -236,6 +236,7 @@ t1 CREATE TABLE `t1` (
`c10` int(11) DEFAULT NULL COMMENT 'ABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd',
KEY `i2` (`c2`)
) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t1 ADD COLUMN c11 INTEGER COMMENT 'ABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
Warnings:
Warning 1629 Comment for field 'c11' is too long (max = 1024)
diff --git a/mysql-test/r/comment_column2.result b/mysql-test/r/comment_column2.result
index 6fa5d73b70a..99402e7f5b4 100644
--- a/mysql-test/r/comment_column2.result
+++ b/mysql-test/r/comment_column2.result
@@ -249,7 +249,7 @@ abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij
SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
comment index_comment char_length(index_comment)
ALTER TABLE t1 ADD COLUMN c64 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij';
-ERROR HY000: Too many columns
+ERROR HY000: Table definition is too large
SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
table_comment char_length(table_comment)
0
@@ -388,7 +388,7 @@ c63 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghi
c64 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
c65 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij')
;
-ERROR HY000: Too many columns
+ERROR HY000: Table definition is too large
SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
table_comment char_length(table_comment)
SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
diff --git a/mysql-test/r/comment_index.result b/mysql-test/r/comment_index.result
index 599bf563ca4..82412871377 100644
--- a/mysql-test/r/comment_index.result
+++ b/mysql-test/r/comment_index.result
@@ -265,6 +265,7 @@ t1 CREATE TABLE `t1` (
KEY `i10` (`c10`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd',
KEY `i1_3` (`c1`,`c2`,`c3`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'
) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE INDEX i11 ON t1(c11) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
Warnings:
Warning 1688 Comment for index 'i11' is too long (max = 1024)
@@ -317,6 +318,7 @@ t1 CREATE TABLE `t1` (
KEY `i1_3` (`c1`,`c2`,`c3`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd',
KEY `i11` (`c11`) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'
) ENGINE=ENGINE DEFAULT CHARSET=latin1 COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd'
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t1 ADD INDEX (c13) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
Warnings:
Warning 1688 Comment for index 'c13' is too long (max = 1024)
diff --git a/mysql-test/r/commit.result b/mysql-test/r/commit.result
index a62d2940d85..f2e012d4782 100644
--- a/mysql-test/r/commit.result
+++ b/mysql-test/r/commit.result
@@ -1,3 +1,4 @@
+connect con1,localhost,root,,;
#
# Bug#20837 Apparent change of isolation level
# during transaction
@@ -43,11 +44,11 @@ s1
2
-1
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
-connection con1
+connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1000);
COMMIT;
-connection default
+connection default;
We should not be able to read the '1000'
SELECT * FROM t1;
s1
@@ -65,23 +66,23 @@ s1
1000
COMMIT;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
-connection default
+connection default;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
-connection con1
+connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1001);
COMMIT;
-connection default
+connection default;
SELECT COUNT(*) FROM t1 WHERE s1 = 1001;
COUNT(*)
1
Should be 1
COMMIT AND CHAIN;
-connection con1
+connection con1;
INSERT INTO t1 VALUES (1002);
COMMIT;
-connection default
+connection default;
SELECT COUNT(*) FROM t1 WHERE s1 = 1002;
COUNT(*)
1
@@ -97,23 +98,23 @@ s1
1002
DELETE FROM t1 WHERE s1 >= 1000;
COMMIT;
-connection default
+connection default;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
-connection con1
+connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1001);
COMMIT;
-connection default
+connection default;
SELECT COUNT(*) FROM t1 WHERE s1 = 1001;
COUNT(*)
1
Should be 1
ROLLBACK AND CHAIN;
-connection con1
+connection con1;
INSERT INTO t1 VALUES (1002);
COMMIT;
-connection default
+connection default;
SELECT COUNT(*) FROM t1 WHERE s1 = 1002;
COUNT(*)
1
@@ -129,33 +130,33 @@ s1
DELETE FROM t1 WHERE s1 >= 1000;
COMMIT;
SET @@completion_type=1;
-connection default
+connection default;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
-connection con1
+connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1001);
COMMIT;
-connection default
+connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
Should see 1001
COMMIT AND NO CHAIN;
default transaction is now in REPEATABLE READ
-connection con1
+connection con1;
INSERT INTO t1 VALUES (1002);
COMMIT;
-connection default
+connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
1002
Should see 1001 and 1002
-connection con1
+connection con1;
INSERT INTO t1 VALUES (1003);
COMMIT;
-connection default
+connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
@@ -174,35 +175,35 @@ DELETE FROM t1 WHERE s1 >= 1000;
COMMIT AND NO CHAIN;
SET @@completion_type=0;
COMMIT;
-connection default
+connection default;
SET @@completion_type=1;
COMMIT AND NO CHAIN;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
-connection con1
+connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1001);
COMMIT;
-connection default
+connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
Should see 1001
ROLLBACK AND NO CHAIN;
default transaction is now in REPEATABLE READ
-connection con1
+connection con1;
INSERT INTO t1 VALUES (1002);
COMMIT;
-connection default
+connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
1002
Should see 1001 and 1002
-connection con1
+connection con1;
INSERT INTO t1 VALUES (1003);
COMMIT;
-connection default
+connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
@@ -221,7 +222,7 @@ DELETE FROM t1 WHERE s1 >= 1000;
COMMIT AND NO CHAIN;
SET @@completion_type=0;
COMMIT;
-connection default
+connection default;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
START TRANSACTION;
@@ -230,10 +231,10 @@ s1
1
2
-1
-connection con1
+connection con1;
INSERT INTO t1 VALUES (1000);
COMMIT;
-connection default
+connection default;
SELECT * FROM t1;
s1
1
@@ -253,10 +254,10 @@ SELECT * FROM t1;
s1
1000
Should read '1000'
-connection con1
+connection con1;
INSERT INTO t1 VALUES (1001);
COMMIT;
-connection default
+connection default;
SELECT * FROM t1;
s1
1000
@@ -266,6 +267,7 @@ SET @@completion_type=0;
COMMIT AND NO CHAIN;
SET @@autocommit=1;
COMMIT;
+disconnect con1;
DROP TABLE t1;
#
# End of test cases for Bug#20837
@@ -337,54 +339,54 @@ CREATE TEMPORARY TABLE temp_t2(a INT);
SET SESSION TRANSACTION READ ONLY;
# 1: DDL should be blocked, also on temporary tables.
CREATE TABLE t3(a INT);
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
ALTER TABLE t1 COMMENT "Test";
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
DROP TABLE t1;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
CREATE TEMPORARY TABLE temp_t3(a INT);
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
ALTER TABLE temp_t2 COMMENT "Test";
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
DROP TEMPORARY TABLE temp_t2;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
CREATE FUNCTION f1() RETURNS INT RETURN 1;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
DROP FUNCTION f1;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
CREATE PROCEDURE p1() BEGIN END;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
DROP PROCEDURE p1;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
CREATE VIEW v1 AS SELECT 1;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
SET SESSION TRANSACTION READ WRITE;
CREATE VIEW v1 AS SELECT 1;
SET SESSION TRANSACTION READ ONLY;
DROP VIEW v1;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
SET SESSION TRANSACTION READ WRITE;
DROP VIEW v1;
SET SESSION TRANSACTION READ ONLY;
RENAME TABLE t1 TO t2;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
RENAME TABLE temp_t2 TO temp_t3;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
TRUNCATE TABLE t1;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
CREATE DATABASE db1;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
DROP DATABASE db1;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
SET SESSION TRANSACTION READ WRITE;
# 2: DML should be blocked on non-temporary tables.
START TRANSACTION READ ONLY;
INSERT INTO t1 VALUES (1), (2);
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
UPDATE t1 SET a= 3;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
DELETE FROM t1;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
# 3: DML should be allowed on temporary tables.
INSERT INTO temp_t2 VALUES (1), (2);
UPDATE temp_t2 SET a= 3;
@@ -404,7 +406,7 @@ a
HANDLER temp_t2 CLOSE;
# 5: Prepared statements
PREPARE stmt FROM "DELETE FROM t1";
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
PREPARE stmt FROM "DELETE FROM temp_t2";
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
@@ -424,12 +426,12 @@ CREATE PROCEDURE p1() DELETE FROM t1;
CREATE PROCEDURE p2() DELETE FROM temp_t2;
START TRANSACTION READ ONLY;
SELECT f1();
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
SELECT f2();
f2()
1
CALL p1();
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
CALL p2();
COMMIT;
DROP FUNCTION f1;
@@ -440,7 +442,7 @@ DROP PROCEDURE p2;
CREATE VIEW v1 AS SELECT a FROM t1;
START TRANSACTION READ ONLY;
INSERT INTO v1 VALUES (1), (2);
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
SELECT * FROM v1;
a
COMMIT;
@@ -448,7 +450,7 @@ DROP VIEW v1;
# 8: LOCK TABLE
SET SESSION TRANSACTION READ ONLY;
LOCK TABLE t1 WRITE;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
LOCK TABLE t1 READ;
UNLOCK TABLES;
SET SESSION TRANSACTION READ WRITE;
@@ -459,7 +461,7 @@ CREATE TABLE t1(a INT);
SET SESSION TRANSACTION READ ONLY;
START TRANSACTION;
DELETE FROM t1;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
COMMIT;
START TRANSACTION READ WRITE;
DELETE FROM t1;
@@ -468,7 +470,7 @@ SET SESSION TRANSACTION READ WRITE;
SET TRANSACTION READ ONLY;
START TRANSACTION;
DELETE FROM t1;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
COMMIT;
START TRANSACTION READ WRITE;
DELETE FROM t1;
@@ -478,14 +480,14 @@ SELECT * FROM t1;
a
COMMIT AND CHAIN;
DELETE FROM t1;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
COMMIT;
START TRANSACTION READ ONLY;
SELECT * FROM t1;
a
ROLLBACK AND CHAIN;
DELETE FROM t1;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
COMMIT;
DROP TABLE t1;
#
@@ -510,11 +512,11 @@ CREATE TABLE t1(a INT);
SET TRANSACTION READ ONLY;
XA START 'test1';
INSERT INTO t1 VALUES (1);
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
UPDATE t1 SET a=2;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
DELETE FROM t1;
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
XA END 'test1';
XA PREPARE 'test1';
XA COMMIT 'test1';
diff --git a/mysql-test/r/commit_1innodb.result b/mysql-test/r/commit_1innodb.result
index 1e173221b15..1adba7b4c4c 100644
--- a/mysql-test/r/commit_1innodb.result
+++ b/mysql-test/r/commit_1innodb.result
@@ -264,7 +264,7 @@ rollback;
select * from t2;
a
insert into t2 (a) values (1026);
-load data infile "../../std_data/words.dat" into table t1 (a) set a:=f2(26);
+load data infile "../../std_data/words.dat" ignore into table t1 (a) set a:=f2(26);
ERROR 23000: Duplicate entry '26' for key 'a'
select * from t2;
a
@@ -419,11 +419,11 @@ SUCCESS
# 4. Read-write statement: UPDATE, update 0 rows, 1 row matches WHERE
#
update t1 set a=2;
-call p_verify_status_increment(2, 2, 1, 0);
+call p_verify_status_increment(2, 0, 1, 0);
SUCCESS
commit;
-call p_verify_status_increment(2, 2, 1, 0);
+call p_verify_status_increment(2, 0, 1, 0);
SUCCESS
# 5. Read-write statement: UPDATE, update 0 rows, 0 rows match WHERE
diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result
index a5654fb3160..ea8111cc3ce 100644
--- a/mysql-test/r/compare.result
+++ b/mysql-test/r/compare.result
@@ -64,7 +64,7 @@ EXPLAIN EXTENDED SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`b` = 1) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = '0101'))
+Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`b` = 1 and concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = '0101'
SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
b c
01 01
@@ -88,7 +88,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`a` AS `a`,<expr_cache><`test`.`t2`.`a`>((select count(0) from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat('0',`test`.`t2`.`a`,'01'))))) AS `x` from `test`.`t2` order by `test`.`t2`.`a`
+Note 1003 select `test`.`t2`.`a` AS `a`,<expr_cache><`test`.`t2`.`a`>((select count(0) from `test`.`t1` where `test`.`t1`.`b` = `test`.`t2`.`a` and concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat('0',`test`.`t2`.`a`,'01'))) AS `x` from `test`.`t2` order by `test`.`t2`.`a`
DROP TABLE t1,t2;
CREATE TABLE t1 (a TIMESTAMP);
INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW());
diff --git a/mysql-test/r/compound.result b/mysql-test/r/compound.result
index 1d412e671a4..49ad567a055 100644
--- a/mysql-test/r/compound.result
+++ b/mysql-test/r/compound.result
@@ -155,7 +155,7 @@ drop function fn|
drop table t1|
begin not atomic select @@sql_mode; end|
@@sql_mode
-NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
create table t1 (a int)|
select a from t1 having a > 1|
a
diff --git a/mysql-test/r/compress.result b/mysql-test/r/compress.result
index 83b50351ba9..762ab6630d8 100644
--- a/mysql-test/r/compress.result
+++ b/mysql-test/r/compress.result
@@ -1,3 +1,4 @@
+connect comp_con,localhost,root,,,,,COMPRESS;
SHOW STATUS LIKE 'Compression';
Variable_name Value
Compression ON
@@ -607,7 +608,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
+1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
1 SIMPLE t3 ref period period 4 test.t1.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
id select_type table type possible_keys key key_len ref rows Extra
@@ -1514,7 +1515,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
Warnings:
-Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> ''))
+Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> ''
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
@@ -2163,3 +2164,5 @@ drop table t1;
SHOW STATUS LIKE 'Compression';
Variable_name Value
Compression ON
+connection default;
+disconnect comp_con;
diff --git a/mysql-test/r/concurrent_innodb_safelog.result b/mysql-test/r/concurrent_innodb_safelog.result
index 03d20f40be3..27889777ac1 100644
--- a/mysql-test/r/concurrent_innodb_safelog.result
+++ b/mysql-test/r/concurrent_innodb_safelog.result
@@ -1,4 +1,5 @@
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+connection default;
SET SQL_MODE="";
SELECT @@global.tx_isolation;
@@global.tx_isolation
@@ -13,7 +14,8 @@ drop table if exists t1;
**
** two UPDATE's running and both changing distinct result sets
**
-** connection thread1
+connect thread1, localhost, mysqltest,,;
+connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@@ -32,13 +34,14 @@ insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
select get_lock("hello",10);
get_lock("hello",10)
1
-** connection thread2
+connect thread2, localhost, mysqltest,,;
+connection thread2;
** Start transaction for thread 2
begin;
** Update will cause a table scan and a new ULL will
** be created and blocked on the first row where tipo=11.
update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
-** connection thread1
+connection thread1;
** Start new transaction for thread 1
begin;
** Update on t1 will cause a table scan which will be blocked because
@@ -65,7 +68,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread2
+connection thread2;
** Release the lock and collect result from update on thread 2
DO release_lock("hello");
** Table should have eta updates where tipo=11 but updates made by
@@ -85,7 +88,7 @@ eta tipo c
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Sending commit on thread 2.
commit;
-** connection thread1
+connection thread1;
** Make sure table reads didn't change yet on thread 1.
select * from t1;
eta tipo c
@@ -117,7 +120,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread2
+connection thread2;
** Make sure the output is similar for t1.
select * from t1;
eta tipo c
@@ -132,7 +135,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread1
+connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -146,13 +149,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection default
+connection default;
drop table t1;
**
** two UPDATE's running and one changing result set
**
-** connection thread1
+connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@@ -171,14 +174,14 @@ insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
select get_lock("hello",10);
get_lock("hello",10)
1
-** connection thread2
+connection thread2;
** Start transaction on thread 2
begin;
** Update will cause a table scan.
** This will cause a hang on the first row where tipo=1 until the
** blocking ULL is released.
update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
-** connection thread1
+connection thread1;
** Start transaction on thread 1
begin;
** Update on t1 will cause a table scan which will be blocked because
@@ -204,7 +207,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread2
+connection thread2;
** Release the lock and collect result from thread 2:
DO release_lock("hello");
** Seen from thread 2 the table should have been updated on four
@@ -223,7 +226,7 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
-** connection thread1
+connection thread1;
** Thread 2 has committed but the result should remain the same for
** thread 1 (updated on three places):
select * from t1;
@@ -256,7 +259,7 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread2
+connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -270,7 +273,7 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread1
+connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -284,13 +287,13 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection default
+connection default;
drop table t1;
**
** One UPDATE and one INSERT .... Monty's test
**
-** connection thread1
+connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1 (a int not null, b int not null);
@@ -299,13 +302,13 @@ insert into t1 values (1,1),(2,1),(3,1),(4,1);
select get_lock("hello2",10);
get_lock("hello2",10)
1
-** connection thread2
+connection thread2;
** Begin a new transaction on thread 2
begin;
** Update will create a table scan which creates a ULL where a=2;
** this will hang waiting on thread 1.
update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
-** connection thread1
+connection thread1;
** Insert new values to t1 from thread 1; this created an implicit
** commit since there are no on-going transactions.
insert into t1 values (1,1);
@@ -319,7 +322,7 @@ a b
3 1
4 1
1 1
-** connection thread2
+connection thread2;
** Collect results from thread 2 and release the lock.
DO release_lock("hello2");
** The table should look like the original+updates for thread 2,
@@ -333,13 +336,13 @@ a b
1 1
** Commit changes from thread 2
commit;
-** connection default
+connection default;
drop table t1;
**
** one UPDATE changing result set and SELECT ... FOR UPDATE
**
-** connection thread1
+connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@@ -354,7 +357,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
-** connection thread2
+connection thread2;
** Begin a new transaction on thread 2
begin;
** Select a range for update.
@@ -363,7 +366,7 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
-** connection thread1
+connection thread1;
** Begin a new transaction on thread 1
begin;
** Update the same range which is marked for update on thread 2; this
@@ -385,7 +388,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread2
+connection thread2;
** The table should look unmodified from thread 2.
select * from t1;
eta tipo c
@@ -403,10 +406,10 @@ eta tipo c
** Sending a commit should release the row locks and enable
** thread 1 to complete the transaction.
commit;
-** connection thread1
+connection thread1;
** Commit on thread 1.
commit;
-** connection thread2
+connection thread2;
** The table should not have been changed.
select * from t1;
eta tipo c
@@ -421,7 +424,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread1
+connection thread1;
** Even on thread 1:
select * from t1;
eta tipo c
@@ -436,13 +439,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection default
+connection default;
drop table t1;
**
** one UPDATE not changing result set and SELECT ... FOR UPDATE
**
-** connection thread1
+connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@@ -457,7 +460,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
-** connection thread2
+connection thread2;
** Starting new transaction on thread 2.
begin;
** Starting SELECT .. FOR UPDATE
@@ -466,7 +469,7 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
-** connection thread1
+connection thread1;
** Starting new transaction on thread 1
begin;
@@ -492,7 +495,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread2
+connection thread2;
** The same thing should hold true for the transaction on
** thread 2
select * from t1;
@@ -509,9 +512,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
-** connection thread1
+connection thread1;
commit;
-** connection thread2
+connection thread2;
** Even after committing:
select * from t1;
eta tipo c
@@ -526,7 +529,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread1
+connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -540,13 +543,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection default
+connection default;
drop table t1;
**
** two SELECT ... FOR UPDATE
**
-** connection thread1
+connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@@ -561,7 +564,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
-** connection thread2
+connection thread2;
** Begin a new transaction on thread 2
begin;
select * from t1 where tipo=2 FOR UPDATE;
@@ -569,14 +572,14 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
-** connection thread1
+connection thread1;
** Begin a new transaction on thread 1
begin;
** Selecting a range for update by table scan will be blocked
** because of on-going transaction on thread 2.
select * from t1 where tipo=1 FOR UPDATE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-** connection thread2
+connection thread2;
** Table will be unchanged and the select command will not be
** blocked:
select * from t1;
@@ -594,10 +597,10 @@ eta tipo c
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Commit transacton on thread 2.
commit;
-** connection thread1
+connection thread1;
** Commit transaction on thread 1.
commit;
-** connection thread2
+connection thread2;
** Make sure table isn't blocked on thread 2:
select * from t1;
eta tipo c
@@ -612,7 +615,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread1
+connection thread1;
** Make sure table isn't blocked on thread 1:
select * from t1;
eta tipo c
@@ -627,13 +630,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection default
+connection default;
drop table t1;
**
** one UPDATE changing result set and DELETE
**
-** connection thread1
+connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@@ -648,10 +651,10 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
-** connection thread2
+connection thread2;
begin;
delete from t1 where tipo=2;
-** connection thread1
+connection thread1;
begin;
update t1 set tipo=1 where tipo=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@@ -668,7 +671,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread2
+connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -680,9 +683,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
-** connection thread1
+connection thread1;
commit;
-** connection thread2
+connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -693,7 +696,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread1
+connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -704,13 +707,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection default
+connection default;
drop table t1;
**
** one UPDATE not changing result set and DELETE
**
-** connection thread1
+connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@@ -725,10 +728,10 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
-** connection thread2
+connection thread2;
begin;
delete from t1 where tipo=2;
-** connection thread1
+connection thread1;
begin;
** Update on t1 will cause a table scan which will be blocked because
** the previously initiated table scan applied exclusive key locks on
@@ -750,7 +753,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread2
+connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -762,9 +765,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
-** connection thread1
+connection thread1;
commit;
-** connection thread2
+connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -775,7 +778,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread1
+connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -787,8 +790,11 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Cleanup
-** connection thread2
-** connection default
+connection thread1;
+disconnect thread1;
+connection thread2;
+disconnect thread2;
+connection default;
drop table t1;
drop user mysqltest@localhost;
SET SQL_MODE=default;
diff --git a/mysql-test/r/concurrent_innodb_unsafelog.result b/mysql-test/r/concurrent_innodb_unsafelog.result
index 4a140d9e610..39e757aeeb1 100644
--- a/mysql-test/r/concurrent_innodb_unsafelog.result
+++ b/mysql-test/r/concurrent_innodb_unsafelog.result
@@ -1,4 +1,5 @@
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+connection default;
SET SQL_MODE="";
SELECT @@global.tx_isolation;
@@global.tx_isolation
@@ -13,7 +14,8 @@ drop table if exists t1;
**
** two UPDATE's running and both changing distinct result sets
**
-** connection thread1
+connect thread1, localhost, mysqltest,,;
+connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@@ -32,13 +34,14 @@ insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
select get_lock("hello",10);
get_lock("hello",10)
1
-** connection thread2
+connect thread2, localhost, mysqltest,,;
+connection thread2;
** Start transaction for thread 2
begin;
** Update will cause a table scan and a new ULL will
** be created and blocked on the first row where tipo=11.
update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
-** connection thread1
+connection thread1;
** Start new transaction for thread 1
begin;
** Update on t1 will cause a table scan which will be blocked because
@@ -64,7 +67,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread2
+connection thread2;
** Release the lock and collect result from update on thread 2
DO release_lock("hello");
** Table should have eta updates where tipo=11 but updates made by
@@ -84,7 +87,7 @@ eta tipo c
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Sending commit on thread 2.
commit;
-** connection thread1
+connection thread1;
** Make sure table reads didn't change yet on thread 1.
select * from t1;
eta tipo c
@@ -116,7 +119,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread2
+connection thread2;
** Make sure the output is similar for t1.
select * from t1;
eta tipo c
@@ -131,7 +134,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread1
+connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -145,13 +148,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection default
+connection default;
drop table t1;
**
** two UPDATE's running and one changing result set
**
-** connection thread1
+connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@@ -170,14 +173,14 @@ insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
select get_lock("hello",10);
get_lock("hello",10)
1
-** connection thread2
+connection thread2;
** Start transaction on thread 2
begin;
** Update will cause a table scan.
** This will cause a hang on the first row where tipo=1 until the
** blocking ULL is released.
update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
-** connection thread1
+connection thread1;
** Start transaction on thread 1
begin;
** Update on t1 will cause a table scan which will be blocked because
@@ -202,7 +205,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread2
+connection thread2;
** Release the lock and collect result from thread 2:
DO release_lock("hello");
** Seen from thread 2 the table should have been updated on four
@@ -221,7 +224,7 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
-** connection thread1
+connection thread1;
** Thread 2 has committed but the result should remain the same for
** thread 1 (updated on three places):
select * from t1;
@@ -254,7 +257,7 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread2
+connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -268,7 +271,7 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread1
+connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -282,13 +285,13 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection default
+connection default;
drop table t1;
**
** One UPDATE and one INSERT .... Monty's test
**
-** connection thread1
+connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1 (a int not null, b int not null);
@@ -297,13 +300,13 @@ insert into t1 values (1,1),(2,1),(3,1),(4,1);
select get_lock("hello2",10);
get_lock("hello2",10)
1
-** connection thread2
+connection thread2;
** Begin a new transaction on thread 2
begin;
** Update will create a table scan which creates a ULL where a=2;
** this will hang waiting on thread 1.
update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
-** connection thread1
+connection thread1;
** Insert new values to t1 from thread 1; this created an implicit
** commit since there are no on-going transactions.
insert into t1 values (1,1);
@@ -317,7 +320,7 @@ a b
3 1
4 1
1 1
-** connection thread2
+connection thread2;
** Collect results from thread 2 and release the lock.
DO release_lock("hello2");
** The table should look like the original+updates for thread 2,
@@ -331,13 +334,13 @@ a b
1 1
** Commit changes from thread 2
commit;
-** connection default
+connection default;
drop table t1;
**
** one UPDATE changing result set and SELECT ... FOR UPDATE
**
-** connection thread1
+connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@@ -352,7 +355,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
-** connection thread2
+connection thread2;
** Begin a new transaction on thread 2
begin;
** Select a range for update.
@@ -361,7 +364,7 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
-** connection thread1
+connection thread1;
** Begin a new transaction on thread 1
begin;
** Update the same range which is marked for update on thread 2; this
@@ -383,7 +386,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread2
+connection thread2;
** The table should look unmodified from thread 2.
select * from t1;
eta tipo c
@@ -401,10 +404,10 @@ eta tipo c
** Sending a commit should release the row locks and enable
** thread 1 to complete the transaction.
commit;
-** connection thread1
+connection thread1;
** Commit on thread 1.
commit;
-** connection thread2
+connection thread2;
** The table should not have been changed.
select * from t1;
eta tipo c
@@ -419,7 +422,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread1
+connection thread1;
** Even on thread 1:
select * from t1;
eta tipo c
@@ -434,13 +437,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection default
+connection default;
drop table t1;
**
** one UPDATE not changing result set and SELECT ... FOR UPDATE
**
-** connection thread1
+connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@@ -455,7 +458,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
-** connection thread2
+connection thread2;
** Starting new transaction on thread 2.
begin;
** Starting SELECT .. FOR UPDATE
@@ -464,7 +467,7 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
-** connection thread1
+connection thread1;
** Starting new transaction on thread 1
begin;
@@ -489,7 +492,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread2
+connection thread2;
** The same thing should hold true for the transaction on
** thread 2
select * from t1;
@@ -506,9 +509,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
-** connection thread1
+connection thread1;
commit;
-** connection thread2
+connection thread2;
** Even after committing:
select * from t1;
eta tipo c
@@ -523,7 +526,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread1
+connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -537,13 +540,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection default
+connection default;
drop table t1;
**
** two SELECT ... FOR UPDATE
**
-** connection thread1
+connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@@ -558,7 +561,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
-** connection thread2
+connection thread2;
** Begin a new transaction on thread 2
begin;
select * from t1 where tipo=2 FOR UPDATE;
@@ -566,14 +569,14 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
-** connection thread1
+connection thread1;
** Begin a new transaction on thread 1
begin;
** Selecting a range for update by table scan will be blocked
** because of on-going transaction on thread 2.
select * from t1 where tipo=1 FOR UPDATE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-** connection thread2
+connection thread2;
** Table will be unchanged and the select command will not be
** blocked:
select * from t1;
@@ -591,10 +594,10 @@ eta tipo c
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Commit transacton on thread 2.
commit;
-** connection thread1
+connection thread1;
** Commit transaction on thread 1.
commit;
-** connection thread2
+connection thread2;
** Make sure table isn't blocked on thread 2:
select * from t1;
eta tipo c
@@ -609,7 +612,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread1
+connection thread1;
** Make sure table isn't blocked on thread 1:
select * from t1;
eta tipo c
@@ -624,13 +627,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection default
+connection default;
drop table t1;
**
** one UPDATE changing result set and DELETE
**
-** connection thread1
+connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@@ -645,10 +648,10 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
-** connection thread2
+connection thread2;
begin;
delete from t1 where tipo=2;
-** connection thread1
+connection thread1;
begin;
update t1 set tipo=1 where tipo=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@@ -665,7 +668,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread2
+connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -677,9 +680,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
-** connection thread1
+connection thread1;
commit;
-** connection thread2
+connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -690,7 +693,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread1
+connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -701,13 +704,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection default
+connection default;
drop table t1;
**
** one UPDATE not changing result set and DELETE
**
-** connection thread1
+connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@@ -722,10 +725,10 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
-** connection thread2
+connection thread2;
begin;
delete from t1 where tipo=2;
-** connection thread1
+connection thread1;
begin;
** Update on t1 will cause a table scan which will be blocked because
** the previously initiated table scan applied exclusive key locks on
@@ -746,7 +749,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread2
+connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -758,9 +761,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
-** connection thread1
+connection thread1;
commit;
-** connection thread2
+connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -771,7 +774,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
-** connection thread1
+connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -783,8 +786,11 @@ eta tipo c
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Cleanup
-** connection thread2
-** connection default
+connection thread1;
+disconnect thread1;
+connection thread2;
+disconnect thread2;
+connection default;
drop table t1;
drop user mysqltest@localhost;
SET SQL_MODE=default;
diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result
index cb66ff483e1..20a01c6f78e 100644
--- a/mysql-test/r/connect.result
+++ b/mysql-test/r/connect.result
@@ -1,5 +1,6 @@
SET global secure_auth=0;
drop table if exists t1,t2;
+connect con1,localhost,root,,mysql;
show tables;
Tables_in_mysql
column_stats
@@ -32,14 +33,21 @@ time_zone_name
time_zone_transition
time_zone_transition_type
user
+connect con2,localhost,root,,test;
show tables;
Tables_in_test
connect(localhost,root,z,test2,MASTER_PORT,MASTER_SOCKET);
+connect fail_con,localhost,root,z,test2;
ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
connect(localhost,root,z,test,MASTER_PORT,MASTER_SOCKET);
+connect fail_con,localhost,root,z,;
ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
+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";
+connect con3,localhost,test,gambling,mysql;
show tables;
Tables_in_mysql
column_stats
@@ -72,18 +80,29 @@ time_zone_name
time_zone_transition
time_zone_transition_type
user
+connect con4,localhost,test,gambling,test;
show tables;
Tables_in_test
+connection default;
+disconnect con3;
+disconnect con4;
connect(localhost,test,,test2,MASTER_PORT,MASTER_SOCKET);
+connect fail_con,localhost,test,,test2;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,,"",MASTER_PORT,MASTER_SOCKET);
+connect fail_con,localhost,test,,'""';
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,zorro,test2,MASTER_PORT,MASTER_SOCKET);
+connect fail_con,localhost,test,zorro,test2;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET);
+connect fail_con,localhost,test,zorro,;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
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="";
set password='gambling3';
ERROR HY000: Password hash should be a 41-digit hexadecimal number
@@ -120,22 +139,35 @@ time_zone_name
time_zone_transition
time_zone_transition_type
user
+connect con6,localhost,test,gambling3,test;
show tables;
Tables_in_test
+connection default;
+disconnect con10;
+disconnect con5;
+disconnect con6;
connect(localhost,test,,test2,MASTER_PORT,MASTER_SOCKET);
+connect fail_con,localhost,test,,test2;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,,test,MASTER_PORT,MASTER_SOCKET);
+connect fail_con,localhost,test,,;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,zorro,test2,MASTER_PORT,MASTER_SOCKET);
+connect fail_con,localhost,test,zorro,test2;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET);
+connect fail_con,localhost,test,zorro,;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
delete from mysql.user where user=_binary"test";
flush privileges;
+connect con7,localhost,root,,test;
+connection con7;
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;
drop table t1;
# ------------------------------------------------------------------
# -- End of 4.1 tests
@@ -149,10 +181,19 @@ GRANT USAGE ON *.* TO mysqltest_u1@localhost;
SET GLOBAL max_connections = 10;
SET GLOBAL event_scheduler = ON;
+connect tmp_con1,localhost,mysqltest_u1,,;
+connect tmp_con2,localhost,mysqltest_u1,,;
+connect tmp_con3,localhost,mysqltest_u1,,;
+connect tmp_con4,localhost,mysqltest_u1,,;
+connect tmp_con5,localhost,mysqltest_u1,,;
+connect tmp_con6,localhost,mysqltest_u1,,;
+connect tmp_con7,localhost,mysqltest_u1,,;
+connection default;
# -- Waiting for Event Scheduler to start...
# -- Disconnecting default connection...
+disconnect default;
# -- Check that we allow exactly three user connections, no matter how
# -- many threads are running.
@@ -209,8 +250,20 @@ SET GLOBAL event_scheduler = OFF;
# -- Waiting for Event Scheduler to stop...
# -- That's it. Closing connections...
+disconnect con_1;
+disconnect con_2;
+disconnect con_3;
+disconnect con_super_1;
+disconnect tmp_con1;
+disconnect tmp_con2;
+disconnect tmp_con3;
+disconnect tmp_con4;
+disconnect tmp_con5;
+disconnect tmp_con6;
+disconnect tmp_con7;
# -- Restoring default connection...
+connect default,localhost,root,,test;
# -- Waiting for connections to close...
@@ -231,6 +284,7 @@ SET GLOBAL event_scheduler = ON;
# -- Waiting for Event Scheduler to start...
# -- Opening a new connection to check max_used_connections...
+connect con_1,localhost,root;
# -- Check that max_used_connections hasn't changed.
SHOW STATUS LIKE 'max_used_connections';
@@ -238,6 +292,8 @@ Variable_name Value
Max_used_connections 2
# -- Closing new connection...
+disconnect con_1;
+connection default;
# -- Stopping Event Scheduler...
SET GLOBAL event_scheduler = OFF;
@@ -245,9 +301,13 @@ SET GLOBAL event_scheduler = OFF;
# -- End of Bug#35074.
+connect extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,;
+connection extracon;
SELECT 'Connection on extra port ok';
Connection on extra port ok
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';
Connection on extra port 2 ok
Connection on extra port 2 ok
@@ -258,6 +318,9 @@ Connection on extra port 2 ok
#
GRANT ALL ON test.* TO 'O1234567890123456789012345678901234567890123456789012345678901234567890123456789'@'localhost' IDENTIFIED BY 'test123';
FLUSH PRIVILEGES;
+connect con1,localhost,O1234567890123456789012345678901234567890123456789012345678901234567890123456789x,test123,test;
+disconnect con1;
+connection default;
DROP USER 'O1234567890123456789012345678901234567890123456789012345678901234567890123456789'@'localhost';
FLUSH PRIVILEGES;
#
@@ -266,22 +329,36 @@ FLUSH PRIVILEGES;
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------
+disconnect extracon;
+disconnect extracon2;
+connection default;
CREATE USER mysqltest_up1 IDENTIFIED VIA mysql_native_password using '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB';
CREATE USER mysqltest_up2 IDENTIFIED VIA mysql_old_password using '09301740536db389';
connect(localhost,mysqltest_up1,foo,test,MASTER_PORT,MASTER_SOCKET);
+connect pcon1,localhost,mysqltest_up1,foo,,$MASTER_MYPORT,;
ERROR 28000: Access denied for user 'mysqltest_up1'@'localhost' (using password: YES)
+connect pcon2,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,;
+connection pcon2;
select user(), current_user();
user() current_user()
mysqltest_up1@localhost mysqltest_up1@%
+disconnect pcon2;
connect(localhost,mysqltest_up2,newpw,test,MASTER_PORT,MASTER_SOCKET);
+connect pcon3,localhost,mysqltest_up2,newpw,,$MASTER_MYPORT,;
ERROR 28000: Access denied for user 'mysqltest_up2'@'localhost' (using password: YES)
+connect pcon4,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,;
+connection pcon4;
select user(), current_user();
user() current_user()
mysqltest_up2@localhost mysqltest_up2@%
+disconnect pcon4;
connect(localhost,mysqltest_nouser,newpw,test,MASTER_PORT,MASTER_SOCKET);
+connect pcon5,localhost,mysqltest_nouser,newpw,,$MASTER_MYPORT,;
ERROR 28000: Access denied for user 'mysqltest_nouser'@'localhost' (using password: YES)
connect(localhost,mysqltest_nouser,,test,MASTER_PORT,MASTER_SOCKET);
+connect pcon5,localhost,mysqltest_nouser,,,$MASTER_MYPORT,;
ERROR 28000: Access denied for user 'mysqltest_nouser'@'localhost' (using password: NO)
+connection default;
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
@@ -290,12 +367,19 @@ user password plugin authentication_string
mysqltest_up1 *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB mysql_native_password
mysqltest_up2 09301740536db389 mysql_old_password
flush privileges;
+connect pcon6,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,;
+connection pcon6;
select user(), current_user();
user() current_user()
mysqltest_up1@localhost mysqltest_up1@%
+disconnect pcon6;
+connect pcon7,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,;
+connection pcon7;
select user(), current_user();
user() current_user()
mysqltest_up2@localhost mysqltest_up2@%
+disconnect pcon7;
+connection default;
DROP USER mysqltest_up1@'%';
DROP USER mysqltest_up2@'%';
#
diff --git a/mysql-test/r/connect2.result b/mysql-test/r/connect2.result
new file mode 100644
index 00000000000..5430626a533
--- /dev/null
+++ b/mysql-test/r/connect2.result
@@ -0,0 +1,73 @@
+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;
+connect con1,localhost,root,,test,,;
+select 1;
+1
+1
+disconnect con1;
+connection default;
+set global debug_dbug='+d,simulate_failed_connection_1';
+connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
+connect con1,localhost,root,,test,,;
+Got one of the listed errors
+connection default;
+set global debug_dbug=@old_debug;
+set global debug_dbug='+d,simulate_failed_connection_2';
+connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
+connect con1,localhost,root,,test,,;
+Got one of the listed errors
+connection default;
+set global debug_dbug=@old_debug;
+connect con1,localhost,root,,test,,;
+select 1;
+1
+1
+disconnect con1;
+connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
+select 1;
+1
+1
+disconnect con1;
+connection default;
+set global debug_dbug='+d,simulate_failed_connection_1';
+connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
+connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
+Got one of the listed errors
+connection default;
+set global debug_dbug=@old_debug;
+set global debug_dbug='+d,simulate_failed_connection_2';
+connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
+connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
+Got one of the listed errors
+connection default;
+set global debug_dbug=@old_debug;
+connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
+select 1;
+1
+1
+disconnect con1;
+connection default;
+set @@global.thread_cache_size=2;
+connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
+select 1;
+1
+1
+connect con2,localhost,root,,test,$MASTER_EXTRA_PORT,;
+select 1;
+1
+1
+disconnect con1;
+disconnect con2;
+connection default;
+set global debug_dbug='+d,simulate_failed_connection_2';
+connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
+connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
+Got one of the listed errors
+connection default;
+show status like "Threads_connected";
+Variable_name Value
+Threads_connected 1
+set global debug_dbug=@old_debug;
+set global thread_cache_size=@old_thread_cache_size;
diff --git a/mysql-test/r/consistent_snapshot.result b/mysql-test/r/consistent_snapshot.result
index 3a0227b1a1a..b978f1dd9d2 100644
--- a/mysql-test/r/consistent_snapshot.result
+++ b/mysql-test/r/consistent_snapshot.result
@@ -1,15 +1,15 @@
DROP TABLE IF EXISTS t1;
-# Establish connection con1 (user=root)
-# Establish connection con2 (user=root)
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
### Test 1:
### - While a consistent snapshot transaction is executed,
### no external inserts should be visible to the transaction.
-# Switch to connection con1
+connection con1;
CREATE TABLE t1 (a INT) ENGINE=innodb;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
-# Switch to connection con2
+connection con2;
INSERT INTO t1 VALUES(1);
-# Switch to connection con1
+connection con1;
SELECT * FROM t1;
a
COMMIT;
@@ -18,9 +18,9 @@ COMMIT;
### committed inserts should be visible to the transaction.
DELETE FROM t1;
START TRANSACTION;
-# Switch to connection con2
+connection con2;
INSERT INTO t1 VALUES(1);
-# Switch to connection con1
+connection con1;
SELECT * FROM t1;
a
1
@@ -31,12 +31,14 @@ COMMIT;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
DELETE FROM t1;
COMMIT WORK AND CHAIN;
-# Switch to connection con2
+connection con2;
INSERT INTO t1 VALUES(1);
-# Switch to connection con1
+connection con1;
SELECT * FROM t1;
a
1
COMMIT;
-# Switch to connection default + close connections con1 and con2
+connection default;
+disconnect con1;
+disconnect con2;
DROP TABLE t1;
diff --git a/mysql-test/r/constraints.result b/mysql-test/r/constraints.result
index 891f12915cb..fe9398ea8ce 100644
--- a/mysql-test/r/constraints.result
+++ b/mysql-test/r/constraints.result
@@ -1,27 +1,54 @@
drop table if exists t1;
create table t1 (a int check (a>0));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL CHECK (`a` > 0)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (1);
insert into t1 values (0);
+ERROR 23000: CONSTRAINT `a` failed for `test`.`t1`
drop table t1;
create table t1 (a int, b int, check (a>b));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ CONSTRAINT `CONSTRAINT_1` CHECK (`a` > `b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (1,0);
insert into t1 values (0,1);
+ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
drop table t1;
create table t1 (a int ,b int, constraint abc check (a>b));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ CONSTRAINT `abc` CHECK (`a` > `b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (1,0);
insert into t1 values (0,1);
+ERROR 23000: CONSTRAINT `abc` failed for `test`.`t1`
drop table t1;
create table t1 (a int null);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
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);
Warnings:
-Note 1831 Duplicate index `key_1`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `key_1`. This is deprecated and will be disallowed in a future release
alter table t1 add constraint constraint_2 unique key_2(a);
Warnings:
-Note 1831 Duplicate index `key_2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `key_2`. This is deprecated and will be disallowed in a future release
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/r/create-big.result b/mysql-test/r/create-big.result
index bb8c62bb25c..d041419443e 100644
--- a/mysql-test/r/create-big.result
+++ b/mysql-test/r/create-big.result
@@ -1,11 +1,20 @@
+connect addconroot1, localhost, root,,;
+connect addconroot2, localhost, root,,;
+connect addconroot3, localhost, root,,;
+connection default;
drop table if exists t1,t2,t3,t4,t5;
set debug_sync='RESET';
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create table t1 (j char(5));;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
ERROR 42S01: Table 't1' already exists
+connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -14,10 +23,15 @@ t1 CREATE TABLE `t1` (
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create table t1 select 'Test' as j;;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
ERROR 42S01: Table 't1' already exists
+connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -27,10 +41,15 @@ drop table t1;
create table t3 (j char(5));
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create table t1 like t3;;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
ERROR 42S01: Table 't1' already exists
+connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -39,10 +58,15 @@ t1 CREATE TABLE `t1` (
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
rename table t3 to t1;;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
ERROR 42S01: Table 't1' already exists
+connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -51,10 +75,15 @@ t1 CREATE TABLE `t1` (
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
alter table t3 rename to t1;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
ERROR 42S01: Table 't1' already exists
+connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -63,10 +92,15 @@ t1 CREATE TABLE `t1` (
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
alter table t3 rename to t1, add k int;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
ERROR 42S01: Table 't1' already exists
+connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -74,30 +108,51 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t3;
set debug_sync='create_table_select_before_open SIGNAL parked WAIT_FOR go';
+connection default;
set debug_sync='create_table_select_before_open SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
drop table t1;;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
+connection default;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
rename table t1 to t2;;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
+connection default;
drop table t2;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
select * from t1;;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
i
1
+connection default;
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
insert into t1 values (2);;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
+connection default;
select * from t1;
i
1
@@ -106,37 +161,62 @@ drop table t1;
set @a:=0;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create trigger t1_bi before insert on t1 for each row set @a:=1;;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
+connection default;
select @a;
@a
0
drop table t1;
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
drop table t1;;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
+connection default;
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
rename table t1 to t2;;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
+connection default;
drop table t2;
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
select * from t1;;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
i
1
+connection default;
drop table t1;
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
insert into t1 values (2);;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
+connection default;
select * from t1;
i
1
@@ -145,27 +225,42 @@ drop table t1;
set @a:=0;
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create trigger t1_bi before insert on t1 for each row set @a:=1;;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
+connection default;
select @a;
@a
0
drop table t1;
set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go';
create table if not exists t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
drop table t1;;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
+connection default;
create table t1 (i int);
set @a:=0;
set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go';
create table if not exists t1 select 1 as i;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create trigger t1_bi before insert on t1 for each row set @a:=1;;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
Warnings:
Note 1050 Table 't1' already exists
+connection addconroot1;
+connection default;
select @a;
@a
0
@@ -178,10 +273,15 @@ create table t1 (i int);
set debug_sync='create_table_like_after_open SIGNAL parked WAIT_FOR go';
reset master;
create table t2 like t1;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
insert into t1 values (1);
drop table t1;;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
+connection default;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -203,21 +303,39 @@ create table t1 (i int);
set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go';
reset master;
create table t2 like t1;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
insert into t2 values (1);;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
+connection default;
drop table t2;
set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go';
create table t2 like t1;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
drop table t2;;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
+connection default;
set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go';
create table t2 like t1;;
+connection addconroot1;
set debug_sync='now WAIT_FOR parked';
drop table t1;;
+connection addconroot2;
set debug_sync='now SIGNAL go';
+connection default;
+connection addconroot1;
+connection default;
drop table t2;
+disconnect addconroot1;
+disconnect addconroot2;
+disconnect addconroot3;
set debug_sync='RESET';
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
diff --git a/mysql-test/r/create-uca.result b/mysql-test/r/create-uca.result
index 2d2522a36a3..f405cb72b40 100644
--- a/mysql-test/r/create-uca.result
+++ b/mysql-test/r/create-uca.result
@@ -10,7 +10,7 @@ COLLATE latin1_bin;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` int(11) DEFAULT '12' COMMENT 'column1',
+ `c1` int(11) DEFAULT 12 COMMENT 'column1',
`c2` int(11) DEFAULT NULL COMMENT 'column2',
`c3` int(11) NOT NULL COMMENT 'column3',
`c4` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a',
@@ -21,7 +21,7 @@ CREATE TABLE t2 AS SELECT * FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `c1` int(11) DEFAULT '12' COMMENT 'column1',
+ `c1` int(11) DEFAULT 12 COMMENT 'column1',
`c2` int(11) DEFAULT NULL COMMENT 'column2',
`c3` int(11) NOT NULL COMMENT 'column3',
`c4` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a',
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 4ac8a0e249f..2159127c070 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -70,6 +70,7 @@ insert into t1 values();
select * from t1;
a
abcde
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 alter column a set default 'abcdef';
ERROR 42000: Invalid default value for 'a'
drop table t1;
@@ -181,36 +182,36 @@ Warnings:
Note 1051 Unknown table 'test.t2'
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));
Warnings:
-Note 1831 Duplicate index `b_2`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_3`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_4`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_5`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_6`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_7`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_8`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_9`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_10`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_11`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_12`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_13`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_14`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_15`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_16`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_17`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_18`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_19`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_20`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_21`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_22`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_23`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_24`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_25`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_26`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_27`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_28`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_29`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_30`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_31`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `b_2`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_3`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_4`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_5`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_6`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_7`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_8`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_9`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_10`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_11`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_12`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_13`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_14`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_15`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_16`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_17`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_18`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_19`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_20`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_21`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_22`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_23`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_24`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_25`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_26`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_27`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_28`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_29`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_30`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_31`. This is deprecated and will be disallowed in a future release
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -484,10 +485,10 @@ a int(11) YES NULL
b bigint(11) NO NULL
c bigint(10) unsigned NO NULL
d date YES NULL
-e varchar(1) NO NULL
+e varchar(1) YES NULL
f datetime YES NULL
g time YES NULL
-h longblob NO NULL
+h longblob YES NULL
dd time YES NULL
select * from t2;
a b c d e f g h dd
@@ -544,10 +545,12 @@ name varchar(10) YES NULL
age smallint(6) YES -1
drop table t1, t2;
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'));
Warnings:
Note 1291 Column 'cenum' has duplicated value 'a' in ENUM
Note 1291 Column 'cset' has duplicated value 'b' in SET
+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'));
Warnings:
Note 1291 Column 'cenum' has duplicated value 'a' in ENUM
@@ -567,9 +570,13 @@ select database();
database()
NULL
create user mysqltest_1;
+connect user1,localhost,mysqltest_1,,*NO-ONE*;
+connection user1;
select database(), user();
database() user()
NULL mysqltest_1@localhost
+connection default;
+disconnect user1;
drop user mysqltest_1;
use test;
create table t1 (a int, index `primary` (a));
@@ -716,6 +723,7 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+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)
@@ -799,8 +807,8 @@ select a1,a2 from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT '3',
- `b` int(11) DEFAULT '3',
+ `a` int(11) DEFAULT 3,
+ `b` int(11) DEFAULT 3,
`a1` int(11) DEFAULT NULL,
`a2` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -1130,46 +1138,46 @@ create table t1 like information_schema.processlist;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ID` bigint(4) NOT NULL DEFAULT '0',
+ `ID` bigint(4) NOT NULL DEFAULT 0,
`USER` varchar(128) NOT NULL DEFAULT '',
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
- `TIME` int(7) NOT NULL DEFAULT '0',
+ `TIME` int(7) NOT NULL DEFAULT 0,
`STATE` varchar(64) DEFAULT NULL,
- `INFO` longtext,
- `TIME_MS` decimal(22,3) NOT NULL DEFAULT '0.000',
- `STAGE` tinyint(2) NOT NULL DEFAULT '0',
- `MAX_STAGE` tinyint(2) NOT NULL DEFAULT '0',
- `PROGRESS` decimal(7,3) NOT NULL DEFAULT '0.000',
- `MEMORY_USED` int(7) NOT NULL DEFAULT '0',
- `EXAMINED_ROWS` int(7) NOT NULL DEFAULT '0',
- `QUERY_ID` bigint(4) NOT NULL DEFAULT '0',
- `INFO_BINARY` blob,
- `TID` bigint(4) NOT NULL DEFAULT '0'
+ `INFO` longtext DEFAULT NULL,
+ `TIME_MS` decimal(22,3) NOT NULL DEFAULT 0.000,
+ `STAGE` tinyint(2) NOT NULL DEFAULT 0,
+ `MAX_STAGE` tinyint(2) NOT NULL DEFAULT 0,
+ `PROGRESS` decimal(7,3) NOT NULL DEFAULT 0.000,
+ `MEMORY_USED` bigint(7) NOT NULL DEFAULT 0,
+ `EXAMINED_ROWS` int(7) NOT NULL DEFAULT 0,
+ `QUERY_ID` bigint(4) NOT NULL DEFAULT 0,
+ `INFO_BINARY` blob DEFAULT NULL,
+ `TID` bigint(4) NOT NULL DEFAULT 0
) DEFAULT CHARSET=utf8
drop table t1;
create temporary table t1 like information_schema.processlist;
show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
- `ID` bigint(4) NOT NULL DEFAULT '0',
+ `ID` bigint(4) NOT NULL DEFAULT 0,
`USER` varchar(128) NOT NULL DEFAULT '',
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
- `TIME` int(7) NOT NULL DEFAULT '0',
+ `TIME` int(7) NOT NULL DEFAULT 0,
`STATE` varchar(64) DEFAULT NULL,
- `INFO` longtext,
- `TIME_MS` decimal(22,3) NOT NULL DEFAULT '0.000',
- `STAGE` tinyint(2) NOT NULL DEFAULT '0',
- `MAX_STAGE` tinyint(2) NOT NULL DEFAULT '0',
- `PROGRESS` decimal(7,3) NOT NULL DEFAULT '0.000',
- `MEMORY_USED` int(7) NOT NULL DEFAULT '0',
- `EXAMINED_ROWS` int(7) NOT NULL DEFAULT '0',
- `QUERY_ID` bigint(4) NOT NULL DEFAULT '0',
- `INFO_BINARY` blob,
- `TID` bigint(4) NOT NULL DEFAULT '0'
+ `INFO` longtext DEFAULT NULL,
+ `TIME_MS` decimal(22,3) NOT NULL DEFAULT 0.000,
+ `STAGE` tinyint(2) NOT NULL DEFAULT 0,
+ `MAX_STAGE` tinyint(2) NOT NULL DEFAULT 0,
+ `PROGRESS` decimal(7,3) NOT NULL DEFAULT 0.000,
+ `MEMORY_USED` bigint(7) NOT NULL DEFAULT 0,
+ `EXAMINED_ROWS` int(7) NOT NULL DEFAULT 0,
+ `QUERY_ID` bigint(4) NOT NULL DEFAULT 0,
+ `INFO_BINARY` blob DEFAULT NULL,
+ `TID` bigint(4) NOT NULL DEFAULT 0
) DEFAULT CHARSET=utf8
drop table t1;
create table t1 like information_schema.character_sets;
@@ -1179,7 +1187,7 @@ t1 CREATE TABLE `t1` (
`CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '',
`DEFAULT_COLLATE_NAME` varchar(32) NOT NULL DEFAULT '',
`DESCRIPTION` varchar(60) NOT NULL DEFAULT '',
- `MAXLEN` bigint(3) NOT NULL DEFAULT '0'
+ `MAXLEN` bigint(3) NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8
drop table t1;
@@ -1238,8 +1246,8 @@ CREATE TABLE t1(c1 YEAR DEFAULT 2008, c2 YEAR DEFAULT 0);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` year(4) DEFAULT '2008',
- `c2` year(4) DEFAULT '0000'
+ `c1` year(4) DEFAULT 2008,
+ `c2` year(4) DEFAULT 0000
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES();
@@ -1253,8 +1261,8 @@ ALTER TABLE t1 MODIFY c1 YEAR DEFAULT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` year(4) DEFAULT '0000',
- `c2` year(4) DEFAULT '0000'
+ `c1` year(4) DEFAULT 0000,
+ `c2` year(4) DEFAULT 0000
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES();
@@ -1338,7 +1346,7 @@ BEGIN
INSERT INTO t1 ( `int` ) VALUES (4 ),( 8 ),( 2 ) ;
END ; |
INSERT INTO t1 (pk, int_key) SELECT `pk` , `int_key` FROM B ;
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
UPDATE A SET `pk`=1 WHERE `pk`=0 ;
@@ -1348,7 +1356,6 @@ CREATE TRIGGER f1 BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
UPDATE A SET `pk`=1 WHERE `pk`=0 ;
END ;|
-ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
DROP TABLE t1;
DROP TABLE B;
#
@@ -1733,7 +1740,8 @@ drop view t1;
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;
-ERROR HY000: Can't reopen table: 't1'
+Warnings:
+Note 1050 Table 't1' already exists
select * from t1;
a
1
@@ -1814,6 +1822,7 @@ 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);
Warnings:
@@ -1832,6 +1841,8 @@ create table t1 like t2;
ERROR 42S01: Table 't1' already exists
create or replace table t1 (a int, b int) select 2,2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+disconnect user1;
+connection default;
select * from t1;
a b
1 1
@@ -1859,11 +1870,11 @@ Thinkpad Laptop black ttt
show create table t1;
Table Create Table
t1 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,
+ `color` char(32) GENERATED ALWAYS AS (column_get(`dynamic_cols`,1 as char charset latin1)) STORED,
+ `cl` char(32) GENERATED ALWAYS AS (column_get(column_add(column_create(1,'blue' AS char charset latin1 ),2,'ttt'),`i` as char charset latin1)) STORED,
`item_name` varchar(32) NOT NULL,
`i` int(11) DEFAULT NULL,
- `dynamic_cols` blob,
+ `dynamic_cols` blob DEFAULT NULL,
PRIMARY KEY (`item_name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -1881,10 +1892,11 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`n` int(11) DEFAULT NULL,
- `c` char(32) AS (convert(cast(n as char), char)) PERSISTENT
+ `c` char(32) GENERATED ALWAYS AS (cast(cast(`n` as char charset latin1) as char charset latin1)) STORED
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @@session.collation_server=filename;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t1(a enum('',''));
Warnings:
Note 1291 Column 'a' has duplicated value '' in ENUM
@@ -2055,5 +2067,5 @@ create table t1;
ERROR 42000: A table must have at least 1 column
create table t1 (i int, j int, key(i), key(i)) as select 1 as i, 2 as j;
Warnings:
-Note 1831 Duplicate index `i_2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i_2`. This is deprecated and will be disallowed in a future release
drop table t1;
diff --git a/mysql-test/r/create_drop_binlog.result b/mysql-test/r/create_drop_binlog.result
index 537a1bd4605..249f99475be 100644
--- a/mysql-test/r/create_drop_binlog.result
+++ b/mysql-test/r/create_drop_binlog.result
@@ -141,7 +141,7 @@ 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');
Warnings:
-Note 1476 The foreign server, s1, you are trying to create already exists.
+Note 1476 The foreign server, s1, you are trying to create already exists
DROP SERVER IF EXISTS s1;
DROP SERVER IF EXISTS s1;
SHOW BINLOG EVENTS;
@@ -363,7 +363,7 @@ t1 CREATE TABLE `t1` (
DROP INDEX IF EXISTS i1 ON t1;
DROP INDEX IF EXISTS i1 ON t1;
Warnings:
-Note 1091 Can't DROP 'i1'; check that column/key exists
+Note 1091 Can't DROP INDEX `i1`; check that it exists
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
Warnings:
diff --git a/mysql-test/r/create_drop_function.result b/mysql-test/r/create_drop_function.result
index e9db636ab87..8e529a587fa 100644
--- a/mysql-test/r/create_drop_function.result
+++ b/mysql-test/r/create_drop_function.result
@@ -4,7 +4,7 @@ RETURNS CHAR(100)
RETURN CONCAT('Hello, ', str, '!');
SELECT * FROM mysql.proc WHERE name like 'f1';
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
-test f1 FUNCTION f1 SQL CONTAINS_SQL NO DEFINER str char(20) char(100) CHARSET latin1 RETURN CONCAT('Hello, ', str, '!') root@localhost 2014-09-30 08:00:00 2014-09-30 08:00:00 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci RETURN CONCAT('Hello, ', str, '!')
+test f1 FUNCTION f1 SQL CONTAINS_SQL NO DEFINER str char(20) char(100) CHARSET latin1 RETURN CONCAT('Hello, ', str, '!') root@localhost 2014-09-30 08:00:00 2014-09-30 08:00:00 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci RETURN CONCAT('Hello, ', str, '!')
SELECT f1('world');
f1('world')
Hello, world!
diff --git a/mysql-test/r/create_drop_index.result b/mysql-test/r/create_drop_index.result
index 113c32aca4d..7df6aeb5838 100644
--- a/mysql-test/r/create_drop_index.result
+++ b/mysql-test/r/create_drop_index.result
@@ -16,7 +16,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP INDEX IF EXISTS i1 ON t1;
Warnings:
-Note 1091 Can't DROP 'i1'; check that column/key exists
+Note 1091 Can't DROP INDEX `i1`; check that it exists
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/r/create_drop_role.result b/mysql-test/r/create_drop_role.result
index 6e05900264d..498dd4c1c02 100644
--- a/mysql-test/r/create_drop_role.result
+++ b/mysql-test/r/create_drop_role.result
@@ -43,6 +43,8 @@ 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;
CURRENT_USER
u1@localhost
@@ -65,6 +67,8 @@ mysql
performance_schema
test
SET ROLE NONE;
+connect user_b, localhost, root,,;
+connection user_b;
# Clearing up
DROP ROLE role_1;
DROP ROLE IF EXISTS role_1;
diff --git a/mysql-test/r/create_drop_server.result b/mysql-test/r/create_drop_server.result
index 5c3c15ff477..29c4fe7e123 100644
--- a/mysql-test/r/create_drop_server.result
+++ b/mysql-test/r/create_drop_server.result
@@ -7,7 +7,7 @@ server_name username db
server1 user1 test0
CREATE SERVER IF NOT EXISTS server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user2', HOST 'localhost', DATABASE 'test1');
Warnings:
-Note 1476 The foreign server, server1, you are trying to create already exists.
+Note 1476 The foreign server, server1, you are trying to create already exists
SELECT server_name, username, db FROM mysql.servers;
server_name username db
server1 user1 test0
@@ -21,10 +21,10 @@ server_name username db
DROP SERVER IF EXISTS server1;
CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test0');
CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test1');
-ERROR HY000: The foreign server, server_1, you are trying to create already exists.
+ERROR HY000: The foreign server, server_1, you are trying to create already exists
CREATE SERVER IF NOT EXISTS server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test2');
Warnings:
-Note 1476 The foreign server, server_1, you are trying to create already exists.
+Note 1476 The foreign server, server_1, you are trying to create already exists
SELECT server_name, username, db FROM mysql.servers;
server_name username db
server_1 mysqltest_1 test0
@@ -35,3 +35,12 @@ SELECT server_name, username, db FROM mysql.servers;
server_name username db
server_1 mysqltest_1 test4
DROP SERVER server_1;
+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';
+Host
+server.example.com
+ALTER SERVER server_1 OPTIONS(HOST 'Server.Example.Org');
+SELECT Host FROM mysql.servers WHERE Server_Name = 'server_1';
+Host
+server.example.org
+DROP SERVER server_1;
diff --git a/mysql-test/r/create_drop_trigger.result b/mysql-test/r/create_drop_trigger.result
index a215838b0fd..f7ae8d21a7f 100644
--- a/mysql-test/r/create_drop_trigger.result
+++ b/mysql-test/r/create_drop_trigger.result
@@ -8,7 +8,6 @@ SELECT @sum;
@sum
60
CREATE TRIGGER IF NOT EXISTS val_sum_new BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + NEW.val;
-ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
CREATE TRIGGER IF NOT EXISTS val_sum AFTER INSERT ON t1 FOR EACH ROW SET @sum = @sum + 1 + NEW.val;
Warnings:
Note 1359 Trigger already exists
diff --git a/mysql-test/r/create_drop_view.result b/mysql-test/r/create_drop_view.result
index a822c16ae3c..0ec337b9b25 100644
--- a/mysql-test/r/create_drop_view.result
+++ b/mysql-test/r/create_drop_view.result
@@ -16,22 +16,22 @@ CREATE VIEW v1 AS SELECT * FROM t1 WHERE id>11;
ERROR 42S01: Table 'v1' already exists
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1';
VIEW_DEFINITION
-select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`id` > 10)
+select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`id` > 10
CREATE VIEW IF NOT EXISTS v1 AS SELECT * FROM t1 WHERE id>12;
Warnings:
Note 1050 Table 'v1' already exists
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1';
VIEW_DEFINITION
-select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`id` > 10)
+select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`id` > 10
CREATE OR REPLACE VIEW IF NOT EXISTS v1 AS SELECT * FROM t1 WHERE id>13;
ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1';
VIEW_DEFINITION
-select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`id` > 10)
+select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`id` > 10
CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1 WHERE id>14;
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1';
VIEW_DEFINITION
-select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`id` > 14)
+select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`id` > 14
INSERT INTO t1 VALUES (50), (80), (3), (2), (40);
SELECT * FROM t1;
id
diff --git a/mysql-test/r/create_or_replace.result b/mysql-test/r/create_or_replace.result
index 70b4b98b89c..e26884f1cbf 100644
--- a/mysql-test/r/create_or_replace.result
+++ b/mysql-test/r/create_or_replace.result
@@ -432,12 +432,19 @@ unlock tables;
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;
CREATE OR REPLACE TABLE t1 LIKE tmp;
+connection default;
KILL QUERY con_id;
+connection con1;
ERROR 70100: Query execution was interrupted
CREATE OR REPLACE TABLE t1 (a int);
+connection default;
KILL QUERY con_id;
+connection con1;
ERROR 70100: Query execution was interrupted
+disconnect con1;
+connection default;
drop table t1;
DROP TABLE t2;
#
@@ -451,3 +458,23 @@ CREATE OR REPLACE TABLE t1 AS SELECT f1();
UNLOCK TABLES;
DROP FUNCTION f1;
DROP TABLE t1;
+#
+# MDEV-11071 - Assertion `thd->transaction.stmt.is_empty()' failed in
+# Locked_tables_list::unlock_locked_tables
+#
+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;
+a
+CREATE OR REPLACE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+SELECT * FROM t3;
+ERROR HY000: Table 't3' was not locked with LOCK TABLES
+CREATE OR REPLACE TEMPORARY TABLE t2(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
+SELECT * FROM t3;
+ERROR HY000: Table 't3' was not locked with LOCK TABLES
+UNLOCK TABLES;
+DROP TABLE t3;
diff --git a/mysql-test/r/create_or_replace2.result b/mysql-test/r/create_or_replace2.result
index 6f5e412b91c..47431212492 100644
--- a/mysql-test/r/create_or_replace2.result
+++ b/mysql-test/r/create_or_replace2.result
@@ -17,9 +17,11 @@ t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
KEY `a` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
+connection slave;
SHOW TABLES;
Tables_in_test
t1
+connection master;
drop temporary table if exists tmp;
drop table t1;
include/rpl_end.inc
diff --git a/mysql-test/r/create_or_replace_permission.result b/mysql-test/r/create_or_replace_permission.result
index f662bf1bfd8..b9938e4270a 100644
--- a/mysql-test/r/create_or_replace_permission.result
+++ b/mysql-test/r/create_or_replace_permission.result
@@ -19,6 +19,8 @@ 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;
CURRENT_USER
mysqltest_1@localhost
@@ -41,6 +43,7 @@ CREATE OR REPLACE USER u1@localhost;
ERROR 42000: Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
CREATE OR REPLACE ROLE developer;
ERROR 42000: Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
+connection default;
SELECT CURRENT_USER;
CURRENT_USER
root@localhost
diff --git a/mysql-test/r/create_user.result b/mysql-test/r/create_user.result
new file mode 100644
index 00000000000..1411f2e8792
--- /dev/null
+++ b/mysql-test/r/create_user.result
@@ -0,0 +1,72 @@
+create user foo;
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N N 0.000000
+drop user foo;
+create user foo identified by 'password';
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N N 0.000000
+drop user foo;
+create user foo identified by 'password' require SSL;
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N ANY 0 0 0 0 N N 0.000000
+drop user foo;
+create user foo identified by 'password' require X509;
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N X509 0 0 0 0 N N 0.000000
+drop user foo;
+create user foo identified by 'password' require CIPHER 'cipher';
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher 0 0 0 0 N N 0.000000
+drop user foo;
+create user foo identified by 'password' require ISSUER 'issuer';
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED issuer 0 0 0 0 N N 0.000000
+drop user foo;
+create user foo identified by 'password' require SUBJECT 'subject';
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED subject 0 0 0 0 N N 0.000000
+drop user foo;
+create user foo identified by 'password' require CIPHER 'cipher'
+ SUBJECT 'subject';
+select * from mysql.user where user = 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher subject 0 0 0 0 N N 0.000000
+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';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher issuer subject 0 0 0 0 N N 0.000000
+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';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher issuer subject 0 0 0 0 N N 0.000000
+#--warning ER_USER_CREATE_EXISTS
+create user if not exists foo, foo2 identified by 'password2'
+ require CIPHER 'cipher2' AND SUBJECT 'subject2' AND ISSUER 'issuer2';
+Warnings:
+Note 1973 Can't create user 'foo'@'%'; it already exists
+Note 1973 Can't create user 'foo2'@'%'; it already exists
+select * from mysql.user where user like 'foo';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher issuer subject 0 0 0 0 N N 0.000000
+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';
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
+% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 20 30 40 N N 0.000000
+drop user foo;
diff --git a/mysql-test/r/create_w_max_indexes_128.result b/mysql-test/r/create_w_max_indexes_128.result
index d11ed47c2f4..cd23e493f5c 100644
--- a/mysql-test/r/create_w_max_indexes_128.result
+++ b/mysql-test/r/create_w_max_indexes_128.result
@@ -259,70 +259,70 @@ 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)
);
Warnings:
-Note 1831 Duplicate index 'a002_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a003_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a004_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a005_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a006_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a007_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a008_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a009_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a010_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a011_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a012_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a013_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a014_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a015_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a016_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a017_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a018_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a019_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a020_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a021_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a022_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a023_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a024_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a025_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a026_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a027_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a028_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a029_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a030_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a031_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a032_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a033_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a034_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a035_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a036_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a037_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a038_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a039_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a040_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a041_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a042_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a043_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a044_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a045_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a046_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a047_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a048_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a049_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a050_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a051_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a052_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a053_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a054_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a055_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a056_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a057_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a058_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a059_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a060_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a061_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a062_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a063_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a064_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a065_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index 'a002_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a003_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a004_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a005_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a006_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a007_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a008_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a009_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a010_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a011_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a012_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a013_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a014_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a015_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a016_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a017_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a018_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a019_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a020_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a021_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a022_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a023_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a024_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a025_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a026_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a027_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a028_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a029_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a030_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a031_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a032_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a033_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a034_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a035_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a036_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a037_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a038_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a039_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a040_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a041_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a042_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a043_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a044_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a045_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a046_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a047_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a048_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a049_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a050_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a051_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a052_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a053_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a054_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a055_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a056_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a057_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a058_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a059_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a060_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a061_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a062_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a063_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a064_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a065_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -881,70 +881,70 @@ 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);
Warnings:
-Note 1831 Duplicate index 'a002_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a003_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a004_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a005_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a006_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a007_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a008_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a009_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a010_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a011_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a012_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a013_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a014_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a015_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a016_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a017_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a018_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a019_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a020_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a021_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a022_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a023_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a024_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a025_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a026_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a027_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a028_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a029_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a030_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a031_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a032_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a033_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a034_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a035_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a036_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a037_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a038_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a039_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a040_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a041_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a042_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a043_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a044_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a045_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a046_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a047_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a048_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a049_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a050_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a051_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a052_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a053_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a054_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a055_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a056_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a057_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a058_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a059_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a060_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a061_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a062_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a063_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a064_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index 'a065_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index 'a002_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a003_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a004_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a005_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a006_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a007_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a008_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a009_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a010_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a011_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a012_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a013_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a014_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a015_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a016_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a017_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a018_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a019_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a020_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a021_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a022_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a023_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a024_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a025_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a026_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a027_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a028_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a029_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a030_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a031_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a032_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a033_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a034_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a035_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a036_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a037_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a038_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a039_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a040_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a041_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a042_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a043_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a044_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a045_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a046_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a047_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a048_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a049_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a050_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a051_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a052_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a053_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a054_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a055_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a056_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a057_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a058_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a059_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a060_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a061_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a062_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a063_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a064_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index 'a065_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/r/create_w_max_indexes_64.result b/mysql-test/r/create_w_max_indexes_64.result
index 0762db3d0b1..c937f3af312 100644
--- a/mysql-test/r/create_w_max_indexes_64.result
+++ b/mysql-test/r/create_w_max_indexes_64.result
@@ -131,69 +131,69 @@ 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)
);
Warnings:
-Note 1831 Duplicate index `a002_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a003_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a004_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a005_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a006_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a007_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a008_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a009_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a010_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a011_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a012_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a013_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a014_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a015_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a016_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a017_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a018_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a019_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a020_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a021_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a022_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a023_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a024_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a025_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a026_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a027_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a028_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a029_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a030_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a031_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a032_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a033_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a034_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a035_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a036_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a037_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a038_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a039_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a040_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a041_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a042_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a043_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a044_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a045_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a046_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a047_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a048_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a049_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a050_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a051_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a052_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a053_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a054_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a055_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a056_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a057_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a058_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a059_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a060_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a061_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a062_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a063_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a064_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `a002_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a003_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a004_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a005_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a006_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a007_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a008_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a009_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a010_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a011_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a012_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a013_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a014_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a015_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a016_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a017_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a018_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a019_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a020_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a021_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a022_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a023_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a024_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a025_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a026_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a027_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a028_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a029_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a030_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a031_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a032_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a033_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a034_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a035_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a036_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a037_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a038_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a039_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a040_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a041_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a042_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a043_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a044_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a045_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a046_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a047_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a048_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a049_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a050_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a051_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a052_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a053_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a054_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a055_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a056_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a057_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a058_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a059_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a060_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a061_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a062_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a063_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a064_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -496,69 +496,69 @@ 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);
Warnings:
-Note 1831 Duplicate index `a002_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a003_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a004_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a005_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a006_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a007_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a008_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a009_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a010_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a011_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a012_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a013_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a014_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a015_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a016_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a017_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a018_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a019_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a020_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a021_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a022_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a023_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a024_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a025_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a026_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a027_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a028_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a029_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a030_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a031_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a032_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a033_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a034_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a035_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a036_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a037_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a038_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a039_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a040_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a041_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a042_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a043_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a044_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a045_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a046_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a047_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a048_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a049_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a050_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a051_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a052_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a053_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a054_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a055_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a056_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a057_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a058_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a059_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a060_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a061_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a062_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a063_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a064_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `a002_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a003_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a004_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a005_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a006_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a007_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a008_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a009_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a010_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a011_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a012_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a013_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a014_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a015_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a016_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a017_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a018_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a019_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a020_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a021_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a022_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a023_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a024_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a025_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a026_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a027_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a028_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a029_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a030_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a031_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a032_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a033_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a034_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a035_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a036_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a037_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a038_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a039_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a040_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a041_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a042_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a043_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a044_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a045_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a046_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a047_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a048_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a049_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a050_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a051_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a052_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a053_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a054_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a055_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a056_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a057_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a058_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a059_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a060_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a061_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a062_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a063_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a064_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/r/cte_grant.result b/mysql-test/r/cte_grant.result
new file mode 100644
index 00000000000..2ee31be3435
--- /dev/null
+++ b/mysql-test/r/cte_grant.result
@@ -0,0 +1,123 @@
+connect root,localhost,root,,test;
+connection root;
+create database mysqltest;
+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;
+c b
+1 30
+1 30
+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 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 't2'
+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;
+ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 't2'
+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;
+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;
+ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 't2'
+select * from mysqltest.v1;
+f1 f2
+1 30
+1 30
+select c from mysqltest.v2;
+c
+select d from mysqltest.v2;
+ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 'v2'
+select * from mysqltest.v3;
+ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v3'
+connection root;
+grant select on mysqltest.v3 to mysqltest_1@localhost;
+connection user1;
+select * from mysqltest.v3;
+c d
+1 30
+1 30
+connection root;
+revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
+drop database mysqltest;
+#
+# MDEV-13453: privileges checking for CTE
+#
+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;
+i
+3
+1
+2
+3
+1
+with cte as (select * from t1 where i < 4 group by i)
+select * from cte;
+i
+1
+2
+3
+with cte as (select * from t1 where i < 4)
+select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2;
+i
+1
+3
+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;
+i
+1
+3
+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;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'b' in table 't2'
+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;
+a
+1
+3
+connection default;
+revoke SELECT on db.t1 from foo@localhost;
+connection con1;
+with cte as (select * from t1 where i < 4)
+select * from cte;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1'
+disconnect con1;
+connection default;
+drop database db;
+drop user foo@localhost;
diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result
new file mode 100644
index 00000000000..001df909bcf
--- /dev/null
+++ b/mysql-test/r/cte_nonrecursive.result
@@ -0,0 +1,1464 @@
+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);
+# 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;
+c a
+4 4
+3 3
+4 4
+select * from t2, (select a from t1 where b >= 'c') as t
+where t2.c=t.a;
+c a
+4 4
+3 3
+4 4
+explain
+with t as (select a from t1 where b >= 'c')
+select * from t2,t where t2.c=t.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+explain
+select * from t2, (select a from t1 where b >= 'c') as t
+where t2.c=t.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+# select '*' in the specification of t
+with t as (select * from t1 where b >= 'c')
+select * from t2,t where t2.c=t.a;
+c a b
+4 4 dd
+3 3 eee
+4 4 ggg
+select * from t2, (select * from t1 where b >= 'c') as t
+where t2.c=t.a;
+c a b
+4 4 dd
+3 3 eee
+4 4 ggg
+explain
+with t as (select * from t1 where b >= 'c')
+select * from t2,t where t2.c=t.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+explain
+select * from t2, (select * from t1 where b >= 'c') as t
+where t2.c=t.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+# 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;
+c f1 f2
+4 4 dd
+3 3 eee
+4 4 ggg
+explain
+with t(f1,f2) as (select * from t1 where b >= 'c')
+select * from t2,t where t2.c=t.f1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+# 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;
+c a count(*)
+4 4 2
+3 3 1
+select * from t2, (select a, count(*) from t1 where b >= 'c' group by a) as t
+where t2.c=t.a;
+c a count(*)
+4 4 2
+3 3 1
+explain
+with t as (select a, count(*) from t1 where b >= 'c' group by a)
+select * from t2,t where t2.c=t.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2
+2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
+explain
+select * from t2, (select a, count(*) from t1 where b >= 'c' group by a) as t
+where t2.c=t.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2
+2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
+# 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;
+c a count(*)
+3 3 1
+select * from t2, (select a, count(*) from t1 where b >= 'c'
+ group by a having count(*)=1) t
+where t2.c=t.a;
+c a count(*)
+3 3 1
+# 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;
+a count(*)
+3 1
+select a, count(*) from t1, (select * from t2 where c <= 4) t
+where t1.a=t.c group by a having count(*)=1;
+a count(*)
+3 1
+# 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(*);
+a count(*)
+3 1
+4 3
+select a, count(*) from t1, (select * from t2 where c <= 4 ) t
+where t1.a=t.c group by a order by count(*);
+a count(*)
+3 1
+4 3
+# 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;
+a count(*)
+4 3
+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;
+a count(*)
+4 3
+# 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);
+c
+4
+3
+select * from t2
+where c in (select a from (select a from t1 where a<5) as t);
+c
+4
+3
+explain
+with t as (select a from t1 where a<5)
+select * from t2 where c in (select a from t);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 4
+1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1
+3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where
+explain
+select * from t2
+where c in (select a from (select a from t1 where a<5) as t);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 4
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
+2 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where
+# 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);
+c
+2
+select * from t2
+where c in (select c from (select count(*) as c from t1
+where b >= 'c' group by a) as t);
+c
+2
+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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
+1 PRIMARY <derived2> ref key0 key0 8 test.t2.c 2 Using where; FirstMatch(t2)
+2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
+explain
+select * from t2
+where c in (select c from (select count(*) as c from t1
+where b >= 'c' group by a) as t);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
+1 PRIMARY <derived3> ref key0 key0 8 test.t2.c 2 Using where; FirstMatch(t2)
+3 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
+# two references to t specified by a query
+# 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;
+a a
+1 1
+1 1
+4 4
+4 4
+3 3
+1 1
+1 1
+4 4
+4 4
+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;
+a a
+1 1
+1 1
+4 4
+4 4
+3 3
+1 1
+1 1
+4 4
+4 4
+explain
+with t as (select a from t1 where b >= 'c')
+select * from t as r1, t as r2 where r1.a=r2.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+# 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;
+a a
+1 1
+4 4
+3 3
+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;
+a a
+1 1
+4 4
+3 3
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 8 Using where
+1 PRIMARY <derived3> ref key0 key0 5 r1.a 2
+3 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
+2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 8 Using where
+1 PRIMARY <derived3> ref key0 key0 5 r1.a 2
+3 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
+2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
+# two references to t specified by a query
+# 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;
+a b a b
+1 ccc 1 ccc
+1 fff 1 ccc
+4 dd 4 dd
+4 ggg 4 dd
+3 eee 3 eee
+1 ccc 1 fff
+1 fff 1 fff
+4 dd 4 ggg
+4 ggg 4 ggg
+select * from (select * from t1 where b >= 'c') as r1,
+(select * from t1 where b >= 'c') as r2
+where r1.a=r2.a;
+a b a b
+1 ccc 1 ccc
+1 fff 1 ccc
+4 dd 4 dd
+4 ggg 4 dd
+3 eee 3 eee
+1 ccc 1 fff
+1 fff 1 fff
+4 dd 4 ggg
+4 ggg 4 ggg
+explain
+with t as (select * from t1 where b >= 'c')
+select * from t as r1, t as r2 where r1.a=r2.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+explain
+select * from (select * from t1 where b >= 'c') as r1,
+(select * from t1 where b >= 'c') as r2
+where r1.a=r2.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+# 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;
+c c
+1 1
+1 1
+4 4
+4 4
+3 3
+1 1
+1 1
+4 4
+4 4
+# 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;
+a
+1
+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;
+a
+1
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where
+3 UNION t1 ALL NULL NULL NULL NULL 8 Using where
+NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where
+3 UNION t1 ALL NULL NULL NULL NULL 8 Using where
+NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL
+# 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;
+c a
+2 2
+4 4
+3 3
+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;
+c a
+2 2
+4 4
+3 3
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2
+2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where
+3 UNION t2 ALL NULL NULL NULL NULL 4 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2
+2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where
+3 UNION t2 ALL NULL NULL NULL NULL 4 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+# 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);
+a b
+4 aaaa
+7 bb
+7 bb
+4 dd
+7 bb
+7 bb
+4 ggg
+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);
+a b
+4 aaaa
+7 bb
+7 bb
+4 dd
+7 bb
+7 bb
+4 ggg
+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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 4
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
+2 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 4
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
+2 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+# two different definitions of t: one in the with clause of the main query,
+# 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);
+a b
+4 aaaa
+4 dd
+4 ggg
+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);
+a b
+4 aaaa
+4 dd
+4 ggg
+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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
+1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
+3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
+1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
+3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+# another with table tt is defined in the with clause of a subquery
+# 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;
+a count(*)
+3 1
+4 9
+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;
+a count(*)
+3 1
+4 9
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 35 func 1
+3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
+3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 35 func 1
+3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
+3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+# 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;
+a b c a
+4 ggg 4 4
+4 ggg 4 4
+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;
+a b c a
+4 ggg 4 4
+4 ggg 4 4
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (incremental, BNL join)
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (incremental, BNL join)
+# 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;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `t1`.`a` AS `a` from `t1` where `t1`.`b` >= 'c')select `t2`.`c` AS `c`,`t`.`a` AS `a` from (`t2` join `t`) where `t2`.`c` = `t`.`a` latin1 latin1_swedish_ci
+select * from v1;
+c a
+4 4
+3 3
+4 4
+explain
+select * from v1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+# 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;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with t as (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` where `t1`.`b` >= 'c' group by `t1`.`a`)select `t2`.`c` AS `c`,`t`.`a` AS `a`,`t`.`count(*)` AS `count(*)` from (`t2` join `t`) where `t2`.`c` = `t`.`a` latin1 latin1_swedish_ci
+select * from v2;
+c a count(*)
+4 4 2
+3 3 1
+explain
+select * from v2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
+1 PRIMARY <derived3> ref key0 key0 5 test.t2.c 2
+3 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
+# with clause in the specification of a view that whose definition
+# 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;
+View Create View character_set_client collation_connection
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS with t as (select `t1`.`a` AS `c` from `t1` where `t1`.`b` >= 'c')select `r1`.`c` AS `c` from `t` `r1` where `r1`.`c` = 4 latin1 latin1_swedish_ci
+select * from v3;
+c
+4
+4
+# with clause in the specification of a view that whose definition
+# 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;
+View Create View character_set_client collation_connection
+v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS with t as (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `r1`.`c` AS `c`,`r2`.`c` AS `d` from (`t` `r1` join (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c') `r2`) where `r1`.`c` = `r2`.`c` and `r2`.`c` = 4 latin1 latin1_swedish_ci
+select * from v4;
+c d
+4 4
+4 4
+4 4
+4 4
+explain
+select * from v4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+drop view v1,v2,v3,v4;
+# 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;
+update v1 set a=0 where a > 4;
+ERROR HY000: The target table v1 of the UPDATE is not updatable
+drop view v1;
+# 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;
+c a
+4 4
+3 3
+4 4
+execute stmt1;
+c a
+4 4
+3 3
+4 4
+deallocate prepare stmt1;
+# 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;
+c a count(*)
+4 4 2
+3 3 1
+execute stmt1;
+c a count(*)
+4 4 2
+3 3 1
+deallocate prepare stmt1;
+# 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;
+a b a b
+1 ccc 1 ccc
+1 fff 1 ccc
+4 dd 4 dd
+4 ggg 4 dd
+3 eee 3 eee
+1 ccc 1 fff
+1 fff 1 fff
+4 dd 4 ggg
+4 ggg 4 ggg
+execute stmt1;
+a b a b
+1 ccc 1 ccc
+1 fff 1 ccc
+4 dd 4 dd
+4 ggg 4 dd
+3 eee 3 eee
+1 ccc 1 fff
+1 fff 1 fff
+4 dd 4 ggg
+4 ggg 4 ggg
+deallocate prepare stmt1;
+with t(f) as (select * from t1 where b >= 'c')
+select * from t2,t where t2.c=t.f1;
+ERROR HY000: WITH column list and SELECT field list have different column counts
+with t(f1,f1) as (select * from t1 where b >= 'c')
+select * from t2,t where t2.c=t.f1;
+ERROR 42S21: Duplicate column name 'f1'
+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 HY000: Duplicate query name in WITH clause 't'
+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;
+ERROR 42S02: Table 'test.s' doesn't exist
+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;
+a a
+4 4
+4 4
+3 3
+1 1
+4 4
+4 4
+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 HY000: No anchors for recursive WITH element 't'
+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 HY000: No anchors for recursive WITH element 't'
+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 HY000: No anchors for recursive WITH element 't'
+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);
+ERROR HY000: No anchors for recursive WITH element 's'
+#erroneous definition of unreferenced with table t
+with t as (select count(*) from t1 where d>='f' group by a)
+select t1.b from t2,t1 where t1.a = t2.c;
+ERROR 42S22: Unknown column 'd' in 'where clause'
+with t as (select count(*) from t1 where b>='f' group by a)
+select t1.b from t2,t1 where t1.a = t2.c;
+b
+aaaa
+dd
+eee
+ggg
+#erroneous definition of s referring to unreferenced t
+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 42S22: Unknown column 't2.d' in 'field list'
+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;
+ERROR 42S22: Unknown column 't.c' in 'where clause'
+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;
+b
+aaaa
+dd
+eee
+ggg
+#erroneous definition of unreferenced with table t
+with t(f) as (select * from t1 where b >= 'c')
+select t1.b from t2,t1 where t1.a = t2.c;
+ERROR HY000: WITH column list and SELECT field list have different column counts
+#erroneous definition of unreferenced with table t
+with t(f1,f1) as (select * from t1 where b >= 'c')
+select t1.b from t2,t1 where t1.a = t2.c;
+ERROR 42S21: Duplicate column name 'f1'
+# 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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 4
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 4
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+# too many with elements in with clause
+with s65 as (select * from t1), s64 as (select * from t1) , s63 as (select * from t1) , s62 as (select * from t1) , s61 as (select * from t1) , s60 as (select * from t1) , s59 as (select * from t1) , s58 as (select * from t1) , s57 as (select * from t1) , s56 as (select * from t1) , s55 as (select * from t1) , s54 as (select * from t1) , s53 as (select * from t1) , s52 as (select * from t1) , s51 as (select * from t1) , s50 as (select * from t1) , s49 as (select * from t1) , s48 as (select * from t1) , s47 as (select * from t1) , s46 as (select * from t1) , s45 as (select * from t1) , s44 as (select * from t1) , s43 as (select * from t1) , s42 as (select * from t1) , s41 as (select * from t1) , s40 as (select * from t1) , s39 as (select * from t1) , s38 as (select * from t1) , s37 as (select * from t1) , s36 as (select * from t1) , s35 as (select * from t1) , s34 as (select * from t1) , s33 as (select * from t1) , s32 as (select * from t1) , s31 as (select * from t1) , s30 as (select * from t1) , s29 as (select * from t1) , s28 as (select * from t1) , s27 as (select * from t1) , s26 as (select * from t1) , s25 as (select * from t1) , s24 as (select * from t1) , s23 as (select * from t1) , s22 as (select * from t1) , s21 as (select * from t1) , s20 as (select * from t1) , s19 as (select * from t1) , s18 as (select * from t1) , s17 as (select * from t1) , s16 as (select * from t1) , s15 as (select * from t1) , s14 as (select * from t1) , s13 as (select * from t1) , s12 as (select * from t1) , s11 as (select * from t1) , s10 as (select * from t1) , s9 as (select * from t1) , s8 as (select * from t1) , s7 as (select * from t1) , s6 as (select * from t1) , s5 as (select * from t1) , s4 as (select * from t1) , s3 as (select * from t1) , s2 as (select * from t1) , s1 as (select * from t1) select * from s65;
+ERROR HY000: Too many WITH elements in WITH clause
+drop table t1,t2;
+#
+# Bug mdev-9937: View used in the specification of with table
+# refers to the base table with the same name
+#
+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;
+a
+20
+30
+drop view v1;
+drop table t1;
+#
+# Bug mdev-10058: Invalid derived table with WITH clause
+#
+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);
+SELECT * FROM (WITH a AS (SELECT * FROM t1) (t2 NATURAL JOIN t3));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't2 NATURAL JOIN t3))' at line 1
+SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT * FROM t2 NATURAL JOIN t3) AS d1;
+a
+1
+2
+3
+DROP TABLE t1,t2,t3;
+#
+# Bug mdev-10344: the WITH clause of the query refers to a view that uses
+# a base table with the same name as a CTE table from the clause
+#
+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;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+drop view v1;
+drop table ten, one_k;
+#
+# MDEV-10057 : Crash with EXPLAIN + WITH + constant query
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT 1) AS t1;
+1
+1
+EXPLAIN SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT 1) AS t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+DROP TABLE t1;
+#
+# MDEV-10058: Suspicious EXPLAIN output for a derived table + WITH + joined table
+#
+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);
+EXPLAIN SELECT * FROM (WITH a AS (SELECT * FROM t1) (t2 NATURAL JOIN t3));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't2 NATURAL JOIN t3))' at line 1
+explain SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT * FROM t2 NATURAL JOIN t3) AS d1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
+DROP TABLE t1,t2,t3;
+#
+# MDEV-10729: Server crashes in st_select_lex::set_explain_type
+#
+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 )
+;
+i1 a2 b2
+DROP TABLE t1,t2,t3;
+#
+# MDEV-10923: mergeable CTE used twice in the query
+#
+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);
+name dept country
+Sergei Golubchik Development DE
+Claudio Nanni Support ES
+Sergei Petrunia Development RU
+drop table employees;
+#
+# MDEV-11818: EXPLAIN EXTENDED for a query with optimized away CTE table
+#
+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;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
+Warnings:
+Note 1003 with cte as (select `test`.`t1`.`i` AS `i`,`test`.`t1`.`c` AS `c` from `test`.`t1`)select 1 AS `i` from dual
+DROP TABLE t1;
+#
+# MDEV-12185: view defintion contains WITH clause with
+# several specifications of CTE
+#
+with
+alias1 as (select 1 as one),
+alias2 as (select 2 as two)
+select one, two from alias1, alias2;
+one two
+1 2
+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;
+one two
+1 2
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with alias1 as (select 1 AS `one`), alias2 as (select 2 AS `two`)select `alias1`.`one` AS `one`,`alias2`.`two` AS `two` from (`alias1` join `alias2`) latin1 latin1_swedish_ci
+drop view v1;
+#
+# MDEV-12440: the same CTE table is used twice
+#
+create table t1 (a int, b varchar(32));
+insert into t1 values
+(4,'aaaa' ), (7,'bb'), (1,'ccc'), (4,'dd');
+# 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;
+a b a b
+4 dd 4 dd
+# 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;
+a b
+4 dd
+drop table t1;
+#
+# MDEV-12558: CTE with the same name as temporary table
+#
+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;
+i
+1
+WITH cte AS ( SELECT i FROM t GROUP BY i) SELECT * FROM cte;
+i
+1
+SELECT * FROM cte;
+f
+2
+DROP TABLE cte;
+DROP TABLE t;
+#
+# MDEV-13107: SHOW TABLE STATUS, SHOW CREATE VIEW
+# for CTEs that use derived tables
+#
+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;
+show table status;
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `s`.`a` AS `a` from (select `test`.`t1`.`a` AS `a` from `test`.`t1`) `s`), r as (select `t`.`a` AS `a` from (`test`.`t2` join `t`) where `test`.`t2`.`b` = `t`.`a`)select `r`.`a` AS `a` from `r` latin1 latin1_swedish_ci
+show create view v2;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with t as (select `s`.`a` AS `a` from (select `test`.`t1`.`a` AS `a` from `test`.`t1`) `s`), r as (select `t`.`a` AS `a` from (`test`.`t2` join `t`) where `test`.`t2`.`b` = `t`.`a`)select `test`.`t1`.`a` AS `a` from `test`.`t1` latin1 latin1_swedish_ci
+select * from v1;
+a
+2
+select * from v2;
+a
+3
+1
+2
+prepare stmt1 from "select * from v1";
+execute stmt1;
+a
+2
+execute stmt1;
+a
+2
+prepare stmt2 from "select * from v2";
+execute stmt2;
+a
+3
+1
+2
+execute stmt2;
+a
+3
+1
+2
+deallocate prepare stmt1;
+deallocate prepare stmt2;
+drop view v1,v2;
+drop table t1,t2;
+#
+# MDEV-13796: UNION of two materialized CTEs
+#
+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);
+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;
+SUM(k)
+8
+explain 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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 9
+2 DERIVED t1 ALL NULL NULL NULL NULL 3
+2 DERIVED t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
+4 UNION <derived3> ALL NULL NULL NULL NULL 9
+3 DERIVED t1 ALL NULL NULL NULL NULL 3
+3 DERIVED t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
+NULL UNION RESULT <union1,4> ALL NULL NULL NULL NULL NULL
+DROP TABLE t1,t2;
+#
+# MDEV-13780: tower of embedding CTEs with multiple usage of them
+#
+create table t1 (a int);
+insert into t1 values (3), (2), (4), (7), (1), (2), (5);
+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;
+a
+2
+5
+explain extended 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;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 14 100.00 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using where
+5 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where
+NULL UNION RESULT <union2,5> ALL NULL NULL NULL NULL NULL NULL
+6 UNION <derived9> ALL NULL NULL NULL NULL 14 100.00
+9 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using where
+12 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where
+NULL UNION RESULT <union9,12> ALL NULL NULL NULL NULL NULL NULL
+NULL UNION RESULT <union1,6> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 with cte_e as (with cte_o as (with cte_i as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union select `cte_e2`.`a` AS `a` from (with cte_o as (with cte_i as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7) `cte_e2`
+drop table t1;
+#
+# MDEV-13753: embedded CTE in a VIEW created in prepared statement
+#
+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;
+View Create View character_set_client collation_connection
+cte_test CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `cte_test` AS with cte1 as (select 1 AS `a`), cte2 as (select `cte1`.`a` AS `a` from `cte1`)select `cte2`.`a` AS `a` from `cte2` latin1 latin1_swedish_ci
+SELECT * FROM cte_test;
+a
+1
+DROP VIEW cte_test;
+#
+# mdev-14755 : PS for query using CTE in select with subquery
+#
+create table t1 (a int);
+insert into t1 values
+(7), (2), (8), (1), (3), (2), (7), (5), (4), (7), (9), (8);
+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);
+a
+7
+5
+4
+1
+prepare stmt from "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)";
+execute stmt;
+a
+7
+5
+4
+1
+execute stmt;
+a
+7
+5
+4
+1
+deallocate prepare stmt;
+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 ));
+a
+1
+7
+5
+4
+prepare stmt from "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 ))";
+execute stmt;
+a
+1
+7
+5
+4
+execute stmt;
+a
+1
+7
+5
+4
+deallocate prepare stmt;
+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 ));
+a
+1
+7
+5
+4
+prepare stmt from "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 ))";
+execute stmt;
+a
+1
+7
+5
+4
+execute stmt;
+a
+1
+7
+5
+4
+deallocate prepare stmt;
+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 ));
+a
+7
+5
+4
+prepare stmt from "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 ))";
+execute stmt;
+a
+7
+5
+4
+execute stmt;
+a
+7
+5
+4
+deallocate prepare stmt;
+drop table t1;
+#
+# MDEV-14852: CTE using temporary table in query
+# with two references to the CTE
+#
+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;
+i
+5
+4
+2
+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);
+term term
+TERM02 TERM02
+TERM03 TERM03
+TERM01 NULL
+NULL TERM04
+drop table t1,t2;
+#
+# MDEV-14969: view using subquery with attached CTE
+#
+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");
+n_nationkey n_name n_regionkey r_regionkey r_name
+0 ALGERIA 0 0 AFRICA
+5 ETHIOPIA 0 0 AFRICA
+14 KENYA 0 0 AFRICA
+15 MOROCCO 0 0 AFRICA
+16 MOZAMBIQUE 0 0 AFRICA
+1 ARGENTINA 1 1 AMERICA
+2 BRAZIL 1 1 AMERICA
+3 CANADA 1 1 AMERICA
+17 PERU 1 1 AMERICA
+24 UNITED STATES 1 1 AMERICA
+6 FRANCE 3 3 EUROPE
+7 GERMANY 3 3 EUROPE
+19 ROMANIA 3 3 EUROPE
+22 RUSSIA 3 3 EUROPE
+23 UNITED KINGDOM 3 3 EUROPE
+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;
+View Create View character_set_client collation_connection
+v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `n`.`n_nationkey` AS `n_nationkey`,`n`.`n_name` AS `n_name`,`n`.`n_regionkey` AS `n_regionkey`,`r`.`r_regionkey` AS `r_regionkey`,`r`.`r_name` AS `r_name` from (`nation` `n` join `region` `r`) where `n`.`n_regionkey` = `r`.`r_regionkey` and `r`.`r_regionkey` in (with t as (select `region`.`r_regionkey` AS `r_regionkey`,`region`.`r_name` AS `r_name` from `region` where `region`.`r_regionkey` <= 3)select `t`.`r_regionkey` from `t` where `t`.`r_name` <> 'ASIA') latin1 latin1_swedish_ci
+select * from v;
+n_nationkey n_name n_regionkey r_regionkey r_name
+0 ALGERIA 0 0 AFRICA
+5 ETHIOPIA 0 0 AFRICA
+14 KENYA 0 0 AFRICA
+15 MOROCCO 0 0 AFRICA
+16 MOZAMBIQUE 0 0 AFRICA
+1 ARGENTINA 1 1 AMERICA
+2 BRAZIL 1 1 AMERICA
+3 CANADA 1 1 AMERICA
+17 PERU 1 1 AMERICA
+24 UNITED STATES 1 1 AMERICA
+6 FRANCE 3 3 EUROPE
+7 GERMANY 3 3 EUROPE
+19 ROMANIA 3 3 EUROPE
+22 RUSSIA 3 3 EUROPE
+23 UNITED KINGDOM 3 3 EUROPE
+drop view v;
+drop table region, nation;
+#
+# MDEV-15120: cte name used with database name
+#
+WITH cte AS (SELECT 1 AS a) SELECT test.cte.a FROM test.cte;
+ERROR 42S02: Table 'test.cte' doesn't exist
+CREATE DATABASE db1;
+USE db1;
+WITH cte AS (SELECT 1 AS a) SELECT db1.cte.a FROM db1.cte;
+ERROR 42S02: Table 'db1.cte' doesn't exist
+DROP DATABASE db1;
+USE test;
+#
+# MDEV-15119: CTE c2 specified after CTE c1 and is used in
+# CTE c3 that is embedded into the spec of c1
+#
+CREATE TABLE t1 (i int);
+INSERT INTO t1 VALUES (1),(2),(3);
+WITH c1 AS (WITH c3 AS (SELECT * FROM c2) SELECT * FROM c3),
+c2 AS (SELECT * FROM t1)
+SELECT * FROM c1;
+ERROR 42S02: Table 'test.c2' doesn't exist
+WITH RECURSIVE c1 AS (WITH c3 AS (SELECT * FROM c2) SELECT * FROM c3),
+c2 AS (SELECT * FROM t1)
+SELECT * FROM c1;
+i
+1
+2
+3
+DROP TABLE t1;
+#
+# MDEV-14297: Lost name of a explicitly named CTE column used in
+# the non-recursive CTE via prepared statement
+#
+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;
+a
+1
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM "CREATE VIEW v1 AS WITH cte(a) AS (SELECT 1) SELECT * FROM cte";
+EXECUTE stmt;
+SELECT * FROM v1;
+a
+1
+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;
+a
+1
+2
+3
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+DROP VIEW v1,v2;
+#
+# MDEV-15478: Lost name of a explicitly named CTE column used in
+# the non-recursive CTE defined with UNION
+#
+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;
+a
+1
+2
+WITH cte(a) AS (SELECT 1 UNION SELECT 2) SELECT a FROM cte;
+a
+1
+2
+WITH cte(a) AS (SELECT 1 UNION ALL SELECT 1) SELECT a FROM cte;
+a
+1
+1
+WITH cte(a) AS (SELECT x from t1 UNION SELECT 4) SELECT a FROM cte;
+a
+1
+2
+3
+4
+WITH cte(a) AS (SELECT 4 UNION SELECT x FROM t1 UNION SELECT 5)
+SELECT a FROM cte;
+a
+4
+1
+2
+3
+5
+WITH cte(a,b) AS (SELECT 4,5 UNION SELECT 4,3) SELECT a,b FROM cte;
+a b
+4 5
+4 3
+DROP TABLE t1;
diff --git a/mysql-test/r/cte_recursive.result b/mysql-test/r/cte_recursive.result
new file mode 100644
index 00000000000..d6dfdf1ec6a
--- /dev/null
+++ b/mysql-test/r/cte_recursive.result
@@ -0,0 +1,3235 @@
+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');
+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 HY000: Unacceptable mutual recursion with anchored table 't'
+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;
+ERROR HY000: Unacceptable mutual recursion with anchored table 'a1'
+drop table t1;
+# 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);
+# just WITH : s refers to t defined after s
+with
+s(a) as (select t.a + 10 from t),
+t(a) as (select t1.a from t1)
+select * from s;
+ERROR 42S02: Table 'test.t' doesn't exist
+# 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;
+a
+10
+11
+12
+13
+14
+# 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;
+a
+3
+1
+2
+4
+5
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 30
+2 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where
+3 UNION t1 ALL NULL NULL NULL NULL 5
+3 UNION t2 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+#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;
+a
+3
+4
+5
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5
+2 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where
+3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 5
+3 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+# 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;
+Field Type Null Key Default Extra
+a bigint(20) YES NULL
+# 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;
+Field Type Null Key Default Extra
+a int(11) YES NULL
+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);
+# simple recursion with one anchor and one recursive select
+# 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;
+id name dob father mother
+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
+7 Grandma Sally 1943-08-23 NULL 6
+8 Grandpa Ben 1940-10-21 NULL NULL
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+# simple recursion with one anchor and one recursive select
+# 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;
+id name dob father mother
+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
+7 Grandma Sally 1943-08-23 NULL 6
+8 Grandpa Ben 1940-10-21 NULL NULL
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+# simple recursion with one anchor and one recursive select
+# 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;
+id name dob father mother
+67 Cousin Eddie 1992-02-28 25 27
+25 Uncle Jim 1968-11-18 8 7
+27 Auntie Melinda 1971-03-29 NULL NULL
+7 Grandma Sally 1943-08-23 NULL 6
+8 Grandpa Ben 1940-10-21 NULL NULL
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+# 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;
+id name dob father mother
+100 Me 2000-01-01 20 30
+98 Sister Amy 2001-06-20 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
+7 Grandma Sally 1943-08-23 NULL 6
+8 Grandpa Ben 1940-10-21 NULL NULL
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+# 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;
+name dob
+Me 2000-01-01
+Dad 1970-02-02
+Mom 1975-03-03
+Grandpa Bill 1940-04-05
+Grandma Ann 1941-10-15
+Grandma Sally 1943-08-23
+Grandpa Ben 1940-10-21
+Grandgrandma Martha 1923-05-17
+# 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;
+name dob
+Me 2000-01-01
+Dad 1970-02-02
+Mom 1975-03-03
+Grandpa Bill 1940-04-05
+Grandpa Ben 1940-10-21
+Grandma Ann 1941-10-15
+Grandma Sally 1943-08-23
+Grandgrandma Martha 1923-05-17
+# simple recursion with one anchor and one recursive select
+# 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;
+id name dob father mother
+10 Grandpa Bill 1940-04-05 NULL NULL
+20 Dad 1970-02-02 10 9
+100 Me 2000-01-01 20 30
+98 Sister Amy 2001-06-20 20 30
+# simple recursion with one anchor and one recursive select
+# 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;
+id name dob father mother
+7 Grandma Sally 1943-08-23 NULL 6
+30 Mom 1975-03-03 8 7
+25 Uncle Jim 1968-11-18 8 7
+100 Me 2000-01-01 20 30
+98 Sister Amy 2001-06-20 20 30
+67 Cousin Eddie 1992-02-28 25 27
+# 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);
+id name dob father mother id name dob father mother
+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
+8 Grandpa Ben 1940-10-21 NULL NULL 7 Grandma Sally 1943-08-23 NULL 6
+# 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;
+husband h_dob wife w_dob
+Dad 1970-02-02 Mom 1975-03-03
+Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15
+Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23
+# 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;
+id name dob father mother
+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
+8 Grandpa Ben 1940-10-21 NULL NULL
+9 Grandma Ann 1941-10-15 NULL NULL
+7 Grandma Sally 1943-08-23 NULL 6
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+# 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;
+h_name h_dob w_name w_dob
+Dad 1970-02-02 Mom 1975-03-03
+Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15
+Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23
+# 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;
+h_name h_dob w_name w_dob
+Dad 1970-02-02 Mom 1975-03-03
+Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15
+Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23
+# 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;
+h_name h_dob w_name w_dob
+Dad 1970-02-02 Mom 1975-03-03
+Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15
+Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23
+# 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;
+h_name h_dob w_name w_dob
+Dad 1970-02-02 Mom 1975-03-03
+Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15
+Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23
+# 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;
+h_id w_id
+20 30
+10 9
+8 7
+# 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;
+name dob name dob
+Dad 1970-02-02 Mom 1975-03-03
+Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15
+Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23
+# 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;
+name dob name dob
+Dad 1970-02-02 Mom 1975-03-03
+Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15
+Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23
+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;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where
+1 PRIMARY <derived3> ref key0 key0 5 c.h_id 2 100.00
+1 PRIMARY <derived3> ref key0 key0 5 c.w_id 2 100.00
+2 DERIVED <derived3> ALL NULL NULL NULL NULL 12 100.00 Using where
+3 DERIVED folks ALL NULL NULL NULL NULL 12 100.00 Using where
+4 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00
+4 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join)
+5 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00
+5 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join)
+NULL UNION RESULT <union3,4,5> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 with recursive ancestor_couple_ids as (select `a`.`father` AS `h_id`,`a`.`mother` AS `w_id` from `coupled_ancestors` `a` where `a`.`father` is not null and `a`.`mother` is not null), coupled_ancestors as (select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' union all select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `fa` where `test`.`p`.`id` = `fa`.`h_id` union all select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `ma` where `test`.`p`.`id` = `ma`.`w_id`)select `h`.`name` AS `name`,`h`.`dob` AS `dob`,`w`.`name` AS `name`,`w`.`dob` AS `dob` from `ancestor_couple_ids` `c` join `coupled_ancestors` `h` join `coupled_ancestors` `w` where `h`.`id` = `c`.`h_id` and `w`.`id` = `c`.`w_id`
+# 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;
+h_id w_id
+20 30
+10 9
+8 7
+NULL NULL
+NULL NULL
+NULL NULL
+NULL 6
+NULL NULL
+# 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;
+name dob name dob
+Dad 1970-02-02 Mom 1975-03-03
+Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15
+Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23
+# 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;
+id name dob father mother
+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
+7 Grandma Sally 1943-08-23 NULL 6
+8 Grandpa Ben 1940-10-21 NULL NULL
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+execute stmt1;
+id name dob father mother
+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
+7 Grandma Sally 1943-08-23 NULL 6
+8 Grandpa Ben 1940-10-21 NULL NULL
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+deallocate prepare stmt1;
+# 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;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with recursive ancestors as (select `folks`.`id` AS `id`,`folks`.`name` AS `name`,`folks`.`dob` AS `dob`,`folks`.`father` AS `father`,`folks`.`mother` AS `mother` from `folks` where `folks`.`name` = 'Me' and `folks`.`dob` = '2000-01-01' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `a`) where `p`.`id` = `a`.`father` or `p`.`id` = `a`.`mother`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci
+select * from v1;
+id name dob father mother
+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
+7 Grandma Sally 1943-08-23 NULL 6
+8 Grandpa Ben 1940-10-21 NULL NULL
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+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;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with recursive ancestors as (select `folks`.`id` AS `id`,`folks`.`name` AS `name`,`folks`.`dob` AS `dob`,`folks`.`father` AS `father`,`folks`.`mother` AS `mother` from `folks` where `folks`.`name` = 'Me' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `fa`) where `p`.`id` = `fa`.`father` union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `ma`) where `p`.`id` = `ma`.`mother`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci
+select * from v2;
+id name dob father mother
+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
+8 Grandpa Ben 1940-10-21 NULL NULL
+9 Grandma Ann 1941-10-15 NULL NULL
+7 Grandma Sally 1943-08-23 NULL 6
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+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;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 12 100.00
+2 DERIVED folks ALL NULL NULL NULL NULL 12 100.00 Using where
+3 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00
+3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join)
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 with recursive ancestors as (select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' and `test`.`folks`.`dob` = DATE'2000-01-01' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestors` `a` where `a`.`father` = `p`.`id` or `a`.`mother` = `p`.`id`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors`
+# 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;
+id name dob father mother
+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
+7 Grandma Sally 1943-08-23 NULL 6
+8 Grandpa Ben 1940-10-21 NULL NULL
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+# 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;
+id name dob father mother
+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
+8 Grandpa Ben 1940-10-21 NULL NULL
+9 Grandma Ann 1941-10-15 NULL NULL
+7 Grandma Sally 1943-08-23 NULL 6
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+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;
+ERROR HY000: Restrictions imposed on recursive definitions are violated for table 'ancestor_ids'
+set standard_compliant_cte=0;
+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;
+ERROR HY000: WITH column list and SELECT field list have different column counts
+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;
+generation name
+1 Dad
+1 Mom
+2 Grandpa Bill
+2 Grandma Ann
+2 Grandma Sally
+2 Grandpa Ben
+3 Grandgrandma Martha
+set standard_compliant_cte=1;
+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 HY000: Restrictions imposed on recursive definitions are violated for table 'coupled_ancestor_ids'
+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;
+id name dob father mother
+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
+7 Grandma Sally 1943-08-23 NULL 6
+8 Grandpa Ben 1940-10-21 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 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;
+ERROR HY000: Restrictions imposed on recursive definitions are violated for table 'ancestor_ids'
+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;
+id name dob father mother
+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
+7 Grandma Sally 1943-08-23 NULL 6
+8 Grandpa Ben 1940-10-21 NULL NULL
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+27 Auntie Melinda 1971-03-29 NULL NULL
+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;
+generation name
+1 Dad
+1 Mom
+2 Grandpa Bill
+2 Grandma Ann
+2 Grandma Sally
+2 Grandpa Ben
+3 Grandgrandma Martha
+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;
+ERROR HY000: Restrictions imposed on recursive definitions are violated for table 'ancestor_ids'
+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;
+generation name
+1 Dad
+1 Mom
+2 Grandpa Bill
+2 Grandma Ann
+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;
+generation name
+1 Dad
+1 Mom
+2 Grandpa Bill
+2 Grandma Ann
+2 Grandma Sally
+2 Grandpa Ben
+# 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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 12
+2 DERIVED folks ALL NULL NULL NULL NULL 12 Using where
+3 RECURSIVE UNION p ALL PRIMARY NULL NULL NULL 12
+3 RECURSIVE UNION <derived2> ref key0 key0 5 test.p.id 2
+4 RECURSIVE UNION p ALL PRIMARY NULL NULL NULL 12
+4 RECURSIVE UNION <derived2> ref key0 key0 5 test.p.id 2
+NULL UNION RESULT <union2,3,4> ALL NULL NULL NULL NULL NULL
+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;
+id name dob father mother
+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
+8 Grandpa Ben 1940-10-21 NULL NULL
+9 Grandma Ann 1941-10-15 NULL NULL
+7 Grandma Sally 1943-08-23 NULL 6
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+#
+# EXPLAIN FORMAT=JSON on a query where one recursive CTE uses another:
+#
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived4> ALL NULL NULL NULL NULL 24
+4 DERIVED folks ALL NULL NULL NULL NULL 12 Using where
+6 RECURSIVE UNION <derived3> ALL NULL NULL NULL NULL 12
+3 DERIVED folks ALL NULL NULL NULL NULL 12 Using where
+2 RECURSIVE UNION folks ALL PRIMARY NULL NULL NULL 12
+2 RECURSIVE UNION <derived3> ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
+NULL UNION RESULT <union3,2> ALL NULL NULL NULL NULL NULL
+5 RECURSIVE UNION <derived4> ALL NULL NULL NULL NULL 24
+NULL UNION RESULT <union4,6,5> ALL NULL NULL NULL NULL NULL
+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;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 24,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "recursive_union": {
+ "table_name": "<union4,6,5>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 4,
+ "table": {
+ "table_name": "folks",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "folks.`name` = 'Me2'"
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 6,
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "prev_gen.`id` < 345",
+ "materialized": {
+ "query_block": {
+ "recursive_union": {
+ "table_name": "<union3,2>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "folks",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "folks.`name` = 'Me'"
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "folks",
+ "access_type": "ALL",
+ "possible_keys": ["PRIMARY"],
+ "rows": 12,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "prev_gen.father = folks.`id` or prev_gen.mother = folks.`id`"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 5,
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 24,
+ "filtered": 100,
+ "attached_condition": "ancestors.`id` < 234"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+#
+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;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "recursive_union": {
+ "table_name": "<union3,2>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "v",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "v.`name` = 'Me' and v.father is not null and v.mother is not null"
+ },
+ "table": {
+ "table_name": "h",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["id"],
+ "ref": ["test.v.father"],
+ "rows": 1,
+ "filtered": 100
+ },
+ "table": {
+ "table_name": "w",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["id"],
+ "ref": ["test.v.mother"],
+ "rows": 1,
+ "filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "a.father is not null and a.mother is not null"
+ },
+ "table": {
+ "table_name": "h",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["id"],
+ "ref": ["a.father"],
+ "rows": 1,
+ "filtered": 100
+ },
+ "table": {
+ "table_name": "w",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["id"],
+ "ref": ["a.mother"],
+ "rows": 1,
+ "filtered": 100
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+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;
+id name dob father mother
+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
+7 Grandma Sally 1943-08-23 NULL 6
+8 Grandpa Ben 1940-10-21 NULL NULL
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+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;
+id name dob father mother
+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
+7 Grandma Sally 1943-08-23 NULL 6
+8 Grandpa Ben 1940-10-21 NULL NULL
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+drop table my_ancestors;
+#
+# MDEV-10883: execution of prepared statement from SELECT
+# with recursive CTE that renames columns
+#
+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;
+id name dob father mother
+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
+7 Grandma Sally 1943-08-23 NULL 6
+8 Grandpa Ben 1940-10-21 NULL NULL
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+deallocate prepare stmt;
+#
+# MDEV-10881: execution of prepared statement from
+# CREATE ... SELECT, INSERT ... SELECT
+#
+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;
+id name dob father mother
+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
+7 Grandma Sally 1943-08-23 NULL 6
+8 Grandpa Ben 1940-10-21 NULL NULL
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+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;
+id name dob father mother
+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
+7 Grandma Sally 1943-08-23 NULL 6
+8 Grandpa Ben 1940-10-21 NULL NULL
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+drop table my_ancestors;
+#
+# MDEV-10933: WITH clause together with SELECT in parenthesis
+# CREATE SELECT
+#
+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;
+id name dob father mother
+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
+7 Grandma Sally 1943-08-23 NULL 6
+8 Grandpa Ben 1940-10-21 NULL NULL
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+drop table my_ancestors;
+drop table folks;
+#
+# MDEV-10372: [bb-10.2-mdev9864 tree] EXPLAIN with recursive CTE enters endless recursion
+#
+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;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "recursive_union": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t.a < 1000"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+drop table t1;
+#
+# MDEV-10737: recursive union with several anchors at the end
+#
+WITH RECURSIVE cte(n) AS
+( SELECT n+1 FROM cte WHERE n < 5 UNION SELECT 1 UNION SELECT 1 )
+SELECT * FROM cte;
+n
+1
+2
+3
+4
+5
+#
+# MDEV-10736: recursive definition with anchor over a table with blob
+#
+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;
+f
+DROP TABLE t1;
+#
+# MDEV-10899: mergeable derived in the spec of recursive CTE
+#
+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;
+a
+3
+4
+5
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5
+2 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where
+4 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 5
+4 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
+NULL UNION RESULT <union2,4> ALL NULL NULL NULL NULL NULL
+drop table t1,t2;
+#
+# MDEV-11278: non-mergeable view in the spec of recursive CTE
+#
+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;
+a
+1
+2
+drop view v1;
+drop table t1,t2;
+#
+# MDEV-11259: recursive CTE with concatenation operation
+#
+DROP TABLE IF EXISTS edges;
+Warnings:
+Note 1051 Unknown table 'test.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;
+Warnings:
+Note 1051 Unknown table 'test.edges2'
+CREATE VIEW edges2 (a, b) AS
+SELECT a, b FROM edges UNION ALL SELECT b, a FROM edges;
+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;
+a b distance path_string
+1 3 1 1.3.
+1 4 2 1.3.4.
+1 5 2 1.3.5.
+1 6 2 1.3.6.
+1 6 3 1.3.5.6.
+1 7 3 1.3.4.7.
+2 1 1 2.1.
+2 3 2 2.1.3.
+2 4 1 2.4.
+2 4 3 2.1.3.4.
+2 5 3 2.1.3.5.
+2 6 3 2.1.3.6.
+2 6 4 2.1.3.5.6.
+2 7 2 2.4.7.
+2 7 4 2.1.3.4.7.
+3 1 2 3.5.1.
+3 1 2 3.6.1.
+3 1 3 3.5.6.1.
+3 4 1 3.4.
+3 5 1 3.5.
+3 6 1 3.6.
+3 6 2 3.5.6.
+3 7 2 3.4.7.
+4 7 1 4.7.
+5 1 1 5.1.
+5 1 2 5.6.1.
+5 3 2 5.1.3.
+5 3 3 5.6.1.3.
+5 4 3 5.1.3.4.
+5 4 4 5.6.1.3.4.
+5 6 1 5.6.
+5 6 3 5.1.3.6.
+5 7 4 5.1.3.4.7.
+5 7 5 5.6.1.3.4.7.
+6 1 1 6.1.
+6 3 2 6.1.3.
+6 4 3 6.1.3.4.
+6 5 3 6.1.3.5.
+6 7 4 6.1.3.4.7.
+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;
+a b distance path_string
+1 6 2 1.3.6.
+1 6 3 1.3.5.6.
+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;
+a b distance path_string
+1 2 1 1.2.
+1 2 3 1.3.4.2.
+1 2 4 1.5.3.4.2.
+1 2 4 1.6.3.4.2.
+1 2 5 1.5.6.3.4.2.
+1 2 5 1.6.5.3.4.2.
+1 3 1 1.3.
+1 3 2 1.5.3.
+1 3 2 1.6.3.
+1 3 3 1.2.4.3.
+1 3 3 1.5.6.3.
+1 3 3 1.6.5.3.
+1 4 2 1.2.4.
+1 4 2 1.3.4.
+1 4 3 1.5.3.4.
+1 4 3 1.6.3.4.
+1 4 4 1.5.6.3.4.
+1 4 4 1.6.5.3.4.
+1 5 1 1.5.
+1 5 2 1.3.5.
+1 5 2 1.6.5.
+1 5 3 1.3.6.5.
+1 5 3 1.6.3.5.
+1 5 4 1.2.4.3.5.
+1 5 5 1.2.4.3.6.5.
+1 6 1 1.6.
+1 6 2 1.3.6.
+1 6 2 1.5.6.
+1 6 3 1.3.5.6.
+1 6 3 1.5.3.6.
+1 6 4 1.2.4.3.6.
+1 6 5 1.2.4.3.5.6.
+1 7 3 1.2.4.7.
+1 7 3 1.3.4.7.
+1 7 4 1.5.3.4.7.
+1 7 4 1.6.3.4.7.
+1 7 5 1.5.6.3.4.7.
+1 7 5 1.6.5.3.4.7.
+2 1 1 2.1.
+2 1 3 2.4.3.1.
+2 1 4 2.4.3.5.1.
+2 1 4 2.4.3.6.1.
+2 1 5 2.4.3.5.6.1.
+2 1 5 2.4.3.6.5.1.
+2 3 2 2.1.3.
+2 3 2 2.4.3.
+2 3 3 2.1.5.3.
+2 3 3 2.1.6.3.
+2 3 4 2.1.5.6.3.
+2 3 4 2.1.6.5.3.
+2 4 1 2.4.
+2 4 3 2.1.3.4.
+2 4 4 2.1.5.3.4.
+2 4 4 2.1.6.3.4.
+2 4 5 2.1.5.6.3.4.
+2 4 5 2.1.6.5.3.4.
+2 5 2 2.1.5.
+2 5 3 2.1.3.5.
+2 5 3 2.1.6.5.
+2 5 3 2.4.3.5.
+2 5 4 2.1.3.6.5.
+2 5 4 2.1.6.3.5.
+2 5 4 2.4.3.1.5.
+2 5 4 2.4.3.6.5.
+2 5 5 2.4.3.1.6.5.
+2 5 5 2.4.3.6.1.5.
+2 6 2 2.1.6.
+2 6 3 2.1.3.6.
+2 6 3 2.1.5.6.
+2 6 3 2.4.3.6.
+2 6 4 2.1.3.5.6.
+2 6 4 2.1.5.3.6.
+2 6 4 2.4.3.1.6.
+2 6 4 2.4.3.5.6.
+2 6 5 2.4.3.1.5.6.
+2 6 5 2.4.3.5.1.6.
+2 7 2 2.4.7.
+2 7 4 2.1.3.4.7.
+2 7 5 2.1.5.3.4.7.
+2 7 5 2.1.6.3.4.7.
+2 7 6 2.1.5.6.3.4.7.
+2 7 6 2.1.6.5.3.4.7.
+3 1 1 3.1.
+3 1 2 3.5.1.
+3 1 2 3.6.1.
+3 1 3 3.4.2.1.
+3 1 3 3.5.6.1.
+3 1 3 3.6.5.1.
+3 2 2 3.1.2.
+3 2 2 3.4.2.
+3 2 3 3.5.1.2.
+3 2 3 3.6.1.2.
+3 2 4 3.5.6.1.2.
+3 2 4 3.6.5.1.2.
+3 4 1 3.4.
+3 4 3 3.1.2.4.
+3 4 4 3.5.1.2.4.
+3 4 4 3.6.1.2.4.
+3 4 5 3.5.6.1.2.4.
+3 4 5 3.6.5.1.2.4.
+3 5 1 3.5.
+3 5 2 3.1.5.
+3 5 2 3.6.5.
+3 5 3 3.1.6.5.
+3 5 3 3.6.1.5.
+3 5 4 3.4.2.1.5.
+3 5 5 3.4.2.1.6.5.
+3 6 1 3.6.
+3 6 2 3.1.6.
+3 6 2 3.5.6.
+3 6 3 3.1.5.6.
+3 6 3 3.5.1.6.
+3 6 4 3.4.2.1.6.
+3 6 5 3.4.2.1.5.6.
+3 7 2 3.4.7.
+3 7 4 3.1.2.4.7.
+3 7 5 3.5.1.2.4.7.
+3 7 5 3.6.1.2.4.7.
+3 7 6 3.5.6.1.2.4.7.
+3 7 6 3.6.5.1.2.4.7.
+4 1 2 4.2.1.
+4 1 2 4.3.1.
+4 1 3 4.3.5.1.
+4 1 3 4.3.6.1.
+4 1 4 4.3.5.6.1.
+4 1 4 4.3.6.5.1.
+4 2 1 4.2.
+4 2 3 4.3.1.2.
+4 2 4 4.3.5.1.2.
+4 2 4 4.3.6.1.2.
+4 2 5 4.3.5.6.1.2.
+4 2 5 4.3.6.5.1.2.
+4 3 1 4.3.
+4 3 3 4.2.1.3.
+4 3 4 4.2.1.5.3.
+4 3 4 4.2.1.6.3.
+4 3 5 4.2.1.5.6.3.
+4 3 5 4.2.1.6.5.3.
+4 5 2 4.3.5.
+4 5 3 4.2.1.5.
+4 5 3 4.3.1.5.
+4 5 3 4.3.6.5.
+4 5 4 4.2.1.3.5.
+4 5 4 4.2.1.6.5.
+4 5 4 4.3.1.6.5.
+4 5 4 4.3.6.1.5.
+4 5 5 4.2.1.3.6.5.
+4 5 5 4.2.1.6.3.5.
+4 6 2 4.3.6.
+4 6 3 4.2.1.6.
+4 6 3 4.3.1.6.
+4 6 3 4.3.5.6.
+4 6 4 4.2.1.3.6.
+4 6 4 4.2.1.5.6.
+4 6 4 4.3.1.5.6.
+4 6 4 4.3.5.1.6.
+4 6 5 4.2.1.3.5.6.
+4 6 5 4.2.1.5.3.6.
+4 7 1 4.7.
+5 1 1 5.1.
+5 1 2 5.3.1.
+5 1 2 5.6.1.
+5 1 3 5.3.6.1.
+5 1 3 5.6.3.1.
+5 1 4 5.3.4.2.1.
+5 1 5 5.6.3.4.2.1.
+5 2 2 5.1.2.
+5 2 3 5.3.1.2.
+5 2 3 5.3.4.2.
+5 2 3 5.6.1.2.
+5 2 4 5.1.3.4.2.
+5 2 4 5.3.6.1.2.
+5 2 4 5.6.3.1.2.
+5 2 4 5.6.3.4.2.
+5 2 5 5.1.6.3.4.2.
+5 2 5 5.6.1.3.4.2.
+5 3 1 5.3.
+5 3 2 5.1.3.
+5 3 2 5.6.3.
+5 3 3 5.1.6.3.
+5 3 3 5.6.1.3.
+5 3 4 5.1.2.4.3.
+5 3 5 5.6.1.2.4.3.
+5 4 2 5.3.4.
+5 4 3 5.1.2.4.
+5 4 3 5.1.3.4.
+5 4 3 5.6.3.4.
+5 4 4 5.1.6.3.4.
+5 4 4 5.3.1.2.4.
+5 4 4 5.6.1.2.4.
+5 4 4 5.6.1.3.4.
+5 4 5 5.3.6.1.2.4.
+5 4 5 5.6.3.1.2.4.
+5 6 1 5.6.
+5 6 2 5.1.6.
+5 6 2 5.3.6.
+5 6 3 5.1.3.6.
+5 6 3 5.3.1.6.
+5 6 5 5.1.2.4.3.6.
+5 6 5 5.3.4.2.1.6.
+5 7 3 5.3.4.7.
+5 7 4 5.1.2.4.7.
+5 7 4 5.1.3.4.7.
+5 7 4 5.6.3.4.7.
+5 7 5 5.1.6.3.4.7.
+5 7 5 5.3.1.2.4.7.
+5 7 5 5.6.1.2.4.7.
+5 7 5 5.6.1.3.4.7.
+5 7 6 5.3.6.1.2.4.7.
+5 7 6 5.6.3.1.2.4.7.
+6 1 1 6.1.
+6 1 2 6.3.1.
+6 1 2 6.5.1.
+6 1 3 6.3.5.1.
+6 1 3 6.5.3.1.
+6 1 4 6.3.4.2.1.
+6 1 5 6.5.3.4.2.1.
+6 2 2 6.1.2.
+6 2 3 6.3.1.2.
+6 2 3 6.3.4.2.
+6 2 3 6.5.1.2.
+6 2 4 6.1.3.4.2.
+6 2 4 6.3.5.1.2.
+6 2 4 6.5.3.1.2.
+6 2 4 6.5.3.4.2.
+6 2 5 6.1.5.3.4.2.
+6 2 5 6.5.1.3.4.2.
+6 3 1 6.3.
+6 3 2 6.1.3.
+6 3 2 6.5.3.
+6 3 3 6.1.5.3.
+6 3 3 6.5.1.3.
+6 3 4 6.1.2.4.3.
+6 3 5 6.5.1.2.4.3.
+6 4 2 6.3.4.
+6 4 3 6.1.2.4.
+6 4 3 6.1.3.4.
+6 4 3 6.5.3.4.
+6 4 4 6.1.5.3.4.
+6 4 4 6.3.1.2.4.
+6 4 4 6.5.1.2.4.
+6 4 4 6.5.1.3.4.
+6 4 5 6.3.5.1.2.4.
+6 4 5 6.5.3.1.2.4.
+6 5 1 6.5.
+6 5 2 6.1.5.
+6 5 2 6.3.5.
+6 5 3 6.1.3.5.
+6 5 3 6.3.1.5.
+6 5 5 6.1.2.4.3.5.
+6 5 5 6.3.4.2.1.5.
+6 7 3 6.3.4.7.
+6 7 4 6.1.2.4.7.
+6 7 4 6.1.3.4.7.
+6 7 4 6.5.3.4.7.
+6 7 5 6.1.5.3.4.7.
+6 7 5 6.3.1.2.4.7.
+6 7 5 6.5.1.2.4.7.
+6 7 5 6.5.1.3.4.7.
+6 7 6 6.3.5.1.2.4.7.
+6 7 6 6.5.3.1.2.4.7.
+7 1 3 7.4.2.1.
+7 1 3 7.4.3.1.
+7 1 4 7.4.3.5.1.
+7 1 4 7.4.3.6.1.
+7 1 5 7.4.3.5.6.1.
+7 1 5 7.4.3.6.5.1.
+7 2 2 7.4.2.
+7 2 4 7.4.3.1.2.
+7 2 5 7.4.3.5.1.2.
+7 2 5 7.4.3.6.1.2.
+7 2 6 7.4.3.5.6.1.2.
+7 2 6 7.4.3.6.5.1.2.
+7 3 2 7.4.3.
+7 3 4 7.4.2.1.3.
+7 3 5 7.4.2.1.5.3.
+7 3 5 7.4.2.1.6.3.
+7 3 6 7.4.2.1.5.6.3.
+7 3 6 7.4.2.1.6.5.3.
+7 4 1 7.4.
+7 5 3 7.4.3.5.
+7 5 4 7.4.2.1.5.
+7 5 4 7.4.3.1.5.
+7 5 4 7.4.3.6.5.
+7 5 5 7.4.2.1.3.5.
+7 5 5 7.4.2.1.6.5.
+7 5 5 7.4.3.1.6.5.
+7 5 5 7.4.3.6.1.5.
+7 5 6 7.4.2.1.3.6.5.
+7 5 6 7.4.2.1.6.3.5.
+7 6 3 7.4.3.6.
+7 6 4 7.4.2.1.6.
+7 6 4 7.4.3.1.6.
+7 6 4 7.4.3.5.6.
+7 6 5 7.4.2.1.3.6.
+7 6 5 7.4.2.1.5.6.
+7 6 5 7.4.3.1.5.6.
+7 6 5 7.4.3.5.1.6.
+7 6 6 7.4.2.1.3.5.6.
+7 6 6 7.4.2.1.5.3.6.
+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;
+a b dist
+1 2 1
+1 3 1
+1 4 2
+1 5 1
+1 6 1
+1 7 3
+2 1 1
+2 3 2
+2 4 1
+2 5 2
+2 6 2
+2 7 2
+3 1 1
+3 2 2
+3 4 1
+3 5 1
+3 6 1
+3 7 2
+4 1 2
+4 2 1
+4 3 1
+4 5 2
+4 6 2
+4 7 1
+5 1 1
+5 2 2
+5 3 1
+5 4 2
+5 6 1
+5 7 3
+6 1 1
+6 2 2
+6 3 1
+6 4 2
+6 5 1
+6 7 3
+7 1 3
+7 2 2
+7 3 2
+7 4 1
+7 5 3
+7 6 3
+DROP VIEW edges2;
+DROP TABLE edges;
+#
+# MDEV-11674: recursive CTE table that cannot be stored
+# in a heap table
+#
+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;
+#
+# MDEV-10773: ANALYZE for query with recursive CTE
+#
+analyze format=json
+with recursive src(counter) as
+(select 1
+union
+select counter+1 from src where counter<10
+) select * from src;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 10,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "recursive_union": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "r_rows": null,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "message": "No tables used"
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "r_loops": 10,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 10,
+ "rows": 2,
+ "r_rows": 1,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 90,
+ "attached_condition": "src.counter < 10"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+#
+# mdev-12360: recursive reference in left operand of LEFT JOIN
+#
+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;
+id name dob father mother
+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
+7 Grandma Sally 1943-08-23 NULL 6
+8 Grandpa Ben 1940-10-21 NULL NULL
+6 Grandgrandma Martha 1923-05-17 NULL NULL
+drop table folks;
+#
+# mdev-12368: crash with mutually recursive CTE
+# that arenot Standard compliant
+#
+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));
+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;
+ERROR HY000: Restrictions imposed on recursive definitions are violated for table 'applied_modules'
+drop table value_nodes, module_nodes, module_arguments, module_results;
+#
+# mdev-12375: query using one of two mutually recursive CTEs
+# whose non-recursive part returns an empty set
+#
+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;
+m
+m1
+m2
+drop table value_nodes, module_nodes, module_arguments, module_results;
+#
+# mdev-12519: recursive references in subqueries
+#
+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;
+p
+p1
+p2
+p3
+p7
+p4
+p8
+p5
+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;
+p
+p1
+p2
+p3
+p7
+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;
+p
+p1
+p2
+p3
+p7
+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;
+p
+p1
+p2
+p3
+p7
+execute stmt;
+p
+p1
+p2
+p3
+p7
+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;
+v m
+v3 init
+v7 init
+v9 init
+v4 m1
+v1 m2
+v6 m2
+v10 m3
+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;
+v m
+v3 init
+v7 init
+v9 init
+v4 m1
+v1 m2
+v6 m2
+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;
+v m
+v3 init
+v7 init
+v9 init
+v4 m1
+v1 m2
+v6 m2
+execute stmt;
+v m
+v3 init
+v7 init
+v9 init
+v4 m1
+v1 m2
+v6 m2
+deallocate prepare stmt;
+drop table objects, modules, module_arguments, module_results;
+set standard_compliant_cte=default;
+select @@standard_compliant_cte;
+@@standard_compliant_cte
+1
+#
+# mdev-12554: impossible where in recursive select
+#
+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;
+f
+1
+2
+DROP TABLE t1;
+#
+# mdev-12556: recursive execution uses Aria temporary tables
+#
+CREATE TABLE t (c1 varchar(255), c2 tinytext);
+INSERT INTO t VALUES ('a','a'),('b','b'),('c','c'),('d','d');
+ANALYZE WITH RECURSIVE cte(f) AS (
+SELECT c1 FROM t
+UNION
+SELECT c1 FROM t, cte
+) SELECT COUNT(*) FROM cte;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
+2 DERIVED t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
+3 RECURSIVE UNION t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
+3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 Using join buffer (flat, BNL join)
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL
+WITH RECURSIVE cte(f) AS (
+SELECT c1 FROM t
+UNION
+SELECT c1 FROM t, cte
+) SELECT COUNT(*) FROM cte;
+COUNT(*)
+4
+ANALYZE WITH RECURSIVE cte(f) AS (
+SELECT c2 FROM t
+UNION
+SELECT c2 FROM t, cte
+) SELECT COUNT(*) FROM cte;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
+2 DERIVED t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
+3 RECURSIVE UNION t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
+3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 Using join buffer (flat, BNL join)
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL
+WITH RECURSIVE cte(f) AS (
+SELECT c2 FROM t
+UNION
+SELECT c2 FROM t, cte
+) SELECT COUNT(*) FROM cte;
+COUNT(*)
+4
+DROP TABLE t;
+#
+# mdev-12563: no recursive references on the top level of the CTE spec
+#
+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;
+f
+3
+1
+2
+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;
+f
+3
+1
+2
+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;
+f
+3
+1
+2
+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;
+f
+3
+1
+2
+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;
+f
+3
+1
+2
+set standard_compliant_cte=default;
+DROP TABLE t;
+#
+# mdev-14184: recursive CTE embedded into CTE with multiple references
+#
+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;
+n
+1
+2
+3
+#
+# mdev-14629: a user-defined variable is defined by the recursive CTE
+#
+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;
+@var
+3
+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;
+@var
+27
+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
+);
+ERROR HY000: Unacceptable mutual recursion with anchored table 'cte_1'
+drop table t1;
+#
+# mdev-14777: crash caused by the same as in mdev-14755
+#
+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;
+C P i
+drop table t1,t2,t3;
+#
+# mdev-14879: subquery with recursive reference in WHERE of CTE
+#
+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;
+city
+Paris
+Chicago
+New York
+Montreal
+Seattle
+Frankfurt
+Los Angeles
+Moscow
+Tokyo
+set standard_compliant_cte=0;
+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;
+city legs
+Paris 1
+Chicago 2
+New York 3
+Montreal 3
+Seattle 4
+Frankfurt 5
+Los Angeles 5
+Moscow 6
+Tokyo 6
+explain extended 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;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 16 100.00
+2 DERIVED a ALL NULL NULL NULL NULL 16 100.00 Using where
+3 RECURSIVE UNION b ALL NULL NULL NULL NULL 16 100.00 Using where
+3 RECURSIVE UNION <derived2> ref key0 key0 35 test.b.departure 2 100.00
+4 DEPENDENT SUBQUERY <derived2> ALL NULL NULL NULL NULL 16 100.00 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 with recursive destinations as (select `test`.`a`.`arrival` AS `city`,1 AS `legs` from `test`.`flights` `a` where `test`.`a`.`departure` = 'Cairo' union select `test`.`b`.`arrival` AS `arrival`,`r`.`legs` + 1 AS `r.legs + 1` from `destinations` `r` join `test`.`flights` `b` where `r`.`city` = `test`.`b`.`departure` and !<in_optimizer>(`test`.`b`.`arrival`,<exists>(select `destinations`.`city` from `destinations` where trigcond(`test`.`b`.`arrival` = `destinations`.`city` or `destinations`.`city` is null) having trigcond(`destinations`.`city` is null))))select `destinations`.`city` AS `city`,`destinations`.`legs` AS `legs` from `destinations`
+set standard_compliant_cte=default;
+drop table flights;
+#
+# MDEV-15162: Setting user variable in recursive CTE
+#
+SET @c=1;
+WITH RECURSIVE cte AS
+(SELECT 5
+UNION
+SELECT @c:=@c+1 FROM cte WHERE @c<3)
+SELECT * FROM cte;
+5
+5
+2
+3
+#
+# MDEV-15575: using recursive cte with big_tables enabled
+#
+set big_tables=1;
+with recursive qn as
+(select 123 as a union all select 1+a from qn where a<130)
+select * from qn;
+a
+123
+124
+125
+126
+127
+128
+129
+130
+set big_tables=default;
+#
+# MDEV-15571: using recursive cte with big_tables enabled
+#
+create table t1 (a bigint);
+insert into t1 values(1);
+set big_tables=1;
+with recursive qn as
+(
+select a from t1
+union all
+select a*2000 from qn where a<10000000000000000000
+)
+select * from qn;
+ERROR 22003: BIGINT value is out of range in '`qn`.`a` * 2000'
+set big_tables=default;
+drop table t1;
+#
+# MDEV-15556: using recursive cte with big_tables enabled
+# when recursive tables are accessed by key
+#
+SET big_tables=1;
+CREATE TABLE t1 (id int, name char(10), leftpar int, rightpar int);
+INSERT INTO t1 VALUES
+(1, "A", 2, 3), (2, "LA", 4, 5), (4, "LLA", 6, 7),
+(6, "LLLA", NULL, NULL), (7, "RLLA", NULL, NULL), (5, "RLA", 8, 9),
+(8, "LRLA", NULL, NULL), (9, "RRLA", NULL, NULL), (3, "RA", 10, 11),
+(10, "LRA", 12, 13), (11, "RRA", 14, 15), (15, "RRRA", NULL, NULL),
+(16, "B", 17, 18), (17, "LB", NULL, NULL), (18, "RB", NULL, NULL);
+CREATE TABLE t2 SELECT * FROM t1 ORDER BY rand();
+WITH RECURSIVE tree_of_a AS
+(SELECT *, cast(id AS char(200)) AS path FROM t2 WHERE name="A"
+ UNION ALL
+SELECT t2.*, concat(tree_of_a.path,",",t2.id)
+FROM t2 JOIN tree_of_a ON t2.id=tree_of_a.leftpar
+UNION ALL
+SELECT t2.*, concat(tree_of_a.path,",",t2.id)
+FROM t2 JOIN tree_of_a ON t2.id=tree_of_a.rightpar)
+SELECT * FROM tree_of_a
+ORDER BY path;
+id name leftpar rightpar path
+1 A 2 3 1
+2 LA 4 5 1,2
+4 LLA 6 7 1,2,4
+6 LLLA NULL NULL 1,2,4,6
+7 RLLA NULL NULL 1,2,4,7
+5 RLA 8 9 1,2,5
+8 LRLA NULL NULL 1,2,5,8
+9 RRLA NULL NULL 1,2,5,9
+3 RA 10 11 1,3
+10 LRA 12 13 1,3,10
+11 RRA 14 15 1,3,11
+15 RRRA NULL NULL 1,3,11,15
+EXPLAIN WITH RECURSIVE tree_of_a AS
+(SELECT *, cast(id AS char(200)) AS path FROM t2 WHERE name="A"
+ UNION ALL
+SELECT t2.*, concat(tree_of_a.path,",",t2.id)
+FROM t2 JOIN tree_of_a ON t2.id=tree_of_a.leftpar
+UNION ALL
+SELECT t2.*, concat(tree_of_a.path,",",t2.id)
+FROM t2 JOIN tree_of_a ON t2.id=tree_of_a.rightpar)
+SELECT * FROM tree_of_a
+ORDER BY path;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 15 Using filesort
+2 DERIVED t2 ALL NULL NULL NULL NULL 15 Using where
+3 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 15 Using where
+3 RECURSIVE UNION <derived2> ref key0 key0 5 test.t2.id 2
+4 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 15 Using where
+4 RECURSIVE UNION <derived2> ref key0 key0 5 test.t2.id 2
+NULL UNION RESULT <union2,3,4> ALL NULL NULL NULL NULL NULL
+DROP TABLE t1,t2;
+SET big_tables=0;
+#
+# MDEV-15840: recursive tables are accessed by key
+# (the same problem as for MDEV-15556)
+#
+CREATE TABLE t1 (p1 text,k2 int, p2 text, k1 int);
+INSERT INTO t1 select seq, seq, seq, seq from seq_1_to_1000;
+CREATE PROCEDURE getNums()
+BEGIN
+WITH RECURSIVE cte as
+(
+SELECT * FROM t1
+UNION
+SELECT c.* FROM t1 c JOIN cte p ON c.p1 = p.p2 AND c.k2 = p.k1
+)
+SELECT * FROM cte LIMIT 10;
+END |
+call getNums();
+p1 k2 p2 k1
+1 1 1 1
+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
+10 10 10 10
+DROP PROCEDURE getNums;
+DROP TABLE t1;
+#
+# MDEV-15894: aggregate/winfow functions in non-recorsive part
+#
+create table t1(b int);
+insert into t1 values(10),(20),(10);
+with recursive qn as
+(select max(b) as a from t1 union
+select a from qn)
+select * from qn;
+a
+20
+with recursive qn as
+(select rank() over (order by b) as a from t1 union
+select a from qn)
+select * from qn;
+a
+1
+3
+drop table t1;
+#
+# MDEV-16086: tmp table for CTE is created as ARIA tables
+#
+CREATE TABLE t1 (
+Id int(11) not null AUTO_INCREMENT,
+Parent varchar(15) not null,
+Child varchar(15) not null,
+PRIMARY KEY (Id)
+) ENGINE = MyISAM;
+INSERT INTO t1 (Parent, Child) VALUES
+('123', '456'),('456', '789'),('321', '654'),('654', '987');
+WITH RECURSIVE cte AS
+( SELECT b.Parent,
+b.Child,
+CAST(CONCAT(b.Child,',') AS CHAR(513)) Path
+FROM t1 b
+LEFT OUTER JOIN t1 bc ON b.Child = bc.Parent
+WHERE bc.Id IS NULL
+UNION ALL SELECT c.Parent,
+c.Child,
+CONCAT(p.Path,c.Child,',') Path
+FROM t1 c
+INNER JOIN cte p ON c.Child = p.Parent)
+SELECT *
+FROM cte
+ORDER BY Path;
+Parent Child Path
+456 789 789,
+123 456 789,456,
+654 987 987,
+321 654 987,654,
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
index f97d060d26a..2db4da51667 100644
--- a/mysql-test/r/ctype_big5.result
+++ b/mysql-test/r/ctype_big5.result
@@ -55,7 +55,7 @@ want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
-insert into t1 values (),();
+insert ignore into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
@@ -224,30 +224,18 @@ CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
hex(concat(repeat(0xF1F2, 10), '%'))
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
a hex(b) c
-2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
+2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
drop table if exists t1;
create table t1 select repeat('a',10) as c1;
@@ -329,6 +317,21 @@ _ 5F
} 7D
 7F
drop table t1;
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+-1 1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+-1 1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+-1 1
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+-1 1
SET collation_connection='big5_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -451,31 +454,34 @@ CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
hex(concat(repeat(0xF1F2, 10), '%'))
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
a hex(b) c
-2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
+2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+-1 1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+-1 1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+-1 1
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+-1 1
SET NAMES big5;
CREATE TABLE t1 (a text) character set big5;
INSERT INTO t1 VALUES ('ùØ');
@@ -557,7 +563,7 @@ t1 CREATE TABLE `t1` (
SELECT COUNT(*) FROM t1;
COUNT(*)
28672
-UPDATE t1 SET a=unhex(code) ORDER BY code;
+UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
Warnings:
Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1
Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2
@@ -970,7 +976,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET big5 NOT NULL
+ `a` varchar(5) CHARACTER SET big5 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1229,7 +1235,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET big5 COLLATE big5_bin NOT NULL
+ `a` varchar(5) CHARACTER SET big5 COLLATE big5_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1467,6 +1473,7 @@ A1A1A1A1A1A120202020202020202020202020202020202020
# Start of 10.0 tests
#
# Start of ctype_unescape.inc
+SET sql_mode = '';
SET @query=_binary'SELECT CHARSET(\'test\'),@@character_set_client,@@character_set_connection';
PREPARE stmt FROM @query;
EXECUTE stmt;
@@ -4529,6 +4536,7 @@ DROP FUNCTION wellformedness;
DROP FUNCTION mysql_real_escape_string_generated;
DROP FUNCTION iswellformed;
DROP TABLE allbytes;
+SET sql_mode = DEFAULT;
# End of ctype_backslash.inc
SET NAMES big5;
# Start of ctype_E05C.inc
@@ -4572,7 +4580,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET big5 NOT NULL
+ `a` varchar(10) CHARACTER SET big5 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\'),('à\t');
INSERT INTO t1 VALUES ('\\à\'),('\\à\t'),('\\à\t\t');
@@ -4611,7 +4619,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET big5 NOT NULL
+ `a` varchar(10) CHARACTER SET big5 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (BINARY('à\')),(BINARY('à\t'));
INSERT INTO t1 VALUES (BINARY('\\à\')),(BINARY('\\à\t')),(BINARY('\\à\t\t'));
@@ -4650,7 +4658,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET big5 NOT NULL
+ `a` varchar(10) CHARACTER SET big5 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_BINARY'à\'),(_BINARY'à\t');
INSERT INTO t1 VALUES (_BINARY'\\à\'),(_BINARY'\\à\t'),(_BINARY'\\à\t\t');
@@ -4696,7 +4704,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET big5 NOT NULL
+ `a` varchar(10) CHARACTER SET big5 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\['),('\à\[');
SELECT HEX(a) FROM t1;
@@ -4716,7 +4724,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varbinary(10) NOT NULL
+ `a` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\['),('\à\[');
SELECT HEX(a) FROM t1;
@@ -4800,3 +4808,567 @@ DROP TABLE t1;
#
# End of 10.0 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET character_set_connection=big5;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_chinese_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE big5_chinese_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=big5 COLLATE=big5_chinese_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'big5_chinese_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_chinese_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'big5_chinese_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_chinese_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'big5_chinese_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_chinese_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE big5_chinese_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=big5 COLLATE=big5_chinese_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'big5_chinese_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_chinese_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'big5_chinese_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'big5_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'big5_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'big5_chinese_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_chinese_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'big5_chinese_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_chinese_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE big5_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=big5 COLLATE=big5_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'big5_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'big5_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'big5_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'big5_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE big5_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=big5 COLLATE=big5_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'big5_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'big5_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'big5_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'big5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'big5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'big5_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'big5_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'big5_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'big5_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'big5_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result
index 512368a2d26..976c3df6e0e 100644
--- a/mysql-test/r/ctype_binary.result
+++ b/mysql-test/r/ctype_binary.result
@@ -13,7 +13,7 @@ create table t1 as select concat(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -26,7 +26,7 @@ create table t1 as select concat(18446744073709551615) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(20) NOT NULL
+ `c1` varbinary(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -39,7 +39,7 @@ create table t1 as select concat(1.1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(4) NOT NULL
+ `c1` varbinary(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -52,7 +52,7 @@ create table t1 as select concat(1+2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(3) NOT NULL
+ `c1` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1-2));
@@ -62,7 +62,7 @@ create table t1 as select concat(1-2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(3) NOT NULL
+ `c1` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1*2));
@@ -72,7 +72,7 @@ create table t1 as select concat(1*2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(3) NOT NULL
+ `c1` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1/2));
@@ -112,7 +112,7 @@ create table t1 as select concat(-1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(2) NOT NULL
+ `c1` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(-(1+2)));
@@ -122,7 +122,7 @@ create table t1 as select concat(-(1+2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(4) NOT NULL
+ `c1` varbinary(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1|2));
@@ -132,7 +132,7 @@ create table t1 as select concat(1|2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(21) NOT NULL
+ `c1` varbinary(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1&2));
@@ -142,7 +142,7 @@ create table t1 as select concat(1&2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(21) NOT NULL
+ `c1` varbinary(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_count(12)));
@@ -152,7 +152,7 @@ create table t1 as select concat(bit_count(12)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(2) NOT NULL
+ `c1` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2<<1));
@@ -162,7 +162,7 @@ create table t1 as select concat(2<<1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(21) NOT NULL
+ `c1` varbinary(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2>>1));
@@ -172,7 +172,7 @@ create table t1 as select concat(2>>1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(21) NOT NULL
+ `c1` varbinary(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(~0));
@@ -182,7 +182,7 @@ create table t1 as select concat(~0) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(21) NOT NULL
+ `c1` varbinary(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(3^2));
@@ -192,7 +192,7 @@ create table t1 as select concat(3^2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(21) NOT NULL
+ `c1` varbinary(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(abs(-2)));
@@ -202,7 +202,7 @@ create table t1 as select concat(abs(-2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(2) NOT NULL
+ `c1` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(concat(exp(2)),1));
@@ -332,7 +332,7 @@ create table t1 as select concat(degrees(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(23) NOT NULL
+ `c1` varbinary(23) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(radians(0)));
@@ -342,7 +342,7 @@ create table t1 as select concat(radians(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(23) NOT NULL
+ `c1` varbinary(23) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ceiling(0.5)));
@@ -352,7 +352,7 @@ create table t1 as select concat(ceiling(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(4) NOT NULL
+ `c1` varbinary(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
@@ -362,7 +362,7 @@ create table t1 as select concat(floor(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(4) NOT NULL
+ `c1` varbinary(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
@@ -372,7 +372,7 @@ create table t1 as select concat(round(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(3) NOT NULL
+ `c1` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sign(0.5)));
@@ -382,14 +382,14 @@ create table t1 as select concat(sign(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(21) NOT NULL
+ `c1` varbinary(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(rand()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(23) NOT NULL
+ `c1` varbinary(23) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(length('a')));
@@ -399,7 +399,7 @@ create table t1 as select concat(length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) NOT NULL
+ `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(char_length('a')));
@@ -409,7 +409,7 @@ create table t1 as select concat(char_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) NOT NULL
+ `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_length('a')));
@@ -419,7 +419,7 @@ create table t1 as select concat(bit_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) NOT NULL
+ `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coercibility('a')));
@@ -429,7 +429,7 @@ create table t1 as select concat(coercibility('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) NOT NULL
+ `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(locate('a','a')));
@@ -439,7 +439,7 @@ create table t1 as select concat(locate('a','a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(11) NOT NULL
+ `c1` varbinary(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(field('c','a','b','c')));
@@ -449,7 +449,7 @@ create table t1 as select concat(field('c','a','b','c')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(3) NOT NULL
+ `c1` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ascii(61)));
@@ -459,7 +459,7 @@ create table t1 as select concat(ascii(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(3) NOT NULL
+ `c1` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ord(61)));
@@ -469,7 +469,7 @@ create table t1 as select concat(ord(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(21) NOT NULL
+ `c1` varbinary(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(find_in_set('b','a,b,c,d')));
@@ -479,7 +479,7 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(3) NOT NULL
+ `c1` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select md5('a'), hex(md5('a'));
@@ -489,7 +489,7 @@ create table t1 as select md5('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(32) NOT NULL
+ `c1` varbinary(32) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select old_password('a'), hex(old_password('a'));
@@ -499,7 +499,7 @@ create table t1 as select old_password('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(16) NOT NULL
+ `c1` varbinary(16) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select password('a'), hex(password('a'));
@@ -509,7 +509,7 @@ create table t1 as select password('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(41) NOT NULL
+ `c1` varbinary(41) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha('a'), hex(sha('a'));
@@ -519,7 +519,7 @@ create table t1 as select sha('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(40) NOT NULL
+ `c1` varbinary(40) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha1('a'), hex(sha1('a'));
@@ -529,7 +529,7 @@ create table t1 as select sha1('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(40) NOT NULL
+ `c1` varbinary(40) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('-1' as signed)));
@@ -539,7 +539,7 @@ create table t1 as select concat(cast('-1' as signed)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(2) NOT NULL
+ `c1` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('1' as unsigned)));
@@ -549,7 +549,7 @@ create table t1 as select concat(cast('1' as unsigned)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast(1/2 as decimal(5,5))));
@@ -608,7 +608,7 @@ create table t1 as select concat(least(1,2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(2) NOT NULL
+ `c1` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(greatest(1,2)));
@@ -618,7 +618,7 @@ create table t1 as select concat(greatest(1,2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(2) NOT NULL
+ `c1` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(case when 11 then 22 else 33 end));
@@ -628,7 +628,7 @@ create table t1 as select concat(case when 11 then 22 else 33 end) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(2) NOT NULL
+ `c1` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coalesce(1,2)));
@@ -638,7 +638,7 @@ create table t1 as select concat(coalesce(1,2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat_ws(1,2,3));
@@ -648,7 +648,7 @@ create table t1 as select concat_ws(1,2,3) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(3) NOT NULL
+ `c1` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(group_concat(1,2,3));
@@ -658,7 +658,7 @@ create table t1 as select group_concat(1,2,3) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` blob
+ `c1` mediumblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select 1 as c1 union select 'a';
@@ -676,7 +676,7 @@ create table t1 as select concat(last_insert_id()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(21) NOT NULL
+ `c1` varbinary(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(benchmark(0,0)));
@@ -686,7 +686,7 @@ create table t1 as select concat(benchmark(0,0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sleep(0)));
@@ -696,7 +696,7 @@ create table t1 as select concat(sleep(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(21) NOT NULL
+ `c1` varbinary(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx')));
@@ -730,7 +730,7 @@ create table t1 as select concat(crc32('')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) NOT NULL
+ `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(uncompressed_length('')));
@@ -747,7 +747,7 @@ create table t1 as select concat(connection_id()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) NOT NULL
+ `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(inet_aton('127.1.1.1')));
@@ -783,7 +783,7 @@ create table t1 as select concat(row_count()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(21) NOT NULL
+ `c1` varbinary(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(found_rows()));
@@ -793,21 +793,21 @@ create table t1 as select concat(found_rows()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(21) NOT NULL
+ `c1` varbinary(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(uuid_short()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(21) NOT NULL
+ `c1` varbinary(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(uuid()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(36) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(36) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select coercibility(uuid()), coercibility(cast('a' as char character set latin1));
@@ -820,7 +820,7 @@ create table t1 as select concat(uuid(), cast('a' as char character set latin1))
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(37) NOT NULL
+ `c1` varchar(37) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1;
@@ -840,7 +840,7 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL,
+ `c1` varbinary(1) DEFAULT NULL,
`c2` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -898,7 +898,7 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(4) NOT NULL,
+ `c1` varbinary(4) DEFAULT NULL,
`c2` decimal(2,1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -914,7 +914,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varbinary(83) DEFAULT NULL,
- `c2` decimal(65,30) DEFAULT NULL
+ `c2` decimal(65,38) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(@@ft_max_word_len));
@@ -937,7 +937,7 @@ create table t1 as select concat('a'='a' IS TRUE) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a'='a' IS NOT TRUE));
@@ -947,7 +947,7 @@ create table t1 as select concat('a'='a' IS NOT TRUE) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(NOT 'a'='a'));
@@ -957,7 +957,7 @@ create table t1 as select concat(NOT 'a'='a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NULL));
@@ -967,7 +967,7 @@ create table t1 as select concat('a' IS NULL) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NOT NULL));
@@ -977,7 +977,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' rlike 'a'));
@@ -987,7 +987,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(strcmp('a','b')));
@@ -997,7 +997,7 @@ create table t1 as select concat(strcmp('a','b')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(2) NOT NULL
+ `c1` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' like 'a'));
@@ -1007,7 +1007,7 @@ create table t1 as select concat('a' like 'b') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' between 'b' and 'c'));
@@ -1017,7 +1017,7 @@ create table t1 as select concat('a' between 'b' and 'c') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' in ('a','b')));
@@ -1027,7 +1027,7 @@ create table t1 as select concat('a' in ('a','b')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(interval(23, 1, 15, 17, 30, 44, 200)));
@@ -1037,7 +1037,7 @@ create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(2) NOT NULL
+ `c1` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a varchar(10), fulltext key(a));
@@ -1069,7 +1069,7 @@ create table t1 as select concat(ifnull(1,1)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ifnull(1.1,1.1)));
@@ -1079,7 +1079,7 @@ create table t1 as select concat(ifnull(1.1,1.1)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(4) NOT NULL
+ `c1` varbinary(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(if(1,'b',1));
@@ -1109,7 +1109,7 @@ create table t1 as select concat(if(1,1,1)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(nullif(1,2)));
@@ -1264,7 +1264,7 @@ create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(period_add(200902, 2)));
@@ -1274,12 +1274,13 @@ create table t1 as select concat(period_add(200902, 2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(6) NOT NULL
+ `c1` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(period_diff(200902, 200802)));
hex(concat(period_diff(200902, 200802)))
3132
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t1 as select concat(period_add(200902, 200802)) as c1;
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
@@ -1483,21 +1484,21 @@ create table t1 as select concat(curdate()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) NOT NULL
+ `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(utc_date()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) NOT NULL
+ `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(curtime()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) NOT NULL
+ `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select repeat('a',20) as c1 limit 0;
@@ -1513,7 +1514,7 @@ create table t1 as select concat(utc_time()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) NOT NULL
+ `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sec_to_time(2378)));
@@ -1606,21 +1607,21 @@ create table t1 as select concat(now()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(19) NOT NULL
+ `c1` varbinary(19) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(utc_timestamp()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(19) NOT NULL
+ `c1` varbinary(19) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(sysdate()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(19) NOT NULL
+ `c1` varbinary(19) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(addtime('00:00:00','11:22:33')));
@@ -1660,7 +1661,7 @@ create table t1 as select export_set(1,2,3,4,2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(127) NOT NULL
+ `c1` varbinary(127) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(insert(1133,3,0,22));
@@ -1670,7 +1671,7 @@ create table t1 as select insert(1133,3,0,22) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(6) NOT NULL
+ `c1` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lcase(123));
@@ -1680,7 +1681,7 @@ create table t1 as select lcase(123) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(3) NOT NULL
+ `c1` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(123,1));
@@ -1690,7 +1691,7 @@ create table t1 as select left(123,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lower(123));
@@ -1700,7 +1701,7 @@ create table t1 as select lower(123) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(3) NOT NULL
+ `c1` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lpad(1,2,0));
@@ -1710,7 +1711,7 @@ create table t1 as select lpad(1,2,0) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(2) NOT NULL
+ `c1` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ltrim(1));
@@ -1720,7 +1721,7 @@ create table t1 as select ltrim(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(mid(1,1,1));
@@ -1730,7 +1731,7 @@ create table t1 as select mid(1,1,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(repeat(1,2));
@@ -1740,7 +1741,7 @@ create table t1 as select repeat(1,2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(2) NOT NULL
+ `c1` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(replace(1,1,2));
@@ -1750,7 +1751,7 @@ create table t1 as select replace(1,1,2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(reverse(12));
@@ -1760,7 +1761,7 @@ create table t1 as select reverse(12) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(2) NOT NULL
+ `c1` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(right(123,1));
@@ -1770,7 +1771,7 @@ create table t1 as select right(123,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rpad(1,2,0));
@@ -1780,7 +1781,7 @@ create table t1 as select rpad(1,2,0) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(2) NOT NULL
+ `c1` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rtrim(1));
@@ -1790,7 +1791,7 @@ create table t1 as select rtrim(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(soundex(1));
@@ -1800,7 +1801,7 @@ create table t1 as select soundex(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(4) NOT NULL
+ `c1` varbinary(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(substring(1,1,1));
@@ -1810,7 +1811,7 @@ create table t1 as select substring(1,1,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(trim(1));
@@ -1820,7 +1821,7 @@ create table t1 as select trim(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ucase(1));
@@ -1830,7 +1831,7 @@ create table t1 as select ucase(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(upper(1));
@@ -1840,14 +1841,14 @@ create table t1 as select upper(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(1) NOT NULL
+ `c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select repeat(' ', 64) as a limit 0;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varbinary(64) NOT NULL
+ `a` varbinary(64) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ("1.1"), ("2.1");
select a, hex(a) from t1;
@@ -2097,7 +2098,7 @@ create table t2 as select concat(a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `concat(a)` varbinary(19) NOT NULL
+ `concat(a)` varbinary(19) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a date);
@@ -2396,7 +2397,7 @@ insert into t1 values ('2001-02-03 04:05:06');
create view v1(a) as select concat(a) from t1;
show columns from v1;
Field Type Null Key Default Extra
-a varbinary(19) NO
+a varbinary(19) YES NULL
select hex(a) from v1;
hex(a)
303030302D30302D30302030303A30303A3030
@@ -2621,7 +2622,7 @@ GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END)
1234567
SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(a,'') 253 9 7 Y 128 31 63
+def COALESCE(a,'') 253 9 7 Y 128 39 63
COALESCE(a,'')
1234567
# All columns must be VARCHAR(9) with the same length:
@@ -2647,14 +2648,14 @@ CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `CONCAT_WS(1,2,3)` varbinary(3) NOT NULL
+ `CONCAT_WS(1,2,3)` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `INSERT(1133,3,0,22)` varbinary(6) NOT NULL
+ `INSERT(1133,3,0,22)` varbinary(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
@@ -2675,35 +2676,35 @@ CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `REPEAT(1,2)` varbinary(2) NOT NULL
+ `REPEAT(1,2)` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `LEFT(123,2)` varbinary(2) NOT NULL
+ `LEFT(123,2)` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `RIGHT(123,2)` varbinary(2) NOT NULL
+ `RIGHT(123,2)` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `LTRIM(123)` varbinary(3) NOT NULL
+ `LTRIM(123)` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `RTRIM(123)` varbinary(3) NOT NULL
+ `RTRIM(123)` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
@@ -2717,35 +2718,35 @@ CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `REPLACE(111,2,3)` varbinary(3) NOT NULL
+ `REPLACE(111,2,3)` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `SUBSTRING_INDEX(111,111,1)` varbinary(3) NOT NULL
+ `SUBSTRING_INDEX(111,111,1)` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `MAKE_SET(111,222,3)` varbinary(5) NOT NULL
+ `MAKE_SET(111,222,3)` varbinary(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `SOUNDEX(1)` varbinary(4) NOT NULL
+ `SOUNDEX(1)` varbinary(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8);
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `EXPORT_SET(1,'Y','N','',8)` varbinary(64) NOT NULL
+ `EXPORT_SET(1,'Y','N','',8)` varbinary(64) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
@@ -2869,11 +2870,11 @@ NULL
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
-Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
+Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()`
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select concat(v_LastPaymentDate@0,now()) AS `CONCAT(v_LastPaymentDate, NOW())`
+Note 1003 select concat(v_LastPaymentDate@0,current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())`
DROP PROCEDURE p1;
#
# Bug#52159 returning time type from function and empty left join causes debug assertion
@@ -2935,7 +2936,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) NOT NULL
+ `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -2956,7 +2957,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) NOT NULL
+ `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -2977,7 +2978,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) NOT NULL
+ `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -2998,7 +2999,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) NOT NULL
+ `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -3014,7 +3015,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ('%' = concat(`test`.`t1`.`c1`))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`)
DROP TABLE t1;
#
# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
@@ -3023,7 +3024,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varbinary(10) NOT NULL
+ `a` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
@@ -3036,7 +3037,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where (`test`.`t1`.`a` = 'a')
+Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a'
DROP TABLE t1;
#
# End of MDEV-8694
@@ -3069,7 +3070,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)`,crc32(`test`.`t1`.`a`) AS `CRC32(a)` from `test`.`t1` where (`test`.`t1`.`a` = 'a')
+Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)`,crc32(`test`.`t1`.`a`) AS `CRC32(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a'
SELECT a, HEX(a) FROM t1 WHERE HEX(a)='61';
a HEX(a)
a 61
@@ -3081,7 +3082,7 @@ EXPLAIN EXTENDED SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,hex(`test`.`t1`.`a`) AS `HEX(a)` from `test`.`t1` where (`test`.`t1`.`a` = 'a')
+Note 1003 select `test`.`t1`.`a` AS `a`,hex(`test`.`t1`.`a`) AS `HEX(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a'
SELECT * FROM t1 WHERE a='a';
a
a
@@ -3107,7 +3108,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a ' AND LENGTH(a)=2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a ')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a '
DROP TABLE t1;
#
# MDEV-8723 Wrong result for SELECT..WHERE COLLATION(a)='binary' AND a='a'
@@ -3130,22 +3131,22 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE COLLATION(a)='binary' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
EXPLAIN EXTENDED SELECT * FROM t1 WHERE CHARSET(a)='binary' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
EXPLAIN EXTENDED SELECT * FROM t1 WHERE COERCIBILITY(a)=2 AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
EXPLAIN EXTENDED SELECT * FROM t1 WHERE WEIGHT_STRING(a)='a' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (weight_string(`test`.`t1`.`a`) = 'a'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and weight_string(`test`.`t1`.`a`,0,0,1) = 'a'
DROP TABLE t1;
#
# End of 10.1 tests
diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result
index f84613e086f..5e8c5adac8f 100644
--- a/mysql-test/r/ctype_collate.result
+++ b/mysql-test/r/ctype_collate.result
@@ -519,7 +519,7 @@ explain extended SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select charset('a') AS `charset('a')`,collation('a') AS `collation('a')`,coercibility('a') AS `coercibility('a')`,('a' = 'A') AS `'a'='A'`
+Note 1003 select charset('a') AS `charset('a')`,collation('a') AS `collation('a')`,coercibility('a') AS `coercibility('a')`,'a' = 'A' AS `'a'='A'`
SET CHARACTER SET koi8r;
SHOW VARIABLES LIKE 'collation_client';
Variable_name Value
@@ -649,7 +649,7 @@ select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f1` varchar(1) CHARACTER SET latin5 NOT NULL
+ `f1` varchar(1) CHARACTER SET latin5 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
@@ -719,3 +719,38 @@ DROP FUNCTION getText;
DROP DATABASE test1;
USE test;
SET NAMES latin1;
+#
+# MDEV-11320, MySQL BUG#81810: Inconsistent sort order for blob/text between InnoDB and filesort
+#
+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';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY PRIMARY 34 NULL 4 Using where
+select hex(b) from t1 force index (PRIMARY) where b<'zzz';
+hex(b)
+00
+01
+
+61
+explain
+select hex(b) from t1 where b<'zzz' order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 4 Using where; Using filesort
+select hex(b) from t1 where b<'zzz' order by b;
+hex(b)
+00
+01
+
+61
+drop table t1;
diff --git a/mysql-test/r/ctype_cp1250_ch.result b/mysql-test/r/ctype_cp1250_ch.result
index f2eeb4dda79..d4f75778ace 100644
--- a/mysql-test/r/ctype_cp1250_ch.result
+++ b/mysql-test/r/ctype_cp1250_ch.result
@@ -59,7 +59,7 @@ want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
-insert into t1 values (),();
+insert ignore into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
@@ -112,7 +112,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -129,13 +129,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a '))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a '
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -152,13 +152,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -175,13 +175,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -198,7 +198,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
#
# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
@@ -207,7 +207,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET utf8 NOT NULL
+ `a` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
@@ -220,7 +220,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((not((`test`.`t1`.`a` like 'a '))) and (`test`.`t1`.`a` = 'a'))
+Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` not like 'a ' and `test`.`t1`.`a` = 'a'
DROP TABLE t1;
#
# End of MDEV-8694
@@ -281,7 +281,7 @@ want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
-insert into t1 values (),();
+insert ignore into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
@@ -377,21 +377,21 @@ a
abcdefghá
drop table t1;
set names cp1250 collate cp1250_czech_cs;
-SELECT strcmp('a','a ');
-strcmp('a','a ')
-0
-SELECT strcmp('a\0','a' );
-strcmp('a\0','a' )
-1
-SELECT strcmp('a\0','a ');
-strcmp('a\0','a ')
-1
-SELECT strcmp('a\t','a' );
-strcmp('a\t','a' )
-1
-SELECT strcmp('a\t','a ');
-strcmp('a\t','a ')
-1
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+1 -1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+1 -1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+1 -1
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+1 -1
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
@@ -510,7 +510,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET cp1250 COLLATE cp1250_czech_cs NOT NULL
+ `a` varchar(5) CHARACTER SET cp1250 COLLATE cp1250_czech_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result
index 09344a50ee9..e0e6a5cfd95 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -388,6 +388,21 @@ FF FF FF D18F FF
Warnings:
Warning 1977 Cannot convert 'cp1251' character 0x98 to 'utf8'
DROP TABLE t1;
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+-1 1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+-1 1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+-1 1
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+-1 1
set global LC_TIME_NAMES=convert((-8388608) using cp1251);
ERROR HY000: Unknown locale: '-8388608'
#
@@ -407,7 +422,7 @@ create table t1 as select concat(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -420,7 +435,7 @@ create table t1 as select concat(18446744073709551615) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(20) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(20) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -433,7 +448,7 @@ create table t1 as select concat(1.1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -446,7 +461,7 @@ create table t1 as select concat(1+2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1-2));
@@ -456,7 +471,7 @@ create table t1 as select concat(1-2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1*2));
@@ -466,7 +481,7 @@ create table t1 as select concat(1*2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1/2));
@@ -506,7 +521,7 @@ create table t1 as select concat(-1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(-(1+2)));
@@ -516,7 +531,7 @@ create table t1 as select concat(-(1+2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1|2));
@@ -526,7 +541,7 @@ create table t1 as select concat(1|2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1&2));
@@ -536,7 +551,7 @@ create table t1 as select concat(1&2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_count(12)));
@@ -546,7 +561,7 @@ create table t1 as select concat(bit_count(12)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2<<1));
@@ -556,7 +571,7 @@ create table t1 as select concat(2<<1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2>>1));
@@ -566,7 +581,7 @@ create table t1 as select concat(2>>1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(~0));
@@ -576,7 +591,7 @@ create table t1 as select concat(~0) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(3^2));
@@ -586,7 +601,7 @@ create table t1 as select concat(3^2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(abs(-2)));
@@ -596,7 +611,7 @@ create table t1 as select concat(abs(-2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(concat(exp(2)),1));
@@ -726,7 +741,7 @@ create table t1 as select concat(degrees(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(23) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(radians(0)));
@@ -736,7 +751,7 @@ create table t1 as select concat(radians(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(23) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ceiling(0.5)));
@@ -746,7 +761,7 @@ create table t1 as select concat(ceiling(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
@@ -756,7 +771,7 @@ create table t1 as select concat(floor(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
@@ -766,7 +781,7 @@ create table t1 as select concat(round(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sign(0.5)));
@@ -776,14 +791,14 @@ create table t1 as select concat(sign(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(rand()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(23) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(23) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(length('a')));
@@ -793,7 +808,7 @@ create table t1 as select concat(length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(char_length('a')));
@@ -803,7 +818,7 @@ create table t1 as select concat(char_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_length('a')));
@@ -813,7 +828,7 @@ create table t1 as select concat(bit_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coercibility('a')));
@@ -823,7 +838,7 @@ create table t1 as select concat(coercibility('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(locate('a','a')));
@@ -833,7 +848,7 @@ create table t1 as select concat(locate('a','a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(11) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(11) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(field('c','a','b','c')));
@@ -843,7 +858,7 @@ create table t1 as select concat(field('c','a','b','c')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ascii(61)));
@@ -853,7 +868,7 @@ create table t1 as select concat(ascii(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ord(61)));
@@ -863,7 +878,7 @@ create table t1 as select concat(ord(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(find_in_set('b','a,b,c,d')));
@@ -873,7 +888,7 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select md5('a'), hex(md5('a'));
@@ -883,7 +898,7 @@ create table t1 as select md5('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(32) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(32) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select old_password('a'), hex(old_password('a'));
@@ -893,7 +908,7 @@ create table t1 as select old_password('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(16) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(16) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select password('a'), hex(password('a'));
@@ -903,7 +918,7 @@ create table t1 as select password('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(41) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(41) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha('a'), hex(sha('a'));
@@ -913,7 +928,7 @@ create table t1 as select sha('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(40) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(40) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha1('a'), hex(sha1('a'));
@@ -923,7 +938,7 @@ create table t1 as select sha1('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(40) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(40) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('-1' as signed)));
@@ -933,7 +948,7 @@ create table t1 as select concat(cast('-1' as signed)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('1' as unsigned)));
@@ -943,7 +958,7 @@ create table t1 as select concat(cast('1' as unsigned)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast(1/2 as decimal(5,5))));
@@ -1002,7 +1017,7 @@ create table t1 as select concat(least(1,2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(greatest(1,2)));
@@ -1012,7 +1027,7 @@ create table t1 as select concat(greatest(1,2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(case when 11 then 22 else 33 end));
@@ -1022,7 +1037,7 @@ create table t1 as select concat(case when 11 then 22 else 33 end) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coalesce(1,2)));
@@ -1032,7 +1047,7 @@ create table t1 as select concat(coalesce(1,2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat_ws(1,2,3));
@@ -1042,7 +1057,7 @@ create table t1 as select concat_ws(1,2,3) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(group_concat(1,2,3));
@@ -1052,7 +1067,7 @@ create table t1 as select group_concat(1,2,3) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` text CHARACTER SET cp1251
+ `c1` mediumtext CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select 1 as c1 union select 'a';
@@ -1070,7 +1085,7 @@ create table t1 as select concat(last_insert_id()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(benchmark(0,0)));
@@ -1080,7 +1095,7 @@ create table t1 as select concat(benchmark(0,0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sleep(0)));
@@ -1090,7 +1105,7 @@ create table t1 as select concat(sleep(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx')));
@@ -1124,7 +1139,7 @@ create table t1 as select concat(crc32('')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(uncompressed_length('')));
@@ -1141,7 +1156,7 @@ create table t1 as select concat(connection_id()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(inet_aton('127.1.1.1')));
@@ -1177,7 +1192,7 @@ create table t1 as select concat(row_count()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(found_rows()));
@@ -1187,21 +1202,21 @@ create table t1 as select concat(found_rows()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(uuid_short()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(uuid()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(36) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(36) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select coercibility(uuid()), coercibility(cast('a' as char character set latin1));
@@ -1214,7 +1229,7 @@ create table t1 as select concat(uuid(), cast('a' as char character set latin1))
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(37) NOT NULL
+ `c1` varchar(37) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1;
@@ -1234,7 +1249,7 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL,
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL,
`c2` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -1292,7 +1307,7 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET cp1251 NOT NULL,
+ `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL,
`c2` decimal(2,1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -1308,7 +1323,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(83) CHARACTER SET cp1251 DEFAULT NULL,
- `c2` decimal(65,30) DEFAULT NULL
+ `c2` decimal(65,38) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(@@ft_max_word_len));
@@ -1331,7 +1346,7 @@ create table t1 as select concat('a'='a' IS TRUE) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a'='a' IS NOT TRUE));
@@ -1341,7 +1356,7 @@ create table t1 as select concat('a'='a' IS NOT TRUE) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(NOT 'a'='a'));
@@ -1351,7 +1366,7 @@ create table t1 as select concat(NOT 'a'='a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NULL));
@@ -1361,7 +1376,7 @@ create table t1 as select concat('a' IS NULL) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NOT NULL));
@@ -1371,7 +1386,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' rlike 'a'));
@@ -1381,7 +1396,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(strcmp('a','b')));
@@ -1391,7 +1406,7 @@ create table t1 as select concat(strcmp('a','b')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' like 'a'));
@@ -1401,7 +1416,7 @@ create table t1 as select concat('a' like 'b') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' between 'b' and 'c'));
@@ -1411,7 +1426,7 @@ create table t1 as select concat('a' between 'b' and 'c') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' in ('a','b')));
@@ -1421,7 +1436,7 @@ create table t1 as select concat('a' in ('a','b')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(interval(23, 1, 15, 17, 30, 44, 200)));
@@ -1431,7 +1446,7 @@ create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a varchar(10), fulltext key(a));
@@ -1463,7 +1478,7 @@ create table t1 as select concat(ifnull(1,1)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ifnull(1.1,1.1)));
@@ -1473,7 +1488,7 @@ create table t1 as select concat(ifnull(1.1,1.1)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(if(1,'b',1));
@@ -1503,7 +1518,7 @@ create table t1 as select concat(if(1,1,1)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(nullif(1,2)));
@@ -1658,7 +1673,7 @@ create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` longtext CHARACTER SET cp1251
+ `c1` longtext CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(period_add(200902, 2)));
@@ -1668,12 +1683,13 @@ create table t1 as select concat(period_add(200902, 2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(6) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(6) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(period_diff(200902, 200802)));
hex(concat(period_diff(200902, 200802)))
3132
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t1 as select concat(period_add(200902, 200802)) as c1;
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
@@ -1877,21 +1893,21 @@ create table t1 as select concat(curdate()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(utc_date()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(curtime()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select repeat('a',20) as c1 limit 0;
@@ -1907,7 +1923,7 @@ create table t1 as select concat(utc_time()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sec_to_time(2378)));
@@ -2000,21 +2016,21 @@ create table t1 as select concat(now()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(19) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(19) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(utc_timestamp()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(19) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(19) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(sysdate()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(19) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(19) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(addtime('00:00:00','11:22:33')));
@@ -2054,7 +2070,7 @@ create table t1 as select export_set(1,2,3,4,2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(127) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(127) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(insert(1133,3,0,22));
@@ -2064,7 +2080,7 @@ create table t1 as select insert(1133,3,0,22) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(6) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(6) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lcase(123));
@@ -2074,7 +2090,7 @@ create table t1 as select lcase(123) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(123,1));
@@ -2084,7 +2100,7 @@ create table t1 as select left(123,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lower(123));
@@ -2094,7 +2110,7 @@ create table t1 as select lower(123) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lpad(1,2,0));
@@ -2104,7 +2120,7 @@ create table t1 as select lpad(1,2,0) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ltrim(1));
@@ -2114,7 +2130,7 @@ create table t1 as select ltrim(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(mid(1,1,1));
@@ -2124,7 +2140,7 @@ create table t1 as select mid(1,1,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(repeat(1,2));
@@ -2134,7 +2150,7 @@ create table t1 as select repeat(1,2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(replace(1,1,2));
@@ -2144,7 +2160,7 @@ create table t1 as select replace(1,1,2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(reverse(12));
@@ -2154,7 +2170,7 @@ create table t1 as select reverse(12) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(right(123,1));
@@ -2164,7 +2180,7 @@ create table t1 as select right(123,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rpad(1,2,0));
@@ -2174,7 +2190,7 @@ create table t1 as select rpad(1,2,0) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rtrim(1));
@@ -2184,7 +2200,7 @@ create table t1 as select rtrim(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(soundex(1));
@@ -2194,7 +2210,7 @@ create table t1 as select soundex(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(substring(1,1,1));
@@ -2204,7 +2220,7 @@ create table t1 as select substring(1,1,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(trim(1));
@@ -2214,7 +2230,7 @@ create table t1 as select trim(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ucase(1));
@@ -2224,7 +2240,7 @@ create table t1 as select ucase(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(upper(1));
@@ -2234,14 +2250,14 @@ create table t1 as select upper(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET cp1251 NOT NULL
+ `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select repeat(' ', 64) as a limit 0;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(64) CHARACTER SET cp1251 NOT NULL
+ `a` varchar(64) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ("1.1"), ("2.1");
select a, hex(a) from t1;
@@ -2491,7 +2507,7 @@ create table t2 as select concat(a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `concat(a)` varchar(19) CHARACTER SET cp1251 NOT NULL
+ `concat(a)` varchar(19) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a date);
@@ -2790,7 +2806,7 @@ insert into t1 values ('2001-02-03 04:05:06');
create view v1(a) as select concat(a) from t1;
show columns from v1;
Field Type Null Key Default Extra
-a varchar(19) NO
+a varchar(19) YES NULL
select hex(a) from v1;
hex(a)
303030302D30302D30302030303A30303A3030
@@ -3015,7 +3031,7 @@ GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END)
1234567
SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(a,'') 253 9 7 Y 0 31 51
+def COALESCE(a,'') 253 9 7 Y 0 39 51
COALESCE(a,'')
1234567
# All columns must be VARCHAR(9) with the same length:
@@ -3041,14 +3057,14 @@ CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET cp1251 NOT NULL
+ `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET cp1251 NOT NULL
+ `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
@@ -3069,35 +3085,35 @@ CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `REPEAT(1,2)` varchar(2) CHARACTER SET cp1251 NOT NULL
+ `REPEAT(1,2)` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `LEFT(123,2)` varchar(2) CHARACTER SET cp1251 NOT NULL
+ `LEFT(123,2)` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `RIGHT(123,2)` varchar(2) CHARACTER SET cp1251 NOT NULL
+ `RIGHT(123,2)` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `LTRIM(123)` varchar(3) CHARACTER SET cp1251 NOT NULL
+ `LTRIM(123)` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `RTRIM(123)` varchar(3) CHARACTER SET cp1251 NOT NULL
+ `RTRIM(123)` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
@@ -3111,35 +3127,35 @@ CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `REPLACE(111,2,3)` varchar(3) CHARACTER SET cp1251 NOT NULL
+ `REPLACE(111,2,3)` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET cp1251 NOT NULL
+ `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET cp1251 NOT NULL
+ `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `SOUNDEX(1)` varchar(4) CHARACTER SET cp1251 NOT NULL
+ `SOUNDEX(1)` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8);
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET cp1251 NOT NULL
+ `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
@@ -3263,11 +3279,11 @@ NULL
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
-Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
+Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()`
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select concat(convert(v_LastPaymentDate@0 using cp1251),now()) AS `CONCAT(v_LastPaymentDate, NOW())`
+Note 1003 select concat(convert(v_LastPaymentDate@0 using cp1251),current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())`
DROP PROCEDURE p1;
#
# Bug#52159 returning time type from function and empty left join causes debug assertion
@@ -3370,12 +3386,12 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' 1') and (`test`.`t1`.`a` in (1,2,3)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = ' 1' and `test`.`t1`.`a` in (1,2,3)
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3,'x') AND a=' 1';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' 1') and (`test`.`t1`.`a` in (1,2,3,'x')))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = ' 1' and `test`.`t1`.`a` in (1,2,3,'x')
DROP TABLE t1;
#
# MDEV-8671 Wrong result for SELECT..WHERE varchar_column=' 1' AND (varchar_column XOR '1')
@@ -3401,7 +3417,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=' 1' AND (a XOR '0');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' 1') and (`test`.`t1`.`a` xor '0'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = ' 1' and (`test`.`t1`.`a` xor '0')
DROP TABLE t1;
#
# End of 10.1 tests
diff --git a/mysql-test/r/ctype_cp932.result b/mysql-test/r/ctype_cp932.result
index 4b170ee4c9b..eb714e9f8d7 100644
--- a/mysql-test/r/ctype_cp932.result
+++ b/mysql-test/r/ctype_cp932.result
@@ -33,3 +33,567 @@ DROP TABLE t1;
SET @@character_set_client= @old_character_set_client;
SET @@character_set_connection= @old_character_set_connection;
SET @@character_set_results= @old_character_set_results;
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET character_set_connection=cp932;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp932_japanese_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp932_japanese_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=cp932 COLLATE=cp932_japanese_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp932_japanese_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp932_japanese_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp932_japanese_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp932_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp932_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp932_japanese_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_japanese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_japanese_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp932_japanese_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_japanese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_japanese_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp932_japanese_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp932_japanese_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=cp932 COLLATE=cp932_japanese_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp932_japanese_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp932_japanese_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp932_japanese_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp932_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp932_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp932_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp932_japanese_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp932_japanese_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_japanese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_japanese_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp932_japanese_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_japanese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_japanese_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp932_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp932_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=cp932 COLLATE=cp932_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp932_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp932_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp932_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp932_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp932_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp932_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp932_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp932_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp932_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp932_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp932_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp932_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp932_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp932_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp932_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp932_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp932_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=cp932 COLLATE=cp932_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp932_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp932_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp932_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp932_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp932_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp932_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp932_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp932_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp932_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp932_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp932_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp932_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp932_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp932_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp932_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp932_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_cp932_binlog_row.result b/mysql-test/r/ctype_cp932_binlog_row.result
index 6eebea87928..b42489677f0 100644
--- a/mysql-test/r/ctype_cp932_binlog_row.result
+++ b/mysql-test/r/ctype_cp932_binlog_row.result
@@ -11,6 +11,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(f1 blob)
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES(X'8300')
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result
index 75d05aa9f0a..f49400b63ff 100644
--- a/mysql-test/r/ctype_cp932_binlog_stm.result
+++ b/mysql-test/r/ctype_cp932_binlog_stm.result
@@ -86,7 +86,7 @@ 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;
-INSERT t1 (code) SELECT head FROM head
+INSERT IGNORE t1 (code) SELECT head FROM head
WHERE (head BETWEEN 'A1' AND 'DF')
ORDER BY head;
DROP TEMPORARY TABLE head, tail;
@@ -96,7 +96,7 @@ t1 CREATE TABLE `t1` (
`code` varchar(8) DEFAULT NULL,
`a` varchar(1) CHARACTER SET cp932 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-UPDATE t1 SET a=unhex(code) ORDER BY code;
+UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
Warnings:
Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1
Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2
@@ -19762,7 +19762,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET cp932 NOT NULL
+ `a` varchar(5) CHARACTER SET cp932 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -20021,7 +20021,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET cp932 COLLATE cp932_bin NOT NULL
+ `a` varchar(5) CHARACTER SET cp932 COLLATE cp932_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -20300,7 +20300,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET cp932 NOT NULL
+ `a` varchar(10) CHARACTER SET cp932 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\'),('à\t');
INSERT INTO t1 VALUES ('\\à\'),('\\à\t'),('\\à\t\t');
@@ -20339,7 +20339,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET cp932 NOT NULL
+ `a` varchar(10) CHARACTER SET cp932 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (BINARY('à\')),(BINARY('à\t'));
INSERT INTO t1 VALUES (BINARY('\\à\')),(BINARY('\\à\t')),(BINARY('\\à\t\t'));
@@ -20378,7 +20378,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET cp932 NOT NULL
+ `a` varchar(10) CHARACTER SET cp932 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_BINARY'à\'),(_BINARY'à\t');
INSERT INTO t1 VALUES (_BINARY'\\à\'),(_BINARY'\\à\t'),(_BINARY'\\à\t\t');
@@ -20424,7 +20424,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET cp932 NOT NULL
+ `a` varchar(10) CHARACTER SET cp932 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\['),('\à\[');
SELECT HEX(a) FROM t1;
@@ -20444,7 +20444,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varbinary(10) NOT NULL
+ `a` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\['),('\à\[');
SELECT HEX(a) FROM t1;
diff --git a/mysql-test/r/ctype_errors.result b/mysql-test/r/ctype_errors.result
index 5ae8c53ce8b..6f9e14a8942 100644
--- a/mysql-test/r/ctype_errors.result
+++ b/mysql-test/r/ctype_errors.result
@@ -1,5 +1,7 @@
Start of 5.4 tests
CREATE TABLE t1(f1 INT);
+connect con1,localhost,root,,test;
+connection con1;
SET lc_messages=ru_RU;
SHOW VARIABLES LIKE 'lc_messages';
Variable_name Value
@@ -9,6 +11,7 @@ ERROR 42S01: \0422\0430\0431\043B\0438\0446\0430 't1' \0443\0436\0435 \0441\0443
SET NAMES utf8;
CREATE TABLE t1(f1 INT);
ERROR 42S01: Таблица 't1' уже ÑущеÑтвует
+connection default;
SHOW VARIABLES LIKE 'lc_messages';
Variable_name Value
lc_messages en_US
@@ -22,21 +25,27 @@ SHOW GLOBAL VARIABLES LIKE 'lc_messages';
Variable_name Value
lc_messages ru_RU
SET GLOBAL lc_messages=en_US;
+disconnect con1;
DROP TABLE t1;
drop table `×§`;
ERROR 42S02: Unknown table 'test.×§'
+connect con1,localhost,root,,test;
+connection con1;
SET lc_messages=cs_CZ;
SET NAMES UTF8;
USE nonexistant;
ERROR 42000: Neznámá databáze 'nonexistant'
+disconnect con1;
+connection default;
#
# Bug#12736295: Buffer overflow for variable converted_err
# with non-latin1 server error message
#
-# Connection con1
+connect con1,localhost,root,,test;
SET lc_messages=ru_RU;
SET NAMES latin1;
SELECT '01234567890123456789012345678901234\';
ERROR 42000: \0423 \0432\0430\0441 \043E\0448\0438\0431\043A\0430 \0432 \0437\0430\043F\0440\043E\0441\0435. \0418\0437\0443\0447\0438\0442\0435 \0434\043E\043A\0443\043C\0435\043D\0442\0430\0446\0438\044E \043F\043E \0438\0441\043F\043E\043B\044C\0437\0443\0435\043C\043E\0439 \0432\0435\0440\0441\0438\0438 MariaDB \043D\0430 \043F\0440\0435\0434\043C\0435\0442 \043A\043E\0440\0440\0435\043A\0442\043D\043E\0433\043E \0441\0438\043D\0442\0430\043A\0441\0438\0441\0430 \043E\043A\043E\043B\043E ''0123456789012345678901234
-# Connection default
+disconnect con1;
+connection default;
End of 5.5 tests
diff --git a/mysql-test/r/ctype_eucjpms.result b/mysql-test/r/ctype_eucjpms.result
index f9cb4f1eecc..bc7b4b9ef9d 100644
--- a/mysql-test/r/ctype_eucjpms.result
+++ b/mysql-test/r/ctype_eucjpms.result
@@ -9881,30 +9881,18 @@ CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
hex(concat(repeat(0xF1F2, 10), '%'))
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
a hex(b) c
-2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
+2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
SET collation_connection='eucjpms_bin';
create table t1 select repeat('a',4000) a;
@@ -9988,30 +9976,18 @@ CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
hex(concat(repeat(0xF1F2, 10), '%'))
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
a hex(b) c
-2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
+2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
select hex(convert(_eucjpms 0xA5FE41 using ucs2));
hex(convert(_eucjpms 0xA5FE41 using ucs2))
@@ -10040,18 +10016,18 @@ CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1
CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT 'XXXXXX' AS code, ' ' AS a LIMIT 0;
-INSERT INTO t1 (code) SELECT concat('8E', head) FROM head
+INSERT IGNORE INTO t1 (code) SELECT concat('8E', head) FROM head
WHERE (head BETWEEN 'A1' AND 'DF') ORDER BY head;
Warnings:
Warning 1364 Field 'a' doesn't have a default value
-INSERT INTO t1 (code) SELECT concat(head, tail)
+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;
Warnings:
Warning 1364 Field 'a' doesn't have a default value
-INSERT INTO t1 (code) SELECT concat('8F', head, tail)
+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;
@@ -10064,7 +10040,7 @@ t1 CREATE TABLE `t1` (
`code` varchar(6) CHARACTER SET eucjpms NOT NULL,
`a` varchar(1) CHARACTER SET eucjpms NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-UPDATE t1 SET a=unhex(code) ORDER BY code;
+UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
Warnings:
Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1
Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2
@@ -33013,7 +32989,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET eucjpms NOT NULL
+ `a` varchar(5) CHARACTER SET eucjpms DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -33446,7 +33422,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET eucjpms COLLATE eucjpms_bin NOT NULL
+ `a` varchar(5) CHARACTER SET eucjpms COLLATE eucjpms_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -33861,7 +33837,7 @@ hex(weight_string(cast(0x8FA2C38FA2C38FA2C3 as char),25, 4, 0xC0))
# MDEV-6776 ujis and eucjmps erroneously accept 0x8EA0 as a valid byte sequence
#
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET eucjpms);
-INSERT INTO t1 VALUES (0x8EA0);
+INSERT IGNORE INTO t1 VALUES (0x8EA0);
SELECT HEX(a), CHAR_LENGTH(a) FROM t1;
HEX(a) CHAR_LENGTH(a)
3F3F 2
@@ -33913,3 +33889,582 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
+#
+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;
+HEX(a)
+3F
+78787831
+3F3F
+78787832
+8FA1A1
+78787833
+3F3F
+DROP TABLE t1;
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET character_set_connection=eucjpms;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'eucjpms_japanese_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE eucjpms_japanese_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=eucjpms COLLATE=eucjpms_japanese_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'eucjpms_japanese_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'eucjpms_japanese_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'eucjpms_japanese_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'eucjpms_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'eucjpms_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'eucjpms_japanese_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_japanese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_japanese_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'eucjpms_japanese_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_japanese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_japanese_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'eucjpms_japanese_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE eucjpms_japanese_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=eucjpms COLLATE=eucjpms_japanese_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'eucjpms_japanese_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'eucjpms_japanese_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'eucjpms_japanese_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'eucjpms_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'eucjpms_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'eucjpms_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'eucjpms_japanese_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'eucjpms_japanese_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_japanese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_japanese_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'eucjpms_japanese_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_japanese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_japanese_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'eucjpms_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE eucjpms_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=eucjpms COLLATE=eucjpms_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'eucjpms_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'eucjpms_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'eucjpms_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'eucjpms_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'eucjpms_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'eucjpms_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'eucjpms_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'eucjpms_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'eucjpms_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'eucjpms_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'eucjpms_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'eucjpms_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE eucjpms_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=eucjpms COLLATE=eucjpms_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'eucjpms_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'eucjpms_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'eucjpms_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'eucjpms_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'eucjpms_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'eucjpms_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'eucjpms_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'eucjpms_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'eucjpms_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'eucjpms_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'eucjpms_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'eucjpms_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'eucjpms_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_euckr.result b/mysql-test/r/ctype_euckr.result
index 90353c6af2a..3fb6f98b2eb 100644
--- a/mysql-test/r/ctype_euckr.result
+++ b/mysql-test/r/ctype_euckr.result
@@ -55,7 +55,7 @@ want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
-insert into t1 values (),();
+insert ignore into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
@@ -224,30 +224,18 @@ CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
hex(concat(repeat(0xF1F2, 10), '%'))
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
a hex(b) c
-2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
+2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
SET collation_connection='euckr_bin';
create table t1 select repeat('a',4000) a;
@@ -371,30 +359,18 @@ CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
hex(concat(repeat(0xF1F2, 10), '%'))
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
a hex(b) c
-2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
+2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
SET NAMES euckr;
CREATE TABLE t1 (a text) character set euckr;
@@ -411,22 +387,22 @@ insert into t1 values (0xA161);
insert into t1 values (0xA17A);
insert into t1 values (0xA181);
insert into t1 values (0xA1FE);
-insert into t1 values (0xA140);
+insert ignore into t1 values (0xA140);
Warnings:
Warning 1366 Incorrect string value: '\xA1@' for column 's1' at row 1
-insert into t1 values (0xA15B);
+insert ignore into t1 values (0xA15B);
Warnings:
Warning 1366 Incorrect string value: '\xA1[' for column 's1' at row 1
-insert into t1 values (0xA160);
+insert ignore into t1 values (0xA160);
Warnings:
Warning 1366 Incorrect string value: '\xA1`' for column 's1' at row 1
-insert into t1 values (0xA17B);
+insert ignore into t1 values (0xA17B);
Warnings:
Warning 1366 Incorrect string value: '\xA1{' for column 's1' at row 1
-insert into t1 values (0xA180);
+insert ignore into t1 values (0xA180);
Warnings:
Warning 1366 Incorrect string value: '\xA1\x80' for column 's1' at row 1
-insert into t1 values (0xA1FF);
+insert ignore into t1 values (0xA1FF);
Warnings:
Warning 1366 Incorrect string value: '\xA1\xFF' for column 's1' at row 1
select hex(s1), hex(convert(s1 using utf8)) from t1 order by binary s1;
@@ -1985,7 +1961,7 @@ FE7F
FE80
DELETE FROM t2 WHERE a='?';
ALTER TABLE t2 ADD u VARCHAR(1) CHARACTER SET utf8, ADD a2 VARCHAR(1) CHARACTER SET euckr;
-UPDATE t2 SET u=a, a2=u;
+UPDATE IGNORE t2 SET u=a, a2=u;
SELECT s as unassigned_code FROM t2 WHERE u='?';
unassigned_code
A2E8
@@ -24450,7 +24426,7 @@ t1 CREATE TABLE `t1` (
`code` varchar(8) DEFAULT NULL,
`a` varchar(1) CHARACTER SET euckr NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-UPDATE t1 SET a=unhex(code) ORDER BY code;
+UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
Warnings:
Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1
Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2
@@ -24935,7 +24911,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET euckr NOT NULL
+ `a` varchar(5) CHARACTER SET euckr DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -25194,7 +25170,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET euckr COLLATE euckr_bin NOT NULL
+ `a` varchar(5) CHARACTER SET euckr COLLATE euckr_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -25428,3 +25404,567 @@ A1A1A1A1A1A120202020202020202020202020202020202020
#
# End of 5.6 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET character_set_connection=euckr;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'euckr_korean_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE euckr_korean_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=euckr COLLATE=euckr_korean_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'euckr_korean_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'euckr_korean_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'euckr_korean_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'euckr_korean_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'euckr_korean_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'euckr_korean_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_korean_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_korean_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'euckr_korean_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_korean_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_korean_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'euckr_korean_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE euckr_korean_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=euckr COLLATE=euckr_korean_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'euckr_korean_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'euckr_korean_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'euckr_korean_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'euckr_korean_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'euckr_korean_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'euckr_korean_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'euckr_korean_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'euckr_korean_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_korean_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_korean_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'euckr_korean_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_korean_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_korean_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'euckr_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE euckr_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=euckr COLLATE=euckr_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'euckr_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'euckr_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'euckr_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'euckr_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'euckr_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'euckr_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'euckr_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'euckr_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'euckr_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'euckr_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'euckr_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'euckr_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'euckr_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'euckr_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'euckr_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'euckr_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE euckr_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=euckr COLLATE=euckr_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'euckr_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'euckr_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'euckr_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'euckr_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'euckr_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'euckr_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'euckr_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'euckr_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'euckr_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'euckr_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'euckr_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'euckr_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'euckr_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'euckr_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'euckr_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'euckr_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_gb2312.result b/mysql-test/r/ctype_gb2312.result
index f9f37c00a79..c3c2eee9b1c 100644
--- a/mysql-test/r/ctype_gb2312.result
+++ b/mysql-test/r/ctype_gb2312.result
@@ -55,7 +55,7 @@ want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
-insert into t1 values (),();
+insert ignore into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
@@ -224,30 +224,18 @@ CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
hex(concat(repeat(0xF1F2, 10), '%'))
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
a hex(b) c
-2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
+2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
drop table if exists t1;
create table t1 select repeat('a',10) as c1;
@@ -452,30 +440,18 @@ CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
hex(concat(repeat(0xF1F2, 10), '%'))
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
a hex(b) c
-2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
+2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
SET NAMES gb2312;
CREATE TABLE t1 (a text) character set gb2312;
@@ -511,7 +487,7 @@ t1 CREATE TABLE `t1` (
`code` varchar(8) DEFAULT NULL,
`a` varchar(1) CHARACTER SET gb2312 NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-UPDATE t1 SET a=unhex(code) ORDER BY code;
+UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
Warnings:
Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1
Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2
@@ -962,7 +938,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET gb2312 NOT NULL
+ `a` varchar(5) CHARACTER SET gb2312 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1221,7 +1197,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET gb2312 COLLATE gb2312_bin NOT NULL
+ `a` varchar(5) CHARACTER SET gb2312 COLLATE gb2312_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1459,6 +1435,7 @@ A1A1A1A1A1A120202020202020202020202020202020202020
# Start of 10.0 tests
#
# Start of ctype_unescape.inc
+SET sql_mode = '';
SET @query=_binary'SELECT CHARSET(\'test\'),@@character_set_client,@@character_set_connection';
PREPARE stmt FROM @query;
EXECUTE stmt;
@@ -4521,7 +4498,572 @@ DROP FUNCTION wellformedness;
DROP FUNCTION mysql_real_escape_string_generated;
DROP FUNCTION iswellformed;
DROP TABLE allbytes;
+SET sql_mode = DEFAULT;
# End of ctype_backslash.inc
#
# End of 10.0 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET character_set_connection=gb2312;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gb2312_chinese_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE gb2312_chinese_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=gb2312 COLLATE=gb2312_chinese_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'gb2312_chinese_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gb2312_chinese_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'gb2312_chinese_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'gb2312_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'gb2312_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gb2312_chinese_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_chinese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_chinese_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'gb2312_chinese_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_chinese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_chinese_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gb2312_chinese_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE gb2312_chinese_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=gb2312 COLLATE=gb2312_chinese_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'gb2312_chinese_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gb2312_chinese_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'gb2312_chinese_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'gb2312_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'gb2312_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'gb2312_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'gb2312_chinese_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gb2312_chinese_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_chinese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_chinese_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'gb2312_chinese_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_chinese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_chinese_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gb2312_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE gb2312_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=gb2312 COLLATE=gb2312_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'gb2312_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gb2312_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'gb2312_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'gb2312_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'gb2312_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'gb2312_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'gb2312_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'gb2312_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'gb2312_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'gb2312_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'gb2312_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'gb2312_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'gb2312_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gb2312_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'gb2312_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gb2312_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE gb2312_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=gb2312 COLLATE=gb2312_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'gb2312_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gb2312_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'gb2312_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'gb2312_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'gb2312_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'gb2312_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'gb2312_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'gb2312_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'gb2312_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'gb2312_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'gb2312_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'gb2312_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'gb2312_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gb2312_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'gb2312_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gb2312_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_gbk.result b/mysql-test/r/ctype_gbk.result
index d10d5f4bf75..5244d6eb333 100644
--- a/mysql-test/r/ctype_gbk.result
+++ b/mysql-test/r/ctype_gbk.result
@@ -55,7 +55,7 @@ want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
-insert into t1 values (),();
+insert ignore into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
@@ -224,30 +224,18 @@ CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
hex(concat(repeat(0xF1F2, 10), '%'))
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
a hex(b) c
-2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
+2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
drop table if exists t1;
create table t1 select repeat('a',10) as c1;
@@ -452,30 +440,18 @@ CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
hex(concat(repeat(0xF1F2, 10), '%'))
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
a hex(b) c
-2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
+2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
SET NAMES gbk;
CREATE TABLE t1 (a text) character set gbk;
@@ -533,7 +509,7 @@ t1 CREATE TABLE `t1` (
`code` varchar(8) DEFAULT NULL,
`a` varchar(1) CHARACTER SET gbk NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-UPDATE t1 SET a=unhex(code) ORDER BY code;
+UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
Warnings:
Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1
Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2
@@ -996,7 +972,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET gbk NOT NULL
+ `a` varchar(5) CHARACTER SET gbk DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1429,7 +1405,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET gbk COLLATE gbk_bin NOT NULL
+ `a` varchar(5) CHARACTER SET gbk COLLATE gbk_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1841,6 +1817,7 @@ hex(weight_string(cast(0x8EA18EA18EA1 as char),25, 4, 0xC0))
# Start of 10.0 tests
#
# Start of ctype_unescape.inc
+SET sql_mode = '';
SET @query=_binary'SELECT CHARSET(\'test\'),@@character_set_client,@@character_set_connection';
PREPARE stmt FROM @query;
EXECUTE stmt;
@@ -4903,6 +4880,7 @@ DROP FUNCTION wellformedness;
DROP FUNCTION mysql_real_escape_string_generated;
DROP FUNCTION iswellformed;
DROP TABLE allbytes;
+SET sql_mode = DEFAULT;
# End of ctype_backslash.inc
SET NAMES gbk;
# Start of ctype_E05C.inc
@@ -4946,7 +4924,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET gbk NOT NULL
+ `a` varchar(10) CHARACTER SET gbk DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\'),('à\t');
INSERT INTO t1 VALUES ('\\à\'),('\\à\t'),('\\à\t\t');
@@ -4985,7 +4963,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET gbk NOT NULL
+ `a` varchar(10) CHARACTER SET gbk DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (BINARY('à\')),(BINARY('à\t'));
INSERT INTO t1 VALUES (BINARY('\\à\')),(BINARY('\\à\t')),(BINARY('\\à\t\t'));
@@ -5024,7 +5002,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET gbk NOT NULL
+ `a` varchar(10) CHARACTER SET gbk DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_BINARY'à\'),(_BINARY'à\t');
INSERT INTO t1 VALUES (_BINARY'\\à\'),(_BINARY'\\à\t'),(_BINARY'\\à\t\t');
@@ -5070,7 +5048,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET gbk NOT NULL
+ `a` varchar(10) CHARACTER SET gbk DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\['),('\à\[');
SELECT HEX(a) FROM t1;
@@ -5090,7 +5068,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varbinary(10) NOT NULL
+ `a` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\['),('\à\[');
SELECT HEX(a) FROM t1;
@@ -5111,7 +5089,7 @@ a
CREATE VIEW v1 AS SELECT a<>0xEE5D AS a FROM t1;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`a` <> 0xee5d) AS `a` from `t1` latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` <> 0xee5d AS `a` from `t1` latin1 latin1_swedish_ci
SELECT * FROM v1;
a
0
@@ -5187,7 +5165,7 @@ DELETE FROM t3;
# Sequences that start with a tail or a bad byte,
# or end with a bad byte, all should be fixed.
#
-INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
+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;
Warnings:
@@ -5242,7 +5220,7 @@ DELETE FROM t3;
# Sequences that start with an ASCII or an MB2 character,
# followed by a non-ASCII tail, all should be fixed.
#
-INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
+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;
@@ -5396,7 +5374,7 @@ DELETE FROM t3;
# Sequences that start with a tail or a bad byte,
# or have a bad byte, all should be fixed.
#
-INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
+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;
Warnings:
@@ -5640,7 +5618,7 @@ DELETE FROM t3;
# Sequences that start with an ASCII or an MB2 character,
# followed by a pure non-ASCII tail, all should be fixed.
#
-INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
+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;
@@ -5706,7 +5684,7 @@ DELETE FROM t3;
# Sequences that consist of two ASCII or MB2 characters,
# followed by a pure non-ASCII tail, all should be fixed.
#
-INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
+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'
@@ -5757,7 +5735,7 @@ DELETE FROM t3;
# Sequences that consist of two MB2 characters,
# followed by a non-ASCII head or tail, all should be fixed.
#
-INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
+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)
@@ -5845,7 +5823,7 @@ SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b;
HEX(c) HEX(b) comment
DELETE FROM t2 WHERE b IN (SELECT b FROM t3);
DELETE FROM t3;
-INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 ORDER BY b;
+INSERT IGNORE INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 ORDER BY b;
Warnings:
Warning 1366 Incorrect string value: '\x81' for column 'c' at row 1
Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 3
@@ -5931,6 +5909,7 @@ DROP TABLE t1;
#
# MDEV-7661 Unexpected result for: CAST(0xHHHH AS CHAR CHARACTER SET xxx) for incorrect byte sequences
#
+set sql_mode='';
SELECT HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312));
HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312))
3F41
@@ -5941,6 +5920,586 @@ HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8))
3F41
Warnings:
Warning 1300 Invalid gb2312 character string: '\xA3A'
+set sql_mode=default;
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9811 LOAD DATA INFILE does not work well with gbk in some cases
+#
+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;
+HEX(a)
+B04061B041
+B042
+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;
+HEX(a)
+B042
+DROP TABLE t1;
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET character_set_connection=gbk;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gbk_chinese_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE gbk_chinese_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=gbk COLLATE=gbk_chinese_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'gbk_chinese_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gbk_chinese_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'gbk_chinese_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'gbk_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'gbk_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gbk_chinese_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_chinese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_chinese_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'gbk_chinese_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_chinese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_chinese_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gbk_chinese_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE gbk_chinese_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=gbk COLLATE=gbk_chinese_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'gbk_chinese_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gbk_chinese_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'gbk_chinese_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'gbk_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'gbk_chinese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'gbk_chinese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'gbk_chinese_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gbk_chinese_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_chinese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_chinese_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'gbk_chinese_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_chinese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_chinese_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gbk_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE gbk_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=gbk COLLATE=gbk_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'gbk_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gbk_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'gbk_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'gbk_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'gbk_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'gbk_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'gbk_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'gbk_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'gbk_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'gbk_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'gbk_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'gbk_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'gbk_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gbk_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'gbk_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'gbk_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE gbk_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=gbk COLLATE=gbk_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'gbk_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gbk_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'gbk_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'gbk_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'gbk_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'gbk_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'gbk_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'gbk_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'gbk_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'gbk_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'gbk_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'gbk_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'gbk_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'gbk_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'gbk_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'gbk_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_gbk_export_import.result b/mysql-test/r/ctype_gbk_export_import.result
new file mode 100644
index 00000000000..d7d5aa98f02
--- /dev/null
+++ b/mysql-test/r/ctype_gbk_export_import.result
@@ -0,0 +1,3903 @@
+DROP DATABASE IF EXISTS gbk;
+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);
+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|
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `a1` text NOT NULL,
+ `a2` text CHARACTER SET utf8 NOT NULL,
+ `b1` blob NOT NULL,
+ `eol` text NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=gbk
+#
+# Dump using SELECT INTO OUTFILE
+#
+Start of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=auto }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto
+INFILE: --default-character-set=auto
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=auto }
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=auto CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto
+INFILE: --default-character-set=auto CHARACTER SET gbk
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=auto CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=auto CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto
+INFILE: --default-character-set=auto CHARACTER SET utf8
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=auto CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=auto CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto
+INFILE: --default-character-set=auto CHARACTER SET binary
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=auto CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=gbk }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto
+INFILE: --default-character-set=gbk
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=gbk }
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=gbk CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto
+INFILE: --default-character-set=gbk CHARACTER SET gbk
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=gbk CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=gbk CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto
+INFILE: --default-character-set=gbk CHARACTER SET utf8
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=gbk CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=gbk CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto
+INFILE: --default-character-set=gbk CHARACTER SET binary
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=gbk CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=utf8 }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto
+INFILE: --default-character-set=utf8
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=utf8 }
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=utf8 CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto
+INFILE: --default-character-set=utf8 CHARACTER SET gbk
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=utf8 CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=utf8 CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto
+INFILE: --default-character-set=utf8 CHARACTER SET utf8
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=utf8 CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=utf8 CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto
+INFILE: --default-character-set=utf8 CHARACTER SET binary
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto }{--default-character-set=utf8 CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=auto }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET gbk
+INFILE: --default-character-set=auto
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=auto }
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET gbk
+INFILE: --default-character-set=auto CHARACTER SET gbk
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET gbk
+INFILE: --default-character-set=auto CHARACTER SET utf8
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET gbk
+INFILE: --default-character-set=auto CHARACTER SET binary
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F093F093F0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09EE5C09EE5C0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=gbk }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET gbk
+INFILE: --default-character-set=gbk
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=gbk }
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET gbk
+INFILE: --default-character-set=gbk CHARACTER SET gbk
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET gbk
+INFILE: --default-character-set=gbk CHARACTER SET utf8
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET gbk
+INFILE: --default-character-set=gbk CHARACTER SET binary
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F093F093F0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09EE5C09EE5C0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=utf8 }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET gbk
+INFILE: --default-character-set=utf8
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=utf8 }
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET gbk
+INFILE: --default-character-set=utf8 CHARACTER SET gbk
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET gbk
+INFILE: --default-character-set=utf8 CHARACTER SET utf8
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET gbk
+INFILE: --default-character-set=utf8 CHARACTER SET binary
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F093F093F0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09EE5C09EE5C0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=auto }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET utf8
+INFILE: --default-character-set=auto
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=auto }
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET utf8
+INFILE: --default-character-set=auto CHARACTER SET gbk
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET utf8
+INFILE: --default-character-set=auto CHARACTER SET utf8
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET utf8
+INFILE: --default-character-set=auto CHARACTER SET binary
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=gbk }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET utf8
+INFILE: --default-character-set=gbk
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=gbk }
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET utf8
+INFILE: --default-character-set=gbk CHARACTER SET gbk
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET utf8
+INFILE: --default-character-set=gbk CHARACTER SET utf8
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET utf8
+INFILE: --default-character-set=gbk CHARACTER SET binary
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=utf8 }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET utf8
+INFILE: --default-character-set=utf8
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=utf8 }
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET utf8
+INFILE: --default-character-set=utf8 CHARACTER SET gbk
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET utf8
+INFILE: --default-character-set=utf8 CHARACTER SET utf8
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET utf8
+INFILE: --default-character-set=utf8 CHARACTER SET binary
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=auto }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET binary
+INFILE: --default-character-set=auto
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=auto }
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=auto CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET binary
+INFILE: --default-character-set=auto CHARACTER SET gbk
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=auto CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=auto CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET binary
+INFILE: --default-character-set=auto CHARACTER SET utf8
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=auto CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=auto CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET binary
+INFILE: --default-character-set=auto CHARACTER SET binary
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=auto CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=gbk }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET binary
+INFILE: --default-character-set=gbk
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=gbk }
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET binary
+INFILE: --default-character-set=gbk CHARACTER SET gbk
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET binary
+INFILE: --default-character-set=gbk CHARACTER SET utf8
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET binary
+INFILE: --default-character-set=gbk CHARACTER SET binary
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=utf8 }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET binary
+INFILE: --default-character-set=utf8
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=utf8 }
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET binary
+INFILE: --default-character-set=utf8 CHARACTER SET gbk
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET binary
+INFILE: --default-character-set=utf8 CHARACTER SET utf8
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=auto CHARACTER SET binary
+INFILE: --default-character-set=utf8 CHARACTER SET binary
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=auto CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=auto }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk
+INFILE: --default-character-set=auto
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=auto }
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=auto CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk
+INFILE: --default-character-set=auto CHARACTER SET gbk
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=auto CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=auto CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk
+INFILE: --default-character-set=auto CHARACTER SET utf8
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=auto CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=auto CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk
+INFILE: --default-character-set=auto CHARACTER SET binary
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=auto CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=gbk }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk
+INFILE: --default-character-set=gbk
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=gbk }
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=gbk CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk
+INFILE: --default-character-set=gbk CHARACTER SET gbk
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=gbk CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=gbk CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk
+INFILE: --default-character-set=gbk CHARACTER SET utf8
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=gbk CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=gbk CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk
+INFILE: --default-character-set=gbk CHARACTER SET binary
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=gbk CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=utf8 }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk
+INFILE: --default-character-set=utf8
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=utf8 }
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=utf8 CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk
+INFILE: --default-character-set=utf8 CHARACTER SET gbk
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=utf8 CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=utf8 CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk
+INFILE: --default-character-set=utf8 CHARACTER SET utf8
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=utf8 CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=utf8 CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk
+INFILE: --default-character-set=utf8 CHARACTER SET binary
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk }{--default-character-set=utf8 CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=auto }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET gbk
+INFILE: --default-character-set=auto
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=auto }
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET gbk
+INFILE: --default-character-set=auto CHARACTER SET gbk
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET gbk
+INFILE: --default-character-set=auto CHARACTER SET utf8
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET gbk
+INFILE: --default-character-set=auto CHARACTER SET binary
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F093F093F0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09EE5C09EE5C0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=gbk }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET gbk
+INFILE: --default-character-set=gbk
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=gbk }
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET gbk
+INFILE: --default-character-set=gbk CHARACTER SET gbk
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET gbk
+INFILE: --default-character-set=gbk CHARACTER SET utf8
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET gbk
+INFILE: --default-character-set=gbk CHARACTER SET binary
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F093F093F0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09EE5C09EE5C0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=utf8 }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET gbk
+INFILE: --default-character-set=utf8
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=utf8 }
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET gbk
+INFILE: --default-character-set=utf8 CHARACTER SET gbk
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET gbk
+INFILE: --default-character-set=utf8 CHARACTER SET utf8
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET gbk
+INFILE: --default-character-set=utf8 CHARACTER SET binary
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F093F093F0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09EE5C09EE5C0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=auto }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET utf8
+INFILE: --default-character-set=auto
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=auto }
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET utf8
+INFILE: --default-character-set=auto CHARACTER SET gbk
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET utf8
+INFILE: --default-character-set=auto CHARACTER SET utf8
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET utf8
+INFILE: --default-character-set=auto CHARACTER SET binary
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=gbk }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET utf8
+INFILE: --default-character-set=gbk
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=gbk }
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET utf8
+INFILE: --default-character-set=gbk CHARACTER SET gbk
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET utf8
+INFILE: --default-character-set=gbk CHARACTER SET utf8
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET utf8
+INFILE: --default-character-set=gbk CHARACTER SET binary
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=utf8 }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET utf8
+INFILE: --default-character-set=utf8
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=utf8 }
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET utf8
+INFILE: --default-character-set=utf8 CHARACTER SET gbk
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET utf8
+INFILE: --default-character-set=utf8 CHARACTER SET utf8
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET utf8
+INFILE: --default-character-set=utf8 CHARACTER SET binary
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=auto }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET binary
+INFILE: --default-character-set=auto
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=auto }
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=auto CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET binary
+INFILE: --default-character-set=auto CHARACTER SET gbk
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=auto CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=auto CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET binary
+INFILE: --default-character-set=auto CHARACTER SET utf8
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=auto CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=auto CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET binary
+INFILE: --default-character-set=auto CHARACTER SET binary
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=auto CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=gbk }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET binary
+INFILE: --default-character-set=gbk
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=gbk }
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET binary
+INFILE: --default-character-set=gbk CHARACTER SET gbk
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET binary
+INFILE: --default-character-set=gbk CHARACTER SET utf8
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET binary
+INFILE: --default-character-set=gbk CHARACTER SET binary
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=utf8 }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET binary
+INFILE: --default-character-set=utf8
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=utf8 }
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET binary
+INFILE: --default-character-set=utf8 CHARACTER SET gbk
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET binary
+INFILE: --default-character-set=utf8 CHARACTER SET utf8
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=gbk CHARACTER SET binary
+INFILE: --default-character-set=utf8 CHARACTER SET binary
+file 31-EE5C-E9A0AB-5CEE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-5CEE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=auto }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8
+INFILE: --default-character-set=auto
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=auto }
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=auto CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8
+INFILE: --default-character-set=auto CHARACTER SET gbk
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=auto CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=auto CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8
+INFILE: --default-character-set=auto CHARACTER SET utf8
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=auto CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=auto CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8
+INFILE: --default-character-set=auto CHARACTER SET binary
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=auto CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=gbk }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8
+INFILE: --default-character-set=gbk
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=gbk }
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=gbk CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8
+INFILE: --default-character-set=gbk CHARACTER SET gbk
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=gbk CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=gbk CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8
+INFILE: --default-character-set=gbk CHARACTER SET utf8
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=gbk CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=gbk CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8
+INFILE: --default-character-set=gbk CHARACTER SET binary
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=gbk CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=utf8 }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8
+INFILE: --default-character-set=utf8
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=utf8 }
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=utf8 CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8
+INFILE: --default-character-set=utf8 CHARACTER SET gbk
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=utf8 CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=utf8 CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8
+INFILE: --default-character-set=utf8 CHARACTER SET utf8
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=utf8 CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=utf8 CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8
+INFILE: --default-character-set=utf8 CHARACTER SET binary
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 }{--default-character-set=utf8 CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=auto }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET gbk
+INFILE: --default-character-set=auto
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=auto }
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET gbk
+INFILE: --default-character-set=auto CHARACTER SET gbk
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET gbk
+INFILE: --default-character-set=auto CHARACTER SET utf8
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET gbk
+INFILE: --default-character-set=auto CHARACTER SET binary
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F093F093F0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09EE5C09EE5C0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=auto CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=gbk }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET gbk
+INFILE: --default-character-set=gbk
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=gbk }
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET gbk
+INFILE: --default-character-set=gbk CHARACTER SET gbk
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET gbk
+INFILE: --default-character-set=gbk CHARACTER SET utf8
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET gbk
+INFILE: --default-character-set=gbk CHARACTER SET binary
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F093F093F0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09EE5C09EE5C0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=gbk CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=utf8 }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET gbk
+INFILE: --default-character-set=utf8
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=utf8 }
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET gbk
+INFILE: --default-character-set=utf8 CHARACTER SET gbk
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET gbk
+INFILE: --default-character-set=utf8 CHARACTER SET utf8
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET gbk
+INFILE: --default-character-set=utf8 CHARACTER SET binary
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F093F093F0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09EE5C09EE5C0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET gbk}{--default-character-set=utf8 CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=auto }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET utf8
+INFILE: --default-character-set=auto
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=auto }
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET utf8
+INFILE: --default-character-set=auto CHARACTER SET gbk
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET utf8
+INFILE: --default-character-set=auto CHARACTER SET utf8
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET utf8
+INFILE: --default-character-set=auto CHARACTER SET binary
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=auto CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=gbk }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET utf8
+INFILE: --default-character-set=gbk
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=gbk }
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET utf8
+INFILE: --default-character-set=gbk CHARACTER SET gbk
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET utf8
+INFILE: --default-character-set=gbk CHARACTER SET utf8
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET utf8
+INFILE: --default-character-set=gbk CHARACTER SET binary
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=gbk CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=utf8 }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET utf8
+INFILE: --default-character-set=utf8
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=utf8 }
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET utf8
+INFILE: --default-character-set=utf8 CHARACTER SET gbk
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET utf8
+INFILE: --default-character-set=utf8 CHARACTER SET utf8
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET utf8
+INFILE: --default-character-set=utf8 CHARACTER SET binary
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET utf8}{--default-character-set=utf8 CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=auto }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET binary
+INFILE: --default-character-set=auto
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=auto }
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=auto CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET binary
+INFILE: --default-character-set=auto CHARACTER SET gbk
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=auto CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=auto CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET binary
+INFILE: --default-character-set=auto CHARACTER SET utf8
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=auto CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=auto CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET binary
+INFILE: --default-character-set=auto CHARACTER SET binary
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=auto CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=gbk }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET binary
+INFILE: --default-character-set=gbk
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=gbk }
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET binary
+INFILE: --default-character-set=gbk CHARACTER SET gbk
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET binary
+INFILE: --default-character-set=gbk CHARACTER SET utf8
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET binary
+INFILE: --default-character-set=gbk CHARACTER SET binary
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=gbk CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=utf8 }
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET binary
+INFILE: --default-character-set=utf8
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=utf8 }
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET gbk}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET binary
+INFILE: --default-character-set=utf8 CHARACTER SET gbk
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET utf8}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET binary
+INFILE: --default-character-set=utf8 CHARACTER SET utf8
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET binary}
+Locale: zh_CN.gbk
+OUTFILE: --default-character-set=utf8 CHARACTER SET binary
+INFILE: --default-character-set=utf8 CHARACTER SET binary
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8 CHARACTER SET binary}{--default-character-set=utf8 CHARACTER SET binary}
+
+
+#
+# Dump using mysqldump -Tdir
+#
+Start of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=auto }
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=binary
+INFILE: --default-character-set=auto
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=auto }
+
+
+Start of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=auto CHARACTER SET gbk}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=binary
+INFILE: --default-character-set=auto CHARACTER SET gbk
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=auto CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=auto CHARACTER SET utf8}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=binary
+INFILE: --default-character-set=auto CHARACTER SET utf8
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=auto CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=auto CHARACTER SET binary}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=binary
+INFILE: --default-character-set=auto CHARACTER SET binary
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=auto CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=binary }
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=binary
+INFILE: --default-character-set=binary
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=binary }
+
+
+Start of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=binary CHARACTER SET gbk}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=binary
+INFILE: --default-character-set=binary CHARACTER SET gbk
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=binary CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=binary CHARACTER SET utf8}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=binary
+INFILE: --default-character-set=binary CHARACTER SET utf8
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=binary CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=binary CHARACTER SET binary}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=binary
+INFILE: --default-character-set=binary CHARACTER SET binary
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=binary CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=gbk }
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=binary
+INFILE: --default-character-set=gbk
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=gbk }
+
+
+Start of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=gbk CHARACTER SET gbk}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=binary
+INFILE: --default-character-set=gbk CHARACTER SET gbk
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=gbk CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=gbk CHARACTER SET utf8}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=binary
+INFILE: --default-character-set=gbk CHARACTER SET utf8
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=gbk CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=gbk CHARACTER SET binary}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=binary
+INFILE: --default-character-set=gbk CHARACTER SET binary
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=gbk CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=utf8 }
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=binary
+INFILE: --default-character-set=utf8
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=utf8 }
+
+
+Start of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=utf8 CHARACTER SET gbk}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=binary
+INFILE: --default-character-set=utf8 CHARACTER SET gbk
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9978B3F BAD-TEXT-UTF8
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C5C
+a2 E9978BE78E9509E9A0AB5C0924 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=utf8 CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=utf8 CHARACTER SET utf8}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=binary
+INFILE: --default-character-set=utf8 CHARACTER SET utf8
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 E9A0AB
+b1 EE5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 EE5C5C0924 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=utf8 CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=utf8 CHARACTER SET binary}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=binary
+INFILE: --default-character-set=utf8 CHARACTER SET binary
+file 31-EE5C-E9A0AB-EE5C5C-24|32-EE5C5C5C-E9A0AB5C5C-EE5C5C5C5C-24|
+id 1
+a1 3F09E9A03F BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09E9A0AB5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 24 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=binary}{--default-character-set=utf8 CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=auto }
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=gbk
+INFILE: --default-character-set=auto
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=auto }
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=auto CHARACTER SET gbk}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=gbk
+INFILE: --default-character-set=auto CHARACTER SET gbk
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=auto CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=auto CHARACTER SET utf8}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=gbk
+INFILE: --default-character-set=auto CHARACTER SET utf8
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=auto CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=auto CHARACTER SET binary}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=gbk
+INFILE: --default-character-set=auto CHARACTER SET binary
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F093F093F0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09EE5C09EE5C0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=auto CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=binary }
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=gbk
+INFILE: --default-character-set=binary
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=binary }
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=binary CHARACTER SET gbk}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=gbk
+INFILE: --default-character-set=binary CHARACTER SET gbk
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=binary CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=binary CHARACTER SET utf8}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=gbk
+INFILE: --default-character-set=binary CHARACTER SET utf8
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=binary CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=binary CHARACTER SET binary}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=gbk
+INFILE: --default-character-set=binary CHARACTER SET binary
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F093F093F0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09EE5C09EE5C0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=binary CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=gbk }
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=gbk
+INFILE: --default-character-set=gbk
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=gbk }
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=gbk CHARACTER SET gbk}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=gbk
+INFILE: --default-character-set=gbk CHARACTER SET gbk
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=gbk CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=gbk CHARACTER SET utf8}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=gbk
+INFILE: --default-character-set=gbk CHARACTER SET utf8
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=gbk CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=gbk CHARACTER SET binary}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=gbk
+INFILE: --default-character-set=gbk CHARACTER SET binary
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F093F093F0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09EE5C09EE5C0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=gbk CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=utf8 }
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=gbk
+INFILE: --default-character-set=utf8
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=utf8 }
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=utf8 CHARACTER SET gbk}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=gbk
+INFILE: --default-character-set=utf8 CHARACTER SET gbk
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=utf8 CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=utf8 CHARACTER SET utf8}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=gbk
+INFILE: --default-character-set=utf8 CHARACTER SET utf8
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F5C BAD-TEXT-GBK
+a2 3F5C BAD-TEXT-UTF8
+b1 EE5C
+eol 24
+--- ---
+id 2
+a1 3F5C5C BAD-TEXT-GBK
+a2 3F5C5C BAD-TEXT-UTF8
+b1 EE5C5C
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=utf8 CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=utf8 CHARACTER SET binary}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=gbk
+INFILE: --default-character-set=utf8 CHARACTER SET binary
+file 31-EE5C-EE5C-EE5C-24|32-EE5C5C5C-EE5C5C5C-EE5C5C5C-24|
+id 1
+a1 3F093F093F0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+id 2
+a1 EE5C09EE5C09EE5C0924 BAD-TEXT-GBK
+a2 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=gbk}{--default-character-set=utf8 CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=auto }
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=utf8
+INFILE: --default-character-set=auto
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=auto }
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=auto CHARACTER SET gbk}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=utf8
+INFILE: --default-character-set=auto CHARACTER SET gbk
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=auto CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=auto CHARACTER SET utf8}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=utf8
+INFILE: --default-character-set=auto CHARACTER SET utf8
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=auto CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=auto CHARACTER SET binary}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=utf8
+INFILE: --default-character-set=auto CHARACTER SET binary
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=auto CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=binary }
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=utf8
+INFILE: --default-character-set=binary
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=binary }
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=binary CHARACTER SET gbk}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=utf8
+INFILE: --default-character-set=binary CHARACTER SET gbk
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=binary CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=binary CHARACTER SET utf8}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=utf8
+INFILE: --default-character-set=binary CHARACTER SET utf8
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=binary CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=binary CHARACTER SET binary}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=utf8
+INFILE: --default-character-set=binary CHARACTER SET binary
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=binary CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=gbk }
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=utf8
+INFILE: --default-character-set=gbk
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=gbk }
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=gbk CHARACTER SET gbk}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=utf8
+INFILE: --default-character-set=gbk CHARACTER SET gbk
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=gbk CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=gbk CHARACTER SET utf8}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=utf8
+INFILE: --default-character-set=gbk CHARACTER SET utf8
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=gbk CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=gbk CHARACTER SET binary}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=utf8
+INFILE: --default-character-set=gbk CHARACTER SET binary
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=gbk CHARACTER SET binary}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=utf8 }
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=utf8
+INFILE: --default-character-set=utf8
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=utf8 }
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=utf8 CHARACTER SET gbk}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=utf8
+INFILE: --default-character-set=utf8 CHARACTER SET gbk
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9978B3F BAD-TEXT-UTF8
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C09E9A0AB5C093F5C5C BAD-TEXT-GBK
+a2 24 BAD-TEXT-UTF8
+b1 BAD-BLOB
+eol BAD-EOL
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=utf8 CHARACTER SET gbk}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=utf8 CHARACTER SET utf8}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=utf8
+INFILE: --default-character-set=utf8 CHARACTER SET utf8
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 EE5C
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 EE5C5C
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=utf8 CHARACTER SET utf8}
+
+
+Start of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=utf8 CHARACTER SET binary}
+Locale: zh_CN.gbk
+mysqldump: --default-character-set=utf8
+INFILE: --default-character-set=utf8 CHARACTER SET binary
+file 31-E9A0AB-E9A0AB-3F5C5C-24|32-E9A0AB5C5C-E9A0AB5C5C-3F5C5C5C5C-24|
+id 1
+a1 E9A03F BAD-TEXT-GBK
+a2 E9A0AB
+b1 3F5C BAD-BLOB
+eol 24
+--- ---
+id 2
+a1 E9A0AB5C BAD-TEXT-GBK
+a2 E9A0AB5C
+b1 3F5C5C BAD-BLOB
+eol 24
+--- ---
+End of {zh_CN.gbk}{--default-character-set=utf8}{--default-character-set=utf8 CHARACTER SET binary}
+
+
+DROP DATABASE gbk;
+USE test;
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index 66c5a37750d..cbf5f145d22 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -364,7 +364,7 @@ want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
-insert into t1 values (),();
+insert ignore into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
@@ -518,13 +518,28 @@ STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR))
CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0;
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
-subject varchar(64) NO NULL
-pattern varchar(64) NO NULL
+subject varchar(64) YES NULL
+pattern varchar(64) YES NULL
INSERT INTO t1 VALUES (_utf8'2001÷01÷01',_utf8'%Y÷%m÷%d');
SELECT HEX(subject),HEX(pattern),STR_TO_DATE(subject, pattern) FROM t1;
HEX(subject) HEX(pattern) STR_TO_DATE(subject, pattern)
32303031F73031F73031 2559F7256DF72564 2001-01-01 00:00:00.000000
DROP TABLE t1;
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+-1 1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+-1 1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+-1 1
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+-1 1
SET collation_connection='latin1_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -621,6 +636,21 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
c2h
ab_def
drop table t1;
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+-1 1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+-1 1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+-1 1
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+-1 1
CREATE TABLE „a (a int);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '„a (a int)' at line 1
SELECT '„a' as str;
@@ -689,7 +719,7 @@ create table t1 as select concat(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -702,7 +732,7 @@ create table t1 as select concat(18446744073709551615) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(20) NOT NULL
+ `c1` varchar(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -715,7 +745,7 @@ create table t1 as select concat(1.1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) NOT NULL
+ `c1` varchar(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -728,7 +758,7 @@ create table t1 as select concat(1+2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) NOT NULL
+ `c1` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1-2));
@@ -738,7 +768,7 @@ create table t1 as select concat(1-2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) NOT NULL
+ `c1` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1*2));
@@ -748,7 +778,7 @@ create table t1 as select concat(1*2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) NOT NULL
+ `c1` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1/2));
@@ -788,7 +818,7 @@ create table t1 as select concat(-1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) NOT NULL
+ `c1` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(-(1+2)));
@@ -798,7 +828,7 @@ create table t1 as select concat(-(1+2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) NOT NULL
+ `c1` varchar(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1|2));
@@ -808,7 +838,7 @@ create table t1 as select concat(1|2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) NOT NULL
+ `c1` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1&2));
@@ -818,7 +848,7 @@ create table t1 as select concat(1&2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) NOT NULL
+ `c1` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_count(12)));
@@ -828,7 +858,7 @@ create table t1 as select concat(bit_count(12)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) NOT NULL
+ `c1` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2<<1));
@@ -838,7 +868,7 @@ create table t1 as select concat(2<<1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) NOT NULL
+ `c1` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2>>1));
@@ -848,7 +878,7 @@ create table t1 as select concat(2>>1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) NOT NULL
+ `c1` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(~0));
@@ -858,7 +888,7 @@ create table t1 as select concat(~0) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) NOT NULL
+ `c1` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(3^2));
@@ -868,7 +898,7 @@ create table t1 as select concat(3^2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) NOT NULL
+ `c1` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(abs(-2)));
@@ -878,7 +908,7 @@ create table t1 as select concat(abs(-2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) NOT NULL
+ `c1` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(concat(exp(2)),1));
@@ -1008,7 +1038,7 @@ create table t1 as select concat(degrees(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(23) NOT NULL
+ `c1` varchar(23) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(radians(0)));
@@ -1018,7 +1048,7 @@ create table t1 as select concat(radians(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(23) NOT NULL
+ `c1` varchar(23) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ceiling(0.5)));
@@ -1028,7 +1058,7 @@ create table t1 as select concat(ceiling(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) NOT NULL
+ `c1` varchar(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
@@ -1038,7 +1068,7 @@ create table t1 as select concat(floor(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) NOT NULL
+ `c1` varchar(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
@@ -1048,7 +1078,7 @@ create table t1 as select concat(round(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) NOT NULL
+ `c1` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sign(0.5)));
@@ -1058,14 +1088,14 @@ create table t1 as select concat(sign(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) NOT NULL
+ `c1` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(rand()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(23) NOT NULL
+ `c1` varchar(23) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(length('a')));
@@ -1075,7 +1105,7 @@ create table t1 as select concat(length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) NOT NULL
+ `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(char_length('a')));
@@ -1085,7 +1115,7 @@ create table t1 as select concat(char_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) NOT NULL
+ `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_length('a')));
@@ -1095,7 +1125,7 @@ create table t1 as select concat(bit_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) NOT NULL
+ `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coercibility('a')));
@@ -1105,7 +1135,7 @@ create table t1 as select concat(coercibility('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) NOT NULL
+ `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(locate('a','a')));
@@ -1115,7 +1145,7 @@ create table t1 as select concat(locate('a','a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(11) NOT NULL
+ `c1` varchar(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(field('c','a','b','c')));
@@ -1125,7 +1155,7 @@ create table t1 as select concat(field('c','a','b','c')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) NOT NULL
+ `c1` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ascii(61)));
@@ -1135,7 +1165,7 @@ create table t1 as select concat(ascii(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) NOT NULL
+ `c1` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ord(61)));
@@ -1145,7 +1175,7 @@ create table t1 as select concat(ord(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) NOT NULL
+ `c1` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(find_in_set('b','a,b,c,d')));
@@ -1155,7 +1185,7 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) NOT NULL
+ `c1` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select md5('a'), hex(md5('a'));
@@ -1165,7 +1195,7 @@ create table t1 as select md5('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(32) NOT NULL
+ `c1` varchar(32) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select old_password('a'), hex(old_password('a'));
@@ -1175,7 +1205,7 @@ create table t1 as select old_password('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(16) NOT NULL
+ `c1` varchar(16) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select password('a'), hex(password('a'));
@@ -1185,7 +1215,7 @@ create table t1 as select password('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(41) NOT NULL
+ `c1` varchar(41) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha('a'), hex(sha('a'));
@@ -1195,7 +1225,7 @@ create table t1 as select sha('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(40) NOT NULL
+ `c1` varchar(40) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha1('a'), hex(sha1('a'));
@@ -1205,7 +1235,7 @@ create table t1 as select sha1('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(40) NOT NULL
+ `c1` varchar(40) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('-1' as signed)));
@@ -1215,7 +1245,7 @@ create table t1 as select concat(cast('-1' as signed)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) NOT NULL
+ `c1` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('1' as unsigned)));
@@ -1225,7 +1255,7 @@ create table t1 as select concat(cast('1' as unsigned)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast(1/2 as decimal(5,5))));
@@ -1284,7 +1314,7 @@ create table t1 as select concat(least(1,2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) NOT NULL
+ `c1` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(greatest(1,2)));
@@ -1294,7 +1324,7 @@ create table t1 as select concat(greatest(1,2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) NOT NULL
+ `c1` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(case when 11 then 22 else 33 end));
@@ -1304,7 +1334,7 @@ create table t1 as select concat(case when 11 then 22 else 33 end) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) NOT NULL
+ `c1` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coalesce(1,2)));
@@ -1314,7 +1344,7 @@ create table t1 as select concat(coalesce(1,2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat_ws(1,2,3));
@@ -1324,7 +1354,7 @@ create table t1 as select concat_ws(1,2,3) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) NOT NULL
+ `c1` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(group_concat(1,2,3));
@@ -1334,7 +1364,7 @@ create table t1 as select group_concat(1,2,3) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` text
+ `c1` mediumtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select 1 as c1 union select 'a';
@@ -1352,7 +1382,7 @@ create table t1 as select concat(last_insert_id()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) NOT NULL
+ `c1` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(benchmark(0,0)));
@@ -1362,7 +1392,7 @@ create table t1 as select concat(benchmark(0,0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sleep(0)));
@@ -1372,7 +1402,7 @@ create table t1 as select concat(sleep(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) NOT NULL
+ `c1` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx')));
@@ -1406,7 +1436,7 @@ create table t1 as select concat(crc32('')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) NOT NULL
+ `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(uncompressed_length('')));
@@ -1423,7 +1453,7 @@ create table t1 as select concat(connection_id()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) NOT NULL
+ `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(inet_aton('127.1.1.1')));
@@ -1459,7 +1489,7 @@ create table t1 as select concat(row_count()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) NOT NULL
+ `c1` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(found_rows()));
@@ -1469,21 +1499,21 @@ create table t1 as select concat(found_rows()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) NOT NULL
+ `c1` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(uuid_short()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) NOT NULL
+ `c1` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(uuid()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(36) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(36) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select coercibility(uuid()), coercibility(cast('a' as char character set latin1));
@@ -1496,7 +1526,7 @@ create table t1 as select concat(uuid(), cast('a' as char character set latin1))
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(37) NOT NULL
+ `c1` varchar(37) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1;
@@ -1516,7 +1546,7 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL,
+ `c1` varchar(1) DEFAULT NULL,
`c2` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -1574,7 +1604,7 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) NOT NULL,
+ `c1` varchar(4) DEFAULT NULL,
`c2` decimal(2,1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -1590,7 +1620,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(83) DEFAULT NULL,
- `c2` decimal(65,30) DEFAULT NULL
+ `c2` decimal(65,38) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(@@ft_max_word_len));
@@ -1613,7 +1643,7 @@ create table t1 as select concat('a'='a' IS TRUE) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a'='a' IS NOT TRUE));
@@ -1623,7 +1653,7 @@ create table t1 as select concat('a'='a' IS NOT TRUE) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(NOT 'a'='a'));
@@ -1633,7 +1663,7 @@ create table t1 as select concat(NOT 'a'='a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NULL));
@@ -1643,7 +1673,7 @@ create table t1 as select concat('a' IS NULL) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NOT NULL));
@@ -1653,7 +1683,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' rlike 'a'));
@@ -1663,7 +1693,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(strcmp('a','b')));
@@ -1673,7 +1703,7 @@ create table t1 as select concat(strcmp('a','b')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) NOT NULL
+ `c1` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' like 'a'));
@@ -1683,7 +1713,7 @@ create table t1 as select concat('a' like 'b') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' between 'b' and 'c'));
@@ -1693,7 +1723,7 @@ create table t1 as select concat('a' between 'b' and 'c') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' in ('a','b')));
@@ -1703,7 +1733,7 @@ create table t1 as select concat('a' in ('a','b')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(interval(23, 1, 15, 17, 30, 44, 200)));
@@ -1713,7 +1743,7 @@ create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) NOT NULL
+ `c1` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a varchar(10), fulltext key(a));
@@ -1745,7 +1775,7 @@ create table t1 as select concat(ifnull(1,1)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ifnull(1.1,1.1)));
@@ -1755,7 +1785,7 @@ create table t1 as select concat(ifnull(1.1,1.1)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) NOT NULL
+ `c1` varchar(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(if(1,'b',1));
@@ -1785,7 +1815,7 @@ create table t1 as select concat(if(1,1,1)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(nullif(1,2)));
@@ -1940,7 +1970,7 @@ create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` longtext
+ `c1` longtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(period_add(200902, 2)));
@@ -1950,12 +1980,13 @@ create table t1 as select concat(period_add(200902, 2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(6) NOT NULL
+ `c1` varchar(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(period_diff(200902, 200802)));
hex(concat(period_diff(200902, 200802)))
3132
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t1 as select concat(period_add(200902, 200802)) as c1;
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
@@ -2159,21 +2190,21 @@ create table t1 as select concat(curdate()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) NOT NULL
+ `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(utc_date()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) NOT NULL
+ `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(curtime()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) NOT NULL
+ `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select repeat('a',20) as c1 limit 0;
@@ -2189,7 +2220,7 @@ create table t1 as select concat(utc_time()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) NOT NULL
+ `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sec_to_time(2378)));
@@ -2282,21 +2313,21 @@ create table t1 as select concat(now()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(19) NOT NULL
+ `c1` varchar(19) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(utc_timestamp()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(19) NOT NULL
+ `c1` varchar(19) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(sysdate()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(19) NOT NULL
+ `c1` varchar(19) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(addtime('00:00:00','11:22:33')));
@@ -2336,7 +2367,7 @@ create table t1 as select export_set(1,2,3,4,2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(127) NOT NULL
+ `c1` varchar(127) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(insert(1133,3,0,22));
@@ -2346,7 +2377,7 @@ create table t1 as select insert(1133,3,0,22) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(6) NOT NULL
+ `c1` varchar(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lcase(123));
@@ -2356,7 +2387,7 @@ create table t1 as select lcase(123) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) NOT NULL
+ `c1` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(123,1));
@@ -2366,7 +2397,7 @@ create table t1 as select left(123,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lower(123));
@@ -2376,7 +2407,7 @@ create table t1 as select lower(123) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) NOT NULL
+ `c1` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lpad(1,2,0));
@@ -2386,7 +2417,7 @@ create table t1 as select lpad(1,2,0) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) NOT NULL
+ `c1` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ltrim(1));
@@ -2396,7 +2427,7 @@ create table t1 as select ltrim(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(mid(1,1,1));
@@ -2406,7 +2437,7 @@ create table t1 as select mid(1,1,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(repeat(1,2));
@@ -2416,7 +2447,7 @@ create table t1 as select repeat(1,2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) NOT NULL
+ `c1` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(replace(1,1,2));
@@ -2426,7 +2457,7 @@ create table t1 as select replace(1,1,2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(reverse(12));
@@ -2436,7 +2467,7 @@ create table t1 as select reverse(12) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) NOT NULL
+ `c1` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(right(123,1));
@@ -2446,7 +2477,7 @@ create table t1 as select right(123,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rpad(1,2,0));
@@ -2456,7 +2487,7 @@ create table t1 as select rpad(1,2,0) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) NOT NULL
+ `c1` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rtrim(1));
@@ -2466,7 +2497,7 @@ create table t1 as select rtrim(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(soundex(1));
@@ -2476,7 +2507,7 @@ create table t1 as select soundex(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) NOT NULL
+ `c1` varchar(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(substring(1,1,1));
@@ -2486,7 +2517,7 @@ create table t1 as select substring(1,1,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(trim(1));
@@ -2496,7 +2527,7 @@ create table t1 as select trim(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ucase(1));
@@ -2506,7 +2537,7 @@ create table t1 as select ucase(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(upper(1));
@@ -2516,14 +2547,14 @@ create table t1 as select upper(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) NOT NULL
+ `c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select repeat(' ', 64) as a limit 0;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(64) NOT NULL
+ `a` varchar(64) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ("1.1"), ("2.1");
select a, hex(a) from t1;
@@ -2773,7 +2804,7 @@ create table t2 as select concat(a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `concat(a)` varchar(19) NOT NULL
+ `concat(a)` varchar(19) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a date);
@@ -3072,7 +3103,7 @@ insert into t1 values ('2001-02-03 04:05:06');
create view v1(a) as select concat(a) from t1;
show columns from v1;
Field Type Null Key Default Extra
-a varchar(19) NO
+a varchar(19) YES NULL
select hex(a) from v1;
hex(a)
303030302D30302D30302030303A30303A3030
@@ -3297,7 +3328,7 @@ GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END)
1234567
SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(a,'') 253 9 7 Y 0 31 8
+def COALESCE(a,'') 253 9 7 Y 0 39 8
COALESCE(a,'')
1234567
# All columns must be VARCHAR(9) with the same length:
@@ -3323,14 +3354,14 @@ CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `CONCAT_WS(1,2,3)` varchar(3) NOT NULL
+ `CONCAT_WS(1,2,3)` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `INSERT(1133,3,0,22)` varchar(6) NOT NULL
+ `INSERT(1133,3,0,22)` varchar(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
@@ -3351,35 +3382,35 @@ CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `REPEAT(1,2)` varchar(2) NOT NULL
+ `REPEAT(1,2)` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `LEFT(123,2)` varchar(2) NOT NULL
+ `LEFT(123,2)` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `RIGHT(123,2)` varchar(2) NOT NULL
+ `RIGHT(123,2)` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `LTRIM(123)` varchar(3) NOT NULL
+ `LTRIM(123)` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `RTRIM(123)` varchar(3) NOT NULL
+ `RTRIM(123)` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
@@ -3393,35 +3424,35 @@ CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `REPLACE(111,2,3)` varchar(3) NOT NULL
+ `REPLACE(111,2,3)` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `SUBSTRING_INDEX(111,111,1)` varchar(3) NOT NULL
+ `SUBSTRING_INDEX(111,111,1)` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `MAKE_SET(111,222,3)` varchar(5) NOT NULL
+ `MAKE_SET(111,222,3)` varchar(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `SOUNDEX(1)` varchar(4) NOT NULL
+ `SOUNDEX(1)` varchar(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8);
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `EXPORT_SET(1,'Y','N','',8)` varchar(64) NOT NULL
+ `EXPORT_SET(1,'Y','N','',8)` varchar(64) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
@@ -3545,11 +3576,11 @@ NULL
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
-Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
+Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()`
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select concat(v_LastPaymentDate@0,now()) AS `CONCAT(v_LastPaymentDate, NOW())`
+Note 1003 select concat(v_LastPaymentDate@0,current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())`
DROP PROCEDURE p1;
#
# Bug#52159 returning time type from function and empty left join causes debug assertion
@@ -3649,7 +3680,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) NOT NULL
+ `a` varchar(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -3893,7 +3924,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL
+ `a` varchar(5) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -4137,7 +4168,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL
+ `a` varchar(5) CHARACTER SET latin1 COLLATE latin1_general_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -4381,7 +4412,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varbinary(5) NOT NULL
+ `a` varbinary(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -4605,6 +4636,7 @@ set names latin1;
# Start of 10.0 tests
#
# Start of ctype_unescape.inc
+SET sql_mode = '';
SET @query=_binary'SELECT CHARSET(\'test\'),@@character_set_client,@@character_set_connection';
PREPARE stmt FROM @query;
EXECUTE stmt;
@@ -7667,6 +7699,7 @@ DROP FUNCTION wellformedness;
DROP FUNCTION mysql_real_escape_string_generated;
DROP FUNCTION iswellformed;
DROP TABLE allbytes;
+SET sql_mode = DEFAULT;
# End of ctype_backslash.inc
SET NAMES latin1;
#
@@ -7676,7 +7709,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) NOT NULL
+ `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -7693,13 +7726,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a '))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a '
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) NOT NULL
+ `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -7716,13 +7749,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) NOT NULL
+ `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -7739,13 +7772,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) NOT NULL
+ `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -7762,7 +7795,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
#
# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
@@ -7771,7 +7804,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) NOT NULL
+ `a` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
@@ -7784,7 +7817,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a '))))
+Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a '
DROP TABLE t1;
#
# End of MDEV-8694
@@ -7797,7 +7830,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL
+ `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -7814,13 +7847,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a '))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a '
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL
+ `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -7837,13 +7870,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL
+ `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -7860,13 +7893,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL
+ `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -7883,7 +7916,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
#
# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
@@ -7892,7 +7925,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL
+ `a` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
@@ -7905,7 +7938,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a '))))
+Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a '
DROP TABLE t1;
#
# End of MDEV-8694
@@ -7952,7 +7985,7 @@ HEX(CONVERT('Âx' USING latin1))
3F78
SET NAMES utf8;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
-INSERT INTO t1 VALUES ('Â'),('Â#');
+INSERT IGNORE INTO t1 VALUES ('Â'),('Â#');
Warnings:
Warning 1366 Incorrect string value: '\xC2' for column 'a' at row 1
Warning 1366 Incorrect string value: '\xC2#' for column 'a' at row 2
@@ -7983,7 +8016,7 @@ a
CREATE VIEW v1 AS SELECT a<>0xC0 AS a FROM t1;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`a` <> 0xc0) AS `a` from `t1` latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` <> 0xc0 AS `a` from `t1` latin1 latin1_swedish_ci
SELECT * FROM v1;
a
0
@@ -8020,12 +8053,12 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='10' AND IF(a='10',1,0)=1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '10')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '10'
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='10' AND CASE WHEN a='10' THEN 1 ELSE 0 END;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '10')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '10'
DROP TABLE t1;
#
# MDEV-8680 Wrong result for SELECT..WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a'
@@ -8043,7 +8076,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') AND a=
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (`test`.`t1`.`a` in (<cache>(('a' collate latin1_bin)),'b')))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` in (<cache>('a' collate latin1_bin),'b')
DROP TABLE t1;
#
# MDEV-8698 Wrong result for SELECT..WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin;
@@ -8063,7 +8096,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (`test`.`t1`.`a` between 'a' and <cache>(('c' collate latin1_bin))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` between 'a' and <cache>('c' collate latin1_bin)
DROP TABLE t1;
#
# MDEV-8707 Wrong result for SELECT..WHERE varchar_column=DATE'2001-01-01' AND varchar_column='2001-01-01'
@@ -8145,7 +8178,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)`,crc32(`test`.`t1`.`a`) AS `CRC32(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (crc32(`test`.`t1`.`a`) = 3904355907))
+Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)`,crc32(`test`.`t1`.`a`) AS `CRC32(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and crc32(`test`.`t1`.`a`) = 3904355907
SELECT a, HEX(a) FROM t1 WHERE HEX(a)='61';
a HEX(a)
a 61
@@ -8157,7 +8190,7 @@ EXPLAIN EXTENDED SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,hex(`test`.`t1`.`a`) AS `HEX(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (hex(`test`.`t1`.`a`) = '61'))
+Note 1003 select `test`.`t1`.`a` AS `a`,hex(`test`.`t1`.`a`) AS `HEX(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and hex(`test`.`t1`.`a`) = '61'
SELECT * FROM t1 WHERE a='a';
a
a
@@ -8173,7 +8206,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (length(`test`.`t1`.`a`) = 2))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and length(`test`.`t1`.`a`) = 2
DROP TABLE t1;
#
# MDEV-8712 Wrong result for SELECT..WHERE latin1_bin_column=_latin1'a' AND latin1_bin_column='A'
@@ -8205,7 +8238,7 @@ SELECT * FROM t1 WHERE COALESCE(c,0)='3 ' AND COALESCE(d,0)=COALESCE(c,0);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where ((coalesce(`test`.`t1`.`c`,0) = '3 ') and (coalesce(`test`.`t1`.`d`,0) = '3 '))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where coalesce(`test`.`t1`.`c`,0) = '3 ' and coalesce(`test`.`t1`.`d`,0) = '3 '
DROP TABLE t1;
#
# MDEV-15005 ASAN: stack-buffer-overflow in my_strnncollsp_simple
@@ -8223,3 +8256,592 @@ CONVERT(1, CHAR) IN ('100', '10', '1')
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET character_set_connection=latin1;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_swedish_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE latin1_swedish_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin1_swedish_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_swedish_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin1_swedish_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_swedish_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin1_swedish_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_swedish_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE latin1_swedish_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin1_swedish_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_swedish_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin1_swedish_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_swedish_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin1_swedish_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE latin1_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin1_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin1_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin1_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE latin1_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin1_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin1_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin1_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET NAMES latin1;
+#
+# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
+#
+CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
+ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(50) DEFAULT NULL,
+ `b` varchar(50) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('111', '111');
+INSERT INTO t1 VALUES ('222', '222');
+INSERT INTO t1 VALUES ('333', '333');
+INSERT INTO t1 VALUES ('444', '444');
+SELECT * FROM t1 WHERE a LIKE '111%';
+a b
+111 111
+SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
+a b
+111 111
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result
index d34d132e3a9..2d3803fba18 100644
--- a/mysql-test/r/ctype_latin1_de.result
+++ b/mysql-test/r/ctype_latin1_de.result
@@ -490,7 +490,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) COLLATE latin1_german2_ci NOT NULL,
+ `a` varchar(1) COLLATE latin1_german2_ci DEFAULT NULL,
`b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
@@ -565,7 +565,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) COLLATE latin1_german2_ci NOT NULL
+ `a` varchar(5) COLLATE latin1_german2_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
diff --git a/mysql-test/r/ctype_latin2.result b/mysql-test/r/ctype_latin2.result
index 634640cab1d..d8fd22b5322 100644
--- a/mysql-test/r/ctype_latin2.result
+++ b/mysql-test/r/ctype_latin2.result
@@ -416,7 +416,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET latin2 NOT NULL
+ `a` varchar(5) CHARACTER SET latin2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -626,7 +626,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 64) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(64) CHARACTER SET latin2 NOT NULL
+ `a` varchar(64) CHARACTER SET latin2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('');
SELECT CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1;
@@ -697,7 +697,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET latin2 COLLATE latin2_bin NOT NULL
+ `a` varchar(5) CHARACTER SET latin2 COLLATE latin2_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
diff --git a/mysql-test/r/ctype_latin2_ch.result b/mysql-test/r/ctype_latin2_ch.result
index da5c8076fca..87357a49197 100644
--- a/mysql-test/r/ctype_latin2_ch.result
+++ b/mysql-test/r/ctype_latin2_ch.result
@@ -30,21 +30,21 @@ select * from t1 where tt like '%AA%';
id tt
drop table t1;
set names latin2 collate latin2_czech_cs;
-SELECT strcmp('a','a ');
-strcmp('a','a ')
-0
-SELECT strcmp('a\0','a' );
-strcmp('a\0','a' )
-1
-SELECT strcmp('a\0','a ');
-strcmp('a\0','a ')
-1
-SELECT strcmp('a\t','a' );
-strcmp('a\t','a' )
-0
-SELECT strcmp('a\t','a ');
-strcmp('a\t','a ')
-0
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+1 -1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+1 -1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+0 0
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+0 0
#
# MDEV-7149 Constant condition propagation erroneously applied for LIKE
#
@@ -52,7 +52,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL
+ `c1` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -69,13 +69,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a '))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a '
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL
+ `c1` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -92,13 +92,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL
+ `c1` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -115,13 +115,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL
+ `c1` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -138,7 +138,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
#
# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
@@ -147,7 +147,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL
+ `a` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
@@ -160,7 +160,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a '))))
+Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a '
DROP TABLE t1;
#
# End of MDEV-8694
@@ -484,21 +484,21 @@ DROP TABLE t1;
# WL#3664 WEIGHT_STRING
#
set names latin2 collate latin2_czech_cs;
-SELECT strcmp('a','a ');
-strcmp('a','a ')
-0
-SELECT strcmp('a\0','a' );
-strcmp('a\0','a' )
-1
-SELECT strcmp('a\0','a ');
-strcmp('a\0','a ')
-1
-SELECT strcmp('a\t','a' );
-strcmp('a\t','a' )
-0
-SELECT strcmp('a\t','a ');
-strcmp('a\t','a ')
-0
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+1 -1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+1 -1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+0 0
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+0 0
#
# Note:
# latin2_czech_cs does not support WEIGHT_STRING in full extent
@@ -530,7 +530,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL
+ `a` varchar(5) CHARACTER SET latin2 COLLATE latin2_czech_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
diff --git a/mysql-test/r/ctype_ldml.result b/mysql-test/r/ctype_ldml.result
index d333c03143b..3ce50331ed0 100644
--- a/mysql-test/r/ctype_ldml.result
+++ b/mysql-test/r/ctype_ldml.result
@@ -5,7 +5,7 @@ with all Unicode character sets
set names utf8;
show variables like 'character_sets_dir%';
Variable_name Value
-character_sets_dir MYSQL_TEST_DIR/std_data/
+character_sets_dir MYSQL_TEST_DIR/std_data/ldml/
show collation like 'utf8_phone_ci';
Collation Charset Id Default Compiled Sortlen
utf8_phone_ci utf8 352 8
@@ -165,7 +165,7 @@ DROP TABLE t1;
# Bug#43827 Server closes connections and restarts
#
CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);
-INSERT INTO t1 SELECT REPEAT('a',11);
+INSERT IGNORE INTO t1 SELECT REPEAT('a',11);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
DROP TABLE t1;
@@ -454,10 +454,21 @@ select "foo" = "foo " collate latin1_test;
The following tests check that two-byte collation IDs work
select * from information_schema.collations where id>256 and is_compiled<>'Yes' order by id;
COLLATION_NAME CHARACTER_SET_NAME ID IS_DEFAULT IS_COMPILED SORTLEN
+ascii2_general_nopad_ci ascii2 318 1
+ascii2_bin2 ascii2 319 1
+ascii2_general_ci ascii2 320 Yes 1
+ascii2_bin ascii2 321 1
+ascii2_general_inherited_ci ascii2 322 1
+ascii2_general_inherited2_ci ascii2 323 1
+ascii2_badly_inherited_ci ascii2 324 1
+ascii2_nopad_bin ascii2 325 1
utf8mb4_test_ci utf8mb4 326 8
utf16_test_ci utf16 327 8
utf8mb4_test_400_ci utf8mb4 328 8
+utf8mb4_test_520_nopad_ci utf8mb4 329 8
latin1_test2 latin1 332 1
+latin1_test2_cs latin1 333 1
+latin1_swedish_nopad2_ci latin1 334 1
utf8_bengali_standard_ci utf8 336 8
utf8_bengali_traditional_ci utf8 337 8
utf8_implicit_weights_ci utf8 338 8
@@ -472,16 +483,24 @@ ucs2_vn_ci ucs2 359 8
ucs2_5624_1 ucs2 360 8
utf8_5624_5 utf8 368 8
utf8_5624_5_bad utf8 369 8
+utf8_czech_test_w2 utf8 370 4
+utf8_czech_test_nopad_w2 utf8 371 4
+utf8_czech_test_bad_w2 utf8 372 4
utf32_test_ci utf32 391 8
utf8_maxuserid_ci utf8 2047 8
show collation like '%test%';
Collation Charset Id Default Compiled Sortlen
latin1_test latin1 99 Yes 1
latin1_test2 latin1 332 1
+latin1_test2_cs latin1 333 1
utf8_test_ci utf8 353 8
+utf8_czech_test_w2 utf8 370 4
+utf8_czech_test_nopad_w2 utf8 371 4
+utf8_czech_test_bad_w2 utf8 372 4
ucs2_test_ci ucs2 358 8
utf8mb4_test_ci utf8mb4 326 8
utf8mb4_test_400_ci utf8mb4 328 8
+utf8mb4_test_520_nopad_ci utf8mb4 329 8
utf16_test_ci utf16 327 8
utf32_test_ci utf32 391 8
show collation like 'ucs2_vn_ci';
@@ -1179,3 +1198,1839 @@ ch w ducet
3700 FB80B700 FB80B700
3701 FB80B700 FB80B701
DROP TABLE t1;
+#
+# Testing that the MY_CS_PUREASCII flag is set properly
+# Comparison between ascii2 and latin1 should not give "illegal collation error"
+#
+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;
+a b
+a a
+b b
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_bin2;
+SELECT * FROM t1 WHERE a=b;
+a b
+a a
+b b
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_bin;
+SELECT * FROM t1 WHERE a=b;
+a b
+a a
+b b
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_general_inherited_ci;
+SELECT * FROM t1 WHERE a=b;
+a b
+a a
+b b
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_general_inherited2_ci;
+SELECT * FROM t1 WHERE a=b;
+a b
+a a
+b b
+DROP TABLE t1;
+#
+# Testing that in case of two binary collations
+# "BINARY" in a column definition uses the collation with the least id
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ascii2 BINARY);
+INSERT INTO t1 VALUES ('test');
+SELECT COLLATION(a) FROM t1;
+COLLATION(a)
+ascii2_bin2
+DROP TABLE t1;
+#
+# Testing mixing of two binary collations of the same character set
+#
+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');
+SELECT * FROM t1 WHERE a=b;
+ERROR HY000: Illegal mix of collations (ascii2_bin,IMPLICIT) and (ascii2_bin2,IMPLICIT) for operation '='
+DROP TABLE t1;
+#
+# Testing bad collation inheritance
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_badly_inherited_ci);
+ERROR HY000: Unknown collation: 'ascii2_badly_inherited_ci'
+#
+# Testing that the MY_CS_CSSORT flag is set properly
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_test);
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE a RLIKE 'a';
+a
+a
+A
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_test2_cs);
+INSERT INTO t1 VALUES ('a'),('A');
+SELECT * FROM t1 WHERE a RLIKE 'a';
+a
+a
+DROP TABLE t1;
+#
+# MDEV-9711 NO PAD collations
+#
+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;
+a a='a' a='a ' HEX(a) LOWER(a) UPPER(a) CONVERT(a USING utf8)
+a 1 0 61 a A a
+a 0 1 6120 a A a
+A 1 0 41 a A A
+A 0 1 4120 a A A
+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;
+a a='a' a='a ' HEX(a) LOWER(a) UPPER(a) CONVERT(a USING utf8)
+a 1 0 61 a A a
+a 0 1 6120 a A a
+A 0 0 41 a A A
+A 0 0 4120 a A A
+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;
+a a='a' a='a ' HEX(a) LOWER(a) UPPER(a) CONVERT(a USING utf8)
+a 1 0 61 a A a
+a 0 1 6120 a A a
+A 1 0 41 a A A
+A 0 1 4120 a A A
+DROP TABLE t1;
+#
+# MDEV-10877 xxx_unicode_nopad_ci collations
+#
+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;
+HEX(a) is_400 is_520
+61 0 1
+6120 0 1
+62 0 1
+6220 0 1
+SELECT COUNT(DISTINCT a) FROM t1;
+COUNT(DISTINCT a)
+4
+SELECT HEX(a), REPLACE(a,' ','<SP>') FROM t1 WHERE a='a';
+HEX(a) REPLACE(a,' ','<SP>')
+61 a
+SELECT HEX(a), REPLACE(a,' ','<SP>') FROM t1 ORDER BY a;
+HEX(a) REPLACE(a,' ','<SP>')
+61 a
+6120 a<SP>
+62 b
+6220 b<SP>
+SELECT HEX(a), REPLACE(a,' ','<SP>') FROM t1 ORDER BY a DESC;
+HEX(a) REPLACE(a,' ','<SP>')
+6220 b<SP>
+62 b
+6120 a<SP>
+61 a
+DROP TABLE t1;
+SET NAMES utf8 COLLATE utf8_czech_test_w2;
+CREATE TABLE t1 AS SELECT SPACE(10) AS c1 LIMIT 0;
+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');
+insert into t1 values ('K'),('k');
+insert into t1 values ('L'),('l');
+insert into t1 values ('M'),('m');
+insert into t1 values ('N'),('n');
+insert into t1 values ('O'),('o');
+insert into t1 values ('P'),('p');
+insert into t1 values ('Q'),('q');
+insert into t1 values ('R'),('r');
+insert into t1 values ('S'),('s');
+insert into t1 values ('T'),('t');
+insert into t1 values ('U'),('u');
+insert into t1 values ('V'),('v');
+insert into t1 values ('W'),('w');
+insert into t1 values ('X'),('x');
+insert into t1 values ('Y'),('y');
+insert into t1 values ('Z'),('z');
+insert into t1 values (_ucs2 0x00e0),(_ucs2 0x00c0);
+insert into t1 values (_ucs2 0x00e1),(_ucs2 0x00c1);
+insert into t1 values (_ucs2 0x00e2),(_ucs2 0x00c2);
+insert into t1 values (_ucs2 0x00e3),(_ucs2 0x00c3);
+insert into t1 values (_ucs2 0x00e4),(_ucs2 0x00c4);
+insert into t1 values (_ucs2 0x00e5),(_ucs2 0x00c5);
+insert into t1 values (_ucs2 0x00e6),(_ucs2 0x00c6);
+insert into t1 values (_ucs2 0x00e7),(_ucs2 0x00c7);
+insert into t1 values (_ucs2 0x00e8),(_ucs2 0x00c8);
+insert into t1 values (_ucs2 0x00e9),(_ucs2 0x00c9);
+insert into t1 values (_ucs2 0x00ea),(_ucs2 0x00ca);
+insert into t1 values (_ucs2 0x00eb),(_ucs2 0x00cb);
+insert into t1 values (_ucs2 0x00ec),(_ucs2 0x00cc);
+insert into t1 values (_ucs2 0x00ed),(_ucs2 0x00cd);
+insert into t1 values (_ucs2 0x00ee),(_ucs2 0x00ce);
+insert into t1 values (_ucs2 0x00ef),(_ucs2 0x00cf);
+insert into t1 values (_ucs2 0x00f0),(_ucs2 0x00d0);
+insert into t1 values (_ucs2 0x00f1),(_ucs2 0x00d1);
+insert into t1 values (_ucs2 0x00f2),(_ucs2 0x00d2);
+insert into t1 values (_ucs2 0x00f3),(_ucs2 0x00d3);
+insert into t1 values (_ucs2 0x00f4),(_ucs2 0x00d4);
+insert into t1 values (_ucs2 0x00f5),(_ucs2 0x00d5);
+insert into t1 values (_ucs2 0x00f6),(_ucs2 0x00d6);
+insert into t1 values (_ucs2 0x00f7),(_ucs2 0x00d7);
+insert into t1 values (_ucs2 0x00f8),(_ucs2 0x00d8);
+insert into t1 values (_ucs2 0x00f9),(_ucs2 0x00d9);
+insert into t1 values (_ucs2 0x00fa),(_ucs2 0x00da);
+insert into t1 values (_ucs2 0x00fb),(_ucs2 0x00db);
+insert into t1 values (_ucs2 0x00fc),(_ucs2 0x00dc);
+insert into t1 values (_ucs2 0x00fd),(_ucs2 0x00dd);
+insert into t1 values (_ucs2 0x00fe),(_ucs2 0x00de);
+insert into t1 values (_ucs2 0x00ff),(_ucs2 0x00df);
+insert into t1 values (_ucs2 0x0100),(_ucs2 0x0101),(_ucs2 0x0102),(_ucs2 0x0103);
+insert into t1 values (_ucs2 0x0104),(_ucs2 0x0105),(_ucs2 0x0106),(_ucs2 0x0107);
+insert into t1 values (_ucs2 0x0108),(_ucs2 0x0109),(_ucs2 0x010a),(_ucs2 0x010b);
+insert into t1 values (_ucs2 0x010c),(_ucs2 0x010d),(_ucs2 0x010e),(_ucs2 0x010f);
+insert into t1 values (_ucs2 0x0110),(_ucs2 0x0111),(_ucs2 0x0112),(_ucs2 0x0113);
+insert into t1 values (_ucs2 0x0114),(_ucs2 0x0115),(_ucs2 0x0116),(_ucs2 0x0117);
+insert into t1 values (_ucs2 0x0118),(_ucs2 0x0119),(_ucs2 0x011a),(_ucs2 0x011b);
+insert into t1 values (_ucs2 0x011c),(_ucs2 0x011d),(_ucs2 0x011e),(_ucs2 0x011f);
+insert into t1 values (_ucs2 0x0120),(_ucs2 0x0121),(_ucs2 0x0122),(_ucs2 0x0123);
+insert into t1 values (_ucs2 0x0124),(_ucs2 0x0125),(_ucs2 0x0126),(_ucs2 0x0127);
+insert into t1 values (_ucs2 0x0128),(_ucs2 0x0129),(_ucs2 0x012a),(_ucs2 0x012b);
+insert into t1 values (_ucs2 0x012c),(_ucs2 0x012d),(_ucs2 0x012e),(_ucs2 0x012f);
+insert into t1 values (_ucs2 0x0130),(_ucs2 0x0131),(_ucs2 0x0132),(_ucs2 0x0133);
+insert into t1 values (_ucs2 0x0134),(_ucs2 0x0135),(_ucs2 0x0136),(_ucs2 0x0137);
+insert into t1 values (_ucs2 0x0138),(_ucs2 0x0139),(_ucs2 0x013a),(_ucs2 0x013b);
+insert into t1 values (_ucs2 0x013c),(_ucs2 0x013d),(_ucs2 0x013e),(_ucs2 0x013f);
+insert into t1 values (_ucs2 0x0140),(_ucs2 0x0141),(_ucs2 0x0142),(_ucs2 0x0143);
+insert into t1 values (_ucs2 0x0144),(_ucs2 0x0145),(_ucs2 0x0146),(_ucs2 0x0147);
+insert into t1 values (_ucs2 0x0148),(_ucs2 0x0149),(_ucs2 0x014a),(_ucs2 0x014b);
+insert into t1 values (_ucs2 0x014c),(_ucs2 0x014d),(_ucs2 0x014e),(_ucs2 0x014f);
+insert into t1 values (_ucs2 0x0150),(_ucs2 0x0151),(_ucs2 0x0152),(_ucs2 0x0153);
+insert into t1 values (_ucs2 0x0154),(_ucs2 0x0155),(_ucs2 0x0156),(_ucs2 0x0157);
+insert into t1 values (_ucs2 0x0158),(_ucs2 0x0159),(_ucs2 0x015a),(_ucs2 0x015b);
+insert into t1 values (_ucs2 0x015c),(_ucs2 0x015d),(_ucs2 0x015e),(_ucs2 0x015f);
+insert into t1 values (_ucs2 0x0160),(_ucs2 0x0161),(_ucs2 0x0162),(_ucs2 0x0163);
+insert into t1 values (_ucs2 0x0164),(_ucs2 0x0165),(_ucs2 0x0166),(_ucs2 0x0167);
+insert into t1 values (_ucs2 0x0168),(_ucs2 0x0169),(_ucs2 0x016a),(_ucs2 0x016b);
+insert into t1 values (_ucs2 0x016c),(_ucs2 0x016d),(_ucs2 0x016e),(_ucs2 0x016f);
+insert into t1 values (_ucs2 0x0170),(_ucs2 0x0171),(_ucs2 0x0172),(_ucs2 0x0173);
+insert into t1 values (_ucs2 0x0174),(_ucs2 0x0175),(_ucs2 0x0176),(_ucs2 0x0177);
+insert into t1 values (_ucs2 0x0178),(_ucs2 0x0179),(_ucs2 0x017a),(_ucs2 0x017b);
+insert into t1 values (_ucs2 0x017c),(_ucs2 0x017d),(_ucs2 0x017e),(_ucs2 0x017f);
+insert into t1 values (_ucs2 0x0180),(_ucs2 0x0181),(_ucs2 0x0182),(_ucs2 0x0183);
+insert into t1 values (_ucs2 0x0184),(_ucs2 0x0185),(_ucs2 0x0186),(_ucs2 0x0187);
+insert into t1 values (_ucs2 0x0188),(_ucs2 0x0189),(_ucs2 0x018a),(_ucs2 0x018b);
+insert into t1 values (_ucs2 0x018c),(_ucs2 0x018d),(_ucs2 0x018e),(_ucs2 0x018f);
+insert into t1 values (_ucs2 0x0190),(_ucs2 0x0191),(_ucs2 0x0192),(_ucs2 0x0193);
+insert into t1 values (_ucs2 0x0194),(_ucs2 0x0195),(_ucs2 0x0196),(_ucs2 0x0197);
+insert into t1 values (_ucs2 0x0198),(_ucs2 0x0199),(_ucs2 0x019a),(_ucs2 0x019b);
+insert into t1 values (_ucs2 0x019c),(_ucs2 0x019d),(_ucs2 0x019e),(_ucs2 0x019f);
+insert into t1 values (_ucs2 0x01a0),(_ucs2 0x01a1),(_ucs2 0x01a2),(_ucs2 0x01a3);
+insert into t1 values (_ucs2 0x01a4),(_ucs2 0x01a5),(_ucs2 0x01a6),(_ucs2 0x01a7);
+insert into t1 values (_ucs2 0x01a8),(_ucs2 0x01a9),(_ucs2 0x01aa),(_ucs2 0x01ab);
+insert into t1 values (_ucs2 0x01ac),(_ucs2 0x01ad),(_ucs2 0x01ae),(_ucs2 0x01af);
+insert into t1 values (_ucs2 0x01b0),(_ucs2 0x01b1),(_ucs2 0x01b2),(_ucs2 0x01b3);
+insert into t1 values (_ucs2 0x01b4),(_ucs2 0x01b5),(_ucs2 0x01b6),(_ucs2 0x01b7);
+insert into t1 values (_ucs2 0x01b8),(_ucs2 0x01b9),(_ucs2 0x01ba),(_ucs2 0x01bb);
+insert into t1 values (_ucs2 0x01bc),(_ucs2 0x01bd),(_ucs2 0x01be),(_ucs2 0x01bf);
+insert into t1 values (_ucs2 0x01c0),(_ucs2 0x01c1),(_ucs2 0x01c2),(_ucs2 0x01c3);
+insert into t1 values (_ucs2 0x01c4),(_ucs2 0x01c5),(_ucs2 0x01c6),(_ucs2 0x01c7);
+insert into t1 values (_ucs2 0x01c8),(_ucs2 0x01c9),(_ucs2 0x01ca),(_ucs2 0x01cb);
+insert into t1 values (_ucs2 0x01cc),(_ucs2 0x01cd),(_ucs2 0x01ce),(_ucs2 0x01cf);
+insert into t1 values (_ucs2 0x01d0),(_ucs2 0x01d1),(_ucs2 0x01d2),(_ucs2 0x01d3);
+insert into t1 values (_ucs2 0x01d4),(_ucs2 0x01d5),(_ucs2 0x01d6),(_ucs2 0x01d7);
+insert into t1 values (_ucs2 0x01d8),(_ucs2 0x01d9),(_ucs2 0x01da),(_ucs2 0x01db);
+insert into t1 values (_ucs2 0x01dc),(_ucs2 0x01dd),(_ucs2 0x01de),(_ucs2 0x01df);
+insert into t1 values (_ucs2 0x01e0),(_ucs2 0x01e1),(_ucs2 0x01e2),(_ucs2 0x01e3);
+insert into t1 values (_ucs2 0x01e4),(_ucs2 0x01e5),(_ucs2 0x01e6),(_ucs2 0x01e7);
+insert into t1 values (_ucs2 0x01e8),(_ucs2 0x01e9),(_ucs2 0x01ea),(_ucs2 0x01eb);
+insert into t1 values (_ucs2 0x01ec),(_ucs2 0x01ed),(_ucs2 0x01ee),(_ucs2 0x01ef);
+insert into t1 values (_ucs2 0x01f0),(_ucs2 0x01f1),(_ucs2 0x01f2),(_ucs2 0x01f3);
+insert into t1 values (_ucs2 0x01f4),(_ucs2 0x01f5),(_ucs2 0x01f6),(_ucs2 0x01f7);
+insert into t1 values (_ucs2 0x01f8),(_ucs2 0x01f9),(_ucs2 0x01fa),(_ucs2 0x01fb);
+insert into t1 values (_ucs2 0x01fc),(_ucs2 0x01fd),(_ucs2 0x01fe),(_ucs2 0x01ff);
+INSERT INTO t1 VALUES (_ucs2 0x1EA0),(_ucs2 0x1EA1),(_ucs2 0x1EA2),(_ucs2 0x1EA3);
+INSERT INTO t1 VALUES (_ucs2 0x1EA4),(_ucs2 0x1EA5),(_ucs2 0x1EA6),(_ucs2 0x1EA7);
+INSERT INTO t1 VALUES (_ucs2 0x1EA8),(_ucs2 0x1EA9),(_ucs2 0x1EAA),(_ucs2 0x1EAB);
+INSERT INTO t1 VALUES (_ucs2 0x1EAC),(_ucs2 0x1EAD),(_ucs2 0x1EAE),(_ucs2 0x1EAF);
+INSERT INTO t1 VALUES (_ucs2 0x1EB0),(_ucs2 0x1EB1),(_ucs2 0x1EB2),(_ucs2 0x1EB3);
+INSERT INTO t1 VALUES (_ucs2 0x1EB4),(_ucs2 0x1EB5),(_ucs2 0x1EB6),(_ucs2 0x1EB7);
+INSERT INTO t1 VALUES (_ucs2 0x1EB8),(_ucs2 0x1EB9),(_ucs2 0x1EBA),(_ucs2 0x1EBB);
+INSERT INTO t1 VALUES (_ucs2 0x1EBC),(_ucs2 0x1EBD),(_ucs2 0x1EBE),(_ucs2 0x1EBF);
+INSERT INTO t1 VALUES (_ucs2 0x1EC0),(_ucs2 0x1EC1),(_ucs2 0x1EC2),(_ucs2 0x1EC3);
+INSERT INTO t1 VALUES (_ucs2 0x1EC4),(_ucs2 0x1EC5),(_ucs2 0x1EC6),(_ucs2 0x1EC7);
+INSERT INTO t1 VALUES (_ucs2 0x1EC8),(_ucs2 0x1EC9),(_ucs2 0x1ECA),(_ucs2 0x1ECB);
+INSERT INTO t1 VALUES (_ucs2 0x1ECC),(_ucs2 0x1ECD),(_ucs2 0x1ECE),(_ucs2 0x1ECF);
+INSERT INTO t1 VALUES (_ucs2 0x1ED0),(_ucs2 0x1ED1),(_ucs2 0x1ED2),(_ucs2 0x1ED3);
+INSERT INTO t1 VALUES (_ucs2 0x1ED4),(_ucs2 0x1ED5),(_ucs2 0x1ED6),(_ucs2 0x1ED7);
+INSERT INTO t1 VALUES (_ucs2 0x1ED8),(_ucs2 0x1ED9),(_ucs2 0x1EDA),(_ucs2 0x1EDB);
+INSERT INTO t1 VALUES (_ucs2 0x1EDC),(_ucs2 0x1EDD),(_ucs2 0x1EDE),(_ucs2 0x1EDF);
+INSERT INTO t1 VALUES (_ucs2 0x1EE0),(_ucs2 0x1EE1),(_ucs2 0x1EE2),(_ucs2 0x1EE3);
+INSERT INTO t1 VALUES (_ucs2 0x1EE4),(_ucs2 0x1EE5),(_ucs2 0x1EE6),(_ucs2 0x1EE7);
+INSERT INTO t1 VALUES (_ucs2 0x1EE8),(_ucs2 0x1EE9),(_ucs2 0x1EEA),(_ucs2 0x1EEB);
+INSERT INTO t1 VALUES (_ucs2 0x1EEC),(_ucs2 0x1EED),(_ucs2 0x1EEE),(_ucs2 0x1EEF);
+INSERT INTO t1 VALUES (_ucs2 0x1EF0),(_ucs2 0x1EF1);
+insert into t1 values ('AA'),('Aa'),('aa'),('aA');
+insert into t1 values ('AE'),('Ae'),('ae'),('aE');
+insert into t1 values ('CH'),('Ch'),('ch'),('cH');
+insert into t1 values ('DZ'),('Dz'),('dz'),('dZ');
+insert into t1 values ('DŽ'),('Dž'),('dž'),('dŽ');
+insert into t1 values ('IJ'),('Ij'),('ij'),('iJ');
+insert into t1 values ('LJ'),('Lj'),('lj'),('lJ');
+insert into t1 values ('LL'),('Ll'),('ll'),('lL');
+insert into t1 values ('NJ'),('Nj'),('nj'),('nJ');
+insert into t1 values ('OE'),('Oe'),('oe'),('oE');
+insert into t1 values ('SS'),('Ss'),('ss'),('sS');
+insert into t1 values ('RR'),('Rr'),('rr'),('rR');
+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;
+c1 HEX(WEIGHT_STRING(c1 LEVEL 1)) HEX(WEIGHT_STRING(c1 LEVEL 2))
+÷ 0552 0020
+× 0553 0020
+A 120F 0020
+a 120F 0020
+a 120F020A 00200020
+Ã 120F 00200032
+á 120F 00200032
+À 120F 00200035
+à 120F 00200035
+Ä‚ 120F 00200037
+ă 120F 00200037
+Ắ 120F 002000370032
+ắ 120F 002000370032
+Ằ 120F 002000370035
+ằ 120F 002000370035
+Ẵ 120F 00200037004E
+ẵ 120F 00200037004E
+Ẳ 120F 002000370064
+ẳ 120F 002000370064
+Â 120F 0020003C
+â 120F 0020003C
+Ấ 120F 0020003C0032
+ấ 120F 0020003C0032
+Ầ 120F 0020003C0035
+ầ 120F 0020003C0035
+Ẫ 120F 0020003C004E
+ẫ 120F 0020003C004E
+Ẩ 120F 0020003C0064
+ẩ 120F 0020003C0064
+Ç 120F 00200041
+ÇŽ 120F 00200041
+Ã… 120F 00200043
+Ã¥ 120F 00200043
+Ǻ 120F 002000430032
+Ç» 120F 002000430032
+Ä 120F 00200047
+ä 120F 00200047
+Çž 120F 00200047005B
+ÇŸ 120F 00200047005B
+Ã 120F 0020004E
+ã 120F 0020004E
+Ç  120F 00200052005B
+Ç¡ 120F 00200052005B
+Ä„ 120F 00200059
+Ä… 120F 00200059
+Ä€ 120F 0020005B
+Ä 120F 0020005B
+Ả 120F 00200064
+ả 120F 00200064
+Ạ 120F 00200070
+ạ 120F 00200070
+Ặ 120F 002000700037
+ặ 120F 002000700037
+Ậ 120F 00200070003C
+ậ 120F 00200070003C
+AA 120F120F 00200020
+Aa 120F120F 00200020
+aA 120F120F 00200020
+aa 120F120F 00200020
+AE 120F126B 00200020
+Ae 120F126B 00200020
+aE 120F126B 00200020
+ae 120F126B 00200020
+Æ 120F126B 002001590020
+æ 120F126B 002001590020
+Ǽ 120F126B 0020015900200032
+ǽ 120F126B 0020015900200032
+Ç¢ 120F126B 002001590020005B
+Ç£ 120F126B 002001590020005B
+B 1225 0020
+b 1225 0020
+Æ€ 122D 0020
+Æ 1235 0020
+Æ‚ 1239 0020
+ƃ 1239 0020
+C 123D 0020
+c 123D 0020
+Ć 123D 00200032
+ć 123D 00200032
+Ĉ 123D 0020003C
+ĉ 123D 0020003C
+ÄŠ 123D 00200052
+Ä‹ 123D 00200052
+Ç 123D 00200056
+ç 123D 00200056
+cH 123D12D3 00200020
+Č 123E 0020
+Ä 123E 0020
+Ƈ 1246 0020
+ƈ 1246 0020
+D 1250 0020
+d 1250 0020
+ÄŽ 1250 00200041
+Ä 1250 00200041
+Ä 1250 0020007D
+Ä‘ 1250 0020007D
+Ã 1250 00200159
+ð 1250 00200159
+DZ 125014AD 00200020
+Dz 125014AD 00200020
+dZ 125014AD 00200020
+dz 125014AD 00200020
+DZ 125014AD 00200020
+Dz 125014AD 00200020
+dz 125014AD 00200020
+Ç„ 125014AD 002000200041
+Ç… 125014AD 002000200041
+dž 125014AD 002000200041
+DŽ 125014AE 00200020
+Dž 125014AE 00200020
+dŽ 125014AE 00200020
+dž 125014AE 00200020
+Ɖ 1258 0020
+ÆŠ 125C 0020
+Æ‹ 1261 0020
+ƌ 1261 0020
+E 126B 0020
+e 126B 0020
+É 126B 00200032
+é 126B 00200032
+È 126B 00200035
+è 126B 00200035
+Ä” 126B 00200037
+Ä• 126B 00200037
+Ê 126B 0020003C
+ê 126B 0020003C
+Ế 126B 0020003C0032
+ế 126B 0020003C0032
+Ề 126B 0020003C0035
+á» 126B 0020003C0035
+Ễ 126B 0020003C004E
+á»… 126B 0020003C004E
+Ể 126B 0020003C0064
+ể 126B 0020003C0064
+Äš 126B 00200041
+Ä› 126B 00200041
+Ë 126B 00200047
+ë 126B 00200047
+Ẽ 126B 0020004E
+ẽ 126B 0020004E
+Ä– 126B 00200052
+Ä— 126B 00200052
+Ę 126B 00200059
+Ä™ 126B 00200059
+Ä’ 126B 0020005B
+Ä“ 126B 0020005B
+Ẻ 126B 00200064
+ẻ 126B 00200064
+Ẹ 126B 00200070
+ẹ 126B 00200070
+Ệ 126B 00200070003C
+ệ 126B 00200070003C
+ÆŽ 1276 0020
+Ç 1276 0020
+Æ 127B 0020
+Æ 1280 0020
+F 12A3 0020
+f 12A3 0020
+Æ‘ 12AA 0020
+Æ’ 12AA 0020
+G 12B0 0020
+g 12B0 0020
+Ç´ 12B0 00200032
+ǵ 12B0 00200032
+Äž 12B0 00200037
+ÄŸ 12B0 00200037
+Ĝ 12B0 0020003C
+Ä 12B0 0020003C
+Ǧ 12B0 00200041
+ǧ 12B0 00200041
+Ä  12B0 00200052
+Ä¡ 12B0 00200052
+Ä¢ 12B0 00200056
+Ä£ 12B0 00200056
+Ǥ 12BC 0020
+Ç¥ 12BC 0020
+Æ“ 12C1 0020
+Æ” 12CB 0020
+Æ¢ 12CF 0020
+Æ£ 12CF 0020
+H 12D3 0020
+h 12D3 0020
+Ĥ 12D3 0020003C
+Ä¥ 12D3 0020003C
+Ħ 12D3 0020007D
+ħ 12D3 0020007D
+CH 12D4 0020
+Ch 12D4 0020
+ch 12D4 0020
+Æ• 12DB 0020
+Ƕ 12DB 0020
+I 12EC 0020
+i 12EC 0020
+Ã 12EC 00200032
+í 12EC 00200032
+Ì 12EC 00200035
+ì 12EC 00200035
+Ĭ 12EC 00200037
+Ä­ 12EC 00200037
+ÃŽ 12EC 0020003C
+î 12EC 0020003C
+Ç 12EC 00200041
+Ç 12EC 00200041
+Ã 12EC 00200047
+ï 12EC 00200047
+Ĩ 12EC 0020004E
+Ä© 12EC 0020004E
+İ 12EC 00200052
+Ä® 12EC 00200059
+į 12EC 00200059
+Ī 12EC 0020005B
+Ä« 12EC 0020005B
+Ỉ 12EC 00200064
+ỉ 12EC 00200064
+Ị 12EC 00200070
+ị 12EC 00200070
+IJ 12EC1305 00200020
+Ij 12EC1305 00200020
+iJ 12EC1305 00200020
+ij 12EC1305 00200020
+IJ 12EC1305 00200020
+ij 12EC1305 00200020
+ı 12F0 0020
+Æ— 12FA 0020
+Æ– 1300 0020
+J 1305 0020
+j 1305 0020
+Ä´ 1305 0020003C
+ĵ 1305 0020003C
+ǰ 1305 00200041
+K 131E 0020
+k 131E 0020
+Ǩ 131E 00200041
+Ç© 131E 00200041
+Ķ 131E 00200056
+Ä· 131E 00200056
+Ƙ 1324 0020
+Æ™ 1324 0020
+L 1330 0020
+l 1330 0020
+Ĺ 1330 00200032
+ĺ 1330 00200032
+Ľ 1330 00200041
+ľ 1330 00200041
+Ä» 1330 00200056
+ļ 1330 00200056
+Å 1330 0020007D
+Å‚ 1330 0020007D
+Ä¿ 1330 00200159
+Å€ 1330 00200159
+LJ 13301305 00200020
+Lj 13301305 00200020
+lJ 13301305 00200020
+lj 13301305 00200020
+LJ 13301305 00200020
+Lj 13301305 00200020
+lj 13301305 00200020
+LL 13301330 00200020
+Ll 13301330 00200020
+lL 13301330 00200020
+ll 13301330 00200020
+Æš 133B 0020
+Æ› 1357 0020
+M 135F 0020
+m 135F 0020
+N 136D 0020
+n 136D 0020
+Ń 136D 00200032
+Å„ 136D 00200032
+Ǹ 136D 00200035
+ǹ 136D 00200035
+Ň 136D 00200041
+ň 136D 00200041
+Ñ 136D 0020004E
+ñ 136D 0020004E
+Å… 136D 00200056
+ņ 136D 00200056
+NJ 136D1305 00200020
+Nj 136D1305 00200020
+nJ 136D1305 00200020
+nj 136D1305 00200020
+ÇŠ 136D1305 00200020
+Ç‹ 136D1305 00200020
+nj 136D1305 00200020
+Æ 1378 0020
+Æž 137C 0020
+ÅŠ 138A 0020
+Å‹ 138A 0020
+O 138E 0020
+o 138E 0020
+Ó 138E 00200032
+ó 138E 00200032
+Ã’ 138E 00200035
+ò 138E 00200035
+ÅŽ 138E 00200037
+Å 138E 00200037
+Ô 138E 0020003C
+ô 138E 0020003C
+á» 138E 0020003C0032
+ố 138E 0020003C0032
+á»’ 138E 0020003C0035
+ồ 138E 0020003C0035
+á»– 138E 0020003C004E
+á»— 138E 0020003C004E
+á»” 138E 0020003C0064
+ổ 138E 0020003C0064
+Ç‘ 138E 00200041
+Ç’ 138E 00200041
+Ö 138E 00200047
+ö 138E 00200047
+Å 138E 0020004D
+Å‘ 138E 0020004D
+Õ 138E 0020004E
+õ 138E 0020004E
+Ø 138E 00200054
+ø 138E 00200054
+Ǿ 138E 002000540032
+Ç¿ 138E 002000540032
+Ǫ 138E 00200059
+Ç« 138E 00200059
+Ǭ 138E 00200059005B
+Ç­ 138E 00200059005B
+Ō 138E 0020005B
+Å 138E 0020005B
+Ỏ 138E 00200064
+á» 138E 00200064
+Æ  138E 00200068
+Æ¡ 138E 00200068
+Ớ 138E 002000680032
+á»› 138E 002000680032
+Ờ 138E 002000680035
+á» 138E 002000680035
+á»  138E 00200068004E
+ỡ 138E 00200068004E
+Ở 138E 002000680064
+ở 138E 002000680064
+Ợ 138E 002000680070
+ợ 138E 002000680070
+Ọ 138E 00200070
+á» 138E 00200070
+Ộ 138E 00200070003C
+á»™ 138E 00200070003C
+OE 138E126B 00200020
+Oe 138E126B 00200020
+oE 138E126B 00200020
+oe 138E126B 00200020
+Å’ 138E126B 002001590020
+Å“ 138E126B 002001590020
+Ɔ 139A 0020
+ÆŸ 13A5 0020
+P 13B3 0020
+p 13B3 0020
+Ƥ 13BC 0020
+Æ¥ 13BC 0020
+Q 13C8 0020
+q 13C8 0020
+ĸ 13D6 0020
+R 13DA 0020
+r 13DA 0020
+Å” 13DA 00200032
+Å• 13DA 00200032
+Å– 13DA 00200056
+Å— 13DA 00200056
+RR 13DA13DA 00200020
+Rr 13DA13DA 00200020
+rR 13DA13DA 00200020
+rr 13DA13DA 00200020
+Ř 13DB 0020
+Å™ 13DB 0020
+Ʀ 13DE 0020
+S 1410 0020
+s 1410 0020
+Åš 1410 00200032
+Å› 1410 00200032
+Ŝ 1410 0020003C
+Å 1410 0020003C
+Åž 1410 00200056
+ÅŸ 1410 00200056
+Å¿ 1410 0020015A
+SS 14101410 00200020
+Ss 14101410 00200020
+sS 14101410 00200020
+ss 14101410 00200020
+ß 14101410 002001590020
+Å  1411 0020
+Å¡ 1411 0020
+Æ© 1421 0020
+ƪ 1426 0020
+T 1433 0020
+t 1433 0020
+Ť 1433 00200041
+Å¥ 1433 00200041
+Å¢ 1433 00200056
+Å£ 1433 00200056
+ƾ 14331410 00200020
+Ŧ 1438 0020
+ŧ 1438 0020
+Æ« 143E 0020
+Ƭ 1442 0020
+Æ­ 1442 0020
+Æ® 1446 0020
+U 1453 0020
+u 1453 0020
+Ú 1453 00200032
+ú 1453 00200032
+Ù 1453 00200035
+ù 1453 00200035
+Ŭ 1453 00200037
+Å­ 1453 00200037
+Û 1453 0020003C
+û 1453 0020003C
+Ç“ 1453 00200041
+Ç” 1453 00200041
+Å® 1453 00200043
+ů 1453 00200043
+Ü 1453 00200047
+ü 1453 00200047
+Ç— 1453 002000470032
+ǘ 1453 002000470032
+Ç› 1453 002000470035
+ǜ 1453 002000470035
+Ç™ 1453 002000470041
+Çš 1453 002000470041
+Ç• 1453 00200047005B
+Ç– 1453 00200047005B
+Ű 1453 0020004D
+ű 1453 0020004D
+Ũ 1453 0020004E
+Å© 1453 0020004E
+Ų 1453 00200059
+ų 1453 00200059
+Ū 1453 0020005B
+Å« 1453 0020005B
+Ủ 1453 00200064
+á»§ 1453 00200064
+Ư 1453 00200068
+ư 1453 00200068
+Ứ 1453 002000680032
+ứ 1453 002000680032
+Ừ 1453 002000680035
+ừ 1453 002000680035
+á»® 1453 00200068004E
+ữ 1453 00200068004E
+Ử 1453 002000680064
+á»­ 1453 002000680064
+á»° 1453 002000680070
+á»± 1453 002000680070
+Ụ 1453 00200070
+ụ 1453 00200070
+Ɯ 146D 0020
+Ʊ 1476 0020
+V 147B 0020
+v 147B 0020
+Ʋ 1482 0020
+W 148D 0020
+w 148D 0020
+Å´ 148D 0020003C
+ŵ 148D 0020003C
+X 1497 0020
+x 1497 0020
+Y 149C 0020
+y 149C 0020
+Ã 149C 00200032
+ý 149C 00200032
+Ŷ 149C 0020003C
+Å· 149C 0020003C
+ÿ 149C 00200047
+Ÿ 149C 00200047
+Ƴ 14A8 0020
+Æ´ 14A8 0020
+Z 14AD 0020
+z 14AD 0020
+Ź 14AD 00200032
+ź 14AD 00200032
+Å» 14AD 00200052
+ż 14AD 00200052
+Æ 14AD148D 00200020
+Ž 14AE 0020
+ž 14AE 0020
+Ƶ 14B2 0020
+ƶ 14B2 0020
+Æ· 14CA 0020
+Ç® 14CA 00200041
+ǯ 14CA 00200041
+Ƹ 14CF 0020
+ƹ 14CF 0020
+ƺ 14D4 0020
+Þ 14E0 0020
+þ 14E0 0020
+Æ¿ 14E6 0020
+Ç· 14E6 0020
+Æ» 14EF 0020
+Ƨ 14F6 0020
+ƨ 14F6 0020
+Ƽ 14FA 0020
+ƽ 14FA 0020
+Æ„ 14FE 0020
+Æ… 14FE 0020
+ʼn 150B136D 00200020
+Ç€ 1525 0020
+Ç 1529 0020
+Ç‚ 152D 0020
+ǃ 1531 0020
+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;
+c1 HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 1)) HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 2))
+A 120F020A020A 002000200020
+a 120F020A020A 002000200020
+a 120F020A020A 002000200020
+Ã 120F020A020A 002000320020
+á 120F020A020A 002000320020
+À 120F020A020A 002000350020
+à 120F020A020A 002000350020
+Ä‚ 120F020A020A 002000370020
+ă 120F020A020A 002000370020
+Ắ 120F020A020A 002000370032
+ắ 120F020A020A 002000370032
+Ằ 120F020A020A 002000370035
+ằ 120F020A020A 002000370035
+Ẵ 120F020A020A 00200037004E
+ẵ 120F020A020A 00200037004E
+Ẳ 120F020A020A 002000370064
+ẳ 120F020A020A 002000370064
+Â 120F020A020A 0020003C0020
+â 120F020A020A 0020003C0020
+Ấ 120F020A020A 0020003C0032
+ấ 120F020A020A 0020003C0032
+Ầ 120F020A020A 0020003C0035
+ầ 120F020A020A 0020003C0035
+Ẫ 120F020A020A 0020003C004E
+ẫ 120F020A020A 0020003C004E
+Ẩ 120F020A020A 0020003C0064
+ẩ 120F020A020A 0020003C0064
+Ç 120F020A020A 002000410020
+ÇŽ 120F020A020A 002000410020
+Ã… 120F020A020A 002000430020
+Ã¥ 120F020A020A 002000430020
+Ǻ 120F020A020A 002000430032
+Ç» 120F020A020A 002000430032
+Ä 120F020A020A 002000470020
+ä 120F020A020A 002000470020
+Çž 120F020A020A 00200047005B
+ÇŸ 120F020A020A 00200047005B
+Ã 120F020A020A 0020004E0020
+ã 120F020A020A 0020004E0020
+Ç  120F020A020A 00200052005B
+Ç¡ 120F020A020A 00200052005B
+Ä„ 120F020A020A 002000590020
+Ä… 120F020A020A 002000590020
+Ä€ 120F020A020A 0020005B0020
+Ä 120F020A020A 0020005B0020
+Ả 120F020A020A 002000640020
+ả 120F020A020A 002000640020
+Ạ 120F020A020A 002000700020
+ạ 120F020A020A 002000700020
+Ặ 120F020A020A 002000700037
+ặ 120F020A020A 002000700037
+Ậ 120F020A020A 00200070003C
+ậ 120F020A020A 00200070003C
+AA 120F120F020A 002000200020
+Aa 120F120F020A 002000200020
+aA 120F120F020A 002000200020
+aa 120F120F020A 002000200020
+AE 120F126B020A 002000200020
+Ae 120F126B020A 002000200020
+aE 120F126B020A 002000200020
+ae 120F126B020A 002000200020
+Æ 120F126B020A 002001590020
+æ 120F126B020A 002001590020
+Ǽ 120F126B020A 002001590020
+ǽ 120F126B020A 002001590020
+Ç¢ 120F126B020A 002001590020
+Ç£ 120F126B020A 002001590020
+DROP TABLE t1;
+SELECT 'a' = 'a ';
+'a' = 'a '
+1
+SELECT 'a' < 'á';
+'a' < 'á'
+1
+SELECT 'áa' < 'ab';
+'áa' < 'ab'
+1
+SELECT 'á' < 'ä';
+'á' < 'ä'
+1
+SELECT 'äa' < 'áb';
+'äa' < 'áb'
+1
+SELECT 'c' < 'Ä';
+'c' < 'Ä'
+1
+SELECT 'cb' < 'Äa';
+'cb' < 'Äa'
+1
+SELECT 'd' < 'Ä';
+'d' < 'Ä'
+1
+SELECT 'Äa' < 'db';
+'Äa' < 'db'
+1
+SELECT 'e' < 'é';
+'e' < 'é'
+1
+SELECT 'éa' < 'eb';
+'éa' < 'eb'
+1
+SELECT 'é' < 'ě';
+'é' < 'ě'
+1
+SELECT 'ěa' < 'éb';
+'ěa' < 'éb'
+1
+SELECT 'i' < 'í';
+'i' < 'í'
+1
+SELECT 'ía' < 'ib';
+'ía' < 'ib'
+1
+SELECT 'n' < 'ň';
+'n' < 'ň'
+1
+SELECT 'ňa' < 'nb';
+'ňa' < 'nb'
+1
+SELECT 'o' < 'ó';
+'o' < 'ó'
+1
+SELECT 'óa' < 'ob';
+'óa' < 'ob'
+1
+SELECT 'ó' < 'ö';
+'ó' < 'ö'
+1
+SELECT 'öa' < 'ób';
+'öa' < 'ób'
+1
+SELECT 'r' < 'Å™';
+'r' < 'Å™'
+1
+SELECT 'rb' < 'řa';
+'rb' < 'řa'
+1
+SELECT 's' < 'Å¡';
+'s' < 'Å¡'
+1
+SELECT 'sb' < 'ša';
+'sb' < 'ša'
+1
+SELECT 't' < 'Å¥';
+'t' < 'Å¥'
+1
+SELECT 'Å¥a' < 'tb';
+'Å¥a' < 'tb'
+1
+SELECT 'u' < 'ú';
+'u' < 'ú'
+1
+SELECT 'úa' < 'ub';
+'úa' < 'ub'
+1
+SELECT 'ú' < 'ů';
+'ú' < 'ů'
+1
+SELECT 'ůa' < 'úb';
+'ůa' < 'úb'
+1
+SELECT 'ů' < 'ü';
+'ů' < 'ü'
+1
+SELECT 'üa' < 'ůb';
+'üa' < 'ůb'
+1
+SELECT 'y' < 'ý';
+'y' < 'ý'
+1
+SELECT 'ýa' < 'yb';
+'ýa' < 'yb'
+1
+SELECT 'z' < 'ž';
+'z' < 'ž'
+1
+SELECT 'zb' < 'ža';
+'zb' < 'ža'
+1
+SELECT 'hž' < 'ch';
+'hž' < 'ch'
+1
+SELECT 'chž'< 'i';
+'chž'< 'i'
+1
+SET NAMES utf8 COLLATE utf8_czech_test_nopad_w2;
+CREATE TABLE t1 AS SELECT SPACE(10) AS c1 LIMIT 0;
+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');
+insert into t1 values ('K'),('k');
+insert into t1 values ('L'),('l');
+insert into t1 values ('M'),('m');
+insert into t1 values ('N'),('n');
+insert into t1 values ('O'),('o');
+insert into t1 values ('P'),('p');
+insert into t1 values ('Q'),('q');
+insert into t1 values ('R'),('r');
+insert into t1 values ('S'),('s');
+insert into t1 values ('T'),('t');
+insert into t1 values ('U'),('u');
+insert into t1 values ('V'),('v');
+insert into t1 values ('W'),('w');
+insert into t1 values ('X'),('x');
+insert into t1 values ('Y'),('y');
+insert into t1 values ('Z'),('z');
+insert into t1 values (_ucs2 0x00e0),(_ucs2 0x00c0);
+insert into t1 values (_ucs2 0x00e1),(_ucs2 0x00c1);
+insert into t1 values (_ucs2 0x00e2),(_ucs2 0x00c2);
+insert into t1 values (_ucs2 0x00e3),(_ucs2 0x00c3);
+insert into t1 values (_ucs2 0x00e4),(_ucs2 0x00c4);
+insert into t1 values (_ucs2 0x00e5),(_ucs2 0x00c5);
+insert into t1 values (_ucs2 0x00e6),(_ucs2 0x00c6);
+insert into t1 values (_ucs2 0x00e7),(_ucs2 0x00c7);
+insert into t1 values (_ucs2 0x00e8),(_ucs2 0x00c8);
+insert into t1 values (_ucs2 0x00e9),(_ucs2 0x00c9);
+insert into t1 values (_ucs2 0x00ea),(_ucs2 0x00ca);
+insert into t1 values (_ucs2 0x00eb),(_ucs2 0x00cb);
+insert into t1 values (_ucs2 0x00ec),(_ucs2 0x00cc);
+insert into t1 values (_ucs2 0x00ed),(_ucs2 0x00cd);
+insert into t1 values (_ucs2 0x00ee),(_ucs2 0x00ce);
+insert into t1 values (_ucs2 0x00ef),(_ucs2 0x00cf);
+insert into t1 values (_ucs2 0x00f0),(_ucs2 0x00d0);
+insert into t1 values (_ucs2 0x00f1),(_ucs2 0x00d1);
+insert into t1 values (_ucs2 0x00f2),(_ucs2 0x00d2);
+insert into t1 values (_ucs2 0x00f3),(_ucs2 0x00d3);
+insert into t1 values (_ucs2 0x00f4),(_ucs2 0x00d4);
+insert into t1 values (_ucs2 0x00f5),(_ucs2 0x00d5);
+insert into t1 values (_ucs2 0x00f6),(_ucs2 0x00d6);
+insert into t1 values (_ucs2 0x00f7),(_ucs2 0x00d7);
+insert into t1 values (_ucs2 0x00f8),(_ucs2 0x00d8);
+insert into t1 values (_ucs2 0x00f9),(_ucs2 0x00d9);
+insert into t1 values (_ucs2 0x00fa),(_ucs2 0x00da);
+insert into t1 values (_ucs2 0x00fb),(_ucs2 0x00db);
+insert into t1 values (_ucs2 0x00fc),(_ucs2 0x00dc);
+insert into t1 values (_ucs2 0x00fd),(_ucs2 0x00dd);
+insert into t1 values (_ucs2 0x00fe),(_ucs2 0x00de);
+insert into t1 values (_ucs2 0x00ff),(_ucs2 0x00df);
+insert into t1 values (_ucs2 0x0100),(_ucs2 0x0101),(_ucs2 0x0102),(_ucs2 0x0103);
+insert into t1 values (_ucs2 0x0104),(_ucs2 0x0105),(_ucs2 0x0106),(_ucs2 0x0107);
+insert into t1 values (_ucs2 0x0108),(_ucs2 0x0109),(_ucs2 0x010a),(_ucs2 0x010b);
+insert into t1 values (_ucs2 0x010c),(_ucs2 0x010d),(_ucs2 0x010e),(_ucs2 0x010f);
+insert into t1 values (_ucs2 0x0110),(_ucs2 0x0111),(_ucs2 0x0112),(_ucs2 0x0113);
+insert into t1 values (_ucs2 0x0114),(_ucs2 0x0115),(_ucs2 0x0116),(_ucs2 0x0117);
+insert into t1 values (_ucs2 0x0118),(_ucs2 0x0119),(_ucs2 0x011a),(_ucs2 0x011b);
+insert into t1 values (_ucs2 0x011c),(_ucs2 0x011d),(_ucs2 0x011e),(_ucs2 0x011f);
+insert into t1 values (_ucs2 0x0120),(_ucs2 0x0121),(_ucs2 0x0122),(_ucs2 0x0123);
+insert into t1 values (_ucs2 0x0124),(_ucs2 0x0125),(_ucs2 0x0126),(_ucs2 0x0127);
+insert into t1 values (_ucs2 0x0128),(_ucs2 0x0129),(_ucs2 0x012a),(_ucs2 0x012b);
+insert into t1 values (_ucs2 0x012c),(_ucs2 0x012d),(_ucs2 0x012e),(_ucs2 0x012f);
+insert into t1 values (_ucs2 0x0130),(_ucs2 0x0131),(_ucs2 0x0132),(_ucs2 0x0133);
+insert into t1 values (_ucs2 0x0134),(_ucs2 0x0135),(_ucs2 0x0136),(_ucs2 0x0137);
+insert into t1 values (_ucs2 0x0138),(_ucs2 0x0139),(_ucs2 0x013a),(_ucs2 0x013b);
+insert into t1 values (_ucs2 0x013c),(_ucs2 0x013d),(_ucs2 0x013e),(_ucs2 0x013f);
+insert into t1 values (_ucs2 0x0140),(_ucs2 0x0141),(_ucs2 0x0142),(_ucs2 0x0143);
+insert into t1 values (_ucs2 0x0144),(_ucs2 0x0145),(_ucs2 0x0146),(_ucs2 0x0147);
+insert into t1 values (_ucs2 0x0148),(_ucs2 0x0149),(_ucs2 0x014a),(_ucs2 0x014b);
+insert into t1 values (_ucs2 0x014c),(_ucs2 0x014d),(_ucs2 0x014e),(_ucs2 0x014f);
+insert into t1 values (_ucs2 0x0150),(_ucs2 0x0151),(_ucs2 0x0152),(_ucs2 0x0153);
+insert into t1 values (_ucs2 0x0154),(_ucs2 0x0155),(_ucs2 0x0156),(_ucs2 0x0157);
+insert into t1 values (_ucs2 0x0158),(_ucs2 0x0159),(_ucs2 0x015a),(_ucs2 0x015b);
+insert into t1 values (_ucs2 0x015c),(_ucs2 0x015d),(_ucs2 0x015e),(_ucs2 0x015f);
+insert into t1 values (_ucs2 0x0160),(_ucs2 0x0161),(_ucs2 0x0162),(_ucs2 0x0163);
+insert into t1 values (_ucs2 0x0164),(_ucs2 0x0165),(_ucs2 0x0166),(_ucs2 0x0167);
+insert into t1 values (_ucs2 0x0168),(_ucs2 0x0169),(_ucs2 0x016a),(_ucs2 0x016b);
+insert into t1 values (_ucs2 0x016c),(_ucs2 0x016d),(_ucs2 0x016e),(_ucs2 0x016f);
+insert into t1 values (_ucs2 0x0170),(_ucs2 0x0171),(_ucs2 0x0172),(_ucs2 0x0173);
+insert into t1 values (_ucs2 0x0174),(_ucs2 0x0175),(_ucs2 0x0176),(_ucs2 0x0177);
+insert into t1 values (_ucs2 0x0178),(_ucs2 0x0179),(_ucs2 0x017a),(_ucs2 0x017b);
+insert into t1 values (_ucs2 0x017c),(_ucs2 0x017d),(_ucs2 0x017e),(_ucs2 0x017f);
+insert into t1 values (_ucs2 0x0180),(_ucs2 0x0181),(_ucs2 0x0182),(_ucs2 0x0183);
+insert into t1 values (_ucs2 0x0184),(_ucs2 0x0185),(_ucs2 0x0186),(_ucs2 0x0187);
+insert into t1 values (_ucs2 0x0188),(_ucs2 0x0189),(_ucs2 0x018a),(_ucs2 0x018b);
+insert into t1 values (_ucs2 0x018c),(_ucs2 0x018d),(_ucs2 0x018e),(_ucs2 0x018f);
+insert into t1 values (_ucs2 0x0190),(_ucs2 0x0191),(_ucs2 0x0192),(_ucs2 0x0193);
+insert into t1 values (_ucs2 0x0194),(_ucs2 0x0195),(_ucs2 0x0196),(_ucs2 0x0197);
+insert into t1 values (_ucs2 0x0198),(_ucs2 0x0199),(_ucs2 0x019a),(_ucs2 0x019b);
+insert into t1 values (_ucs2 0x019c),(_ucs2 0x019d),(_ucs2 0x019e),(_ucs2 0x019f);
+insert into t1 values (_ucs2 0x01a0),(_ucs2 0x01a1),(_ucs2 0x01a2),(_ucs2 0x01a3);
+insert into t1 values (_ucs2 0x01a4),(_ucs2 0x01a5),(_ucs2 0x01a6),(_ucs2 0x01a7);
+insert into t1 values (_ucs2 0x01a8),(_ucs2 0x01a9),(_ucs2 0x01aa),(_ucs2 0x01ab);
+insert into t1 values (_ucs2 0x01ac),(_ucs2 0x01ad),(_ucs2 0x01ae),(_ucs2 0x01af);
+insert into t1 values (_ucs2 0x01b0),(_ucs2 0x01b1),(_ucs2 0x01b2),(_ucs2 0x01b3);
+insert into t1 values (_ucs2 0x01b4),(_ucs2 0x01b5),(_ucs2 0x01b6),(_ucs2 0x01b7);
+insert into t1 values (_ucs2 0x01b8),(_ucs2 0x01b9),(_ucs2 0x01ba),(_ucs2 0x01bb);
+insert into t1 values (_ucs2 0x01bc),(_ucs2 0x01bd),(_ucs2 0x01be),(_ucs2 0x01bf);
+insert into t1 values (_ucs2 0x01c0),(_ucs2 0x01c1),(_ucs2 0x01c2),(_ucs2 0x01c3);
+insert into t1 values (_ucs2 0x01c4),(_ucs2 0x01c5),(_ucs2 0x01c6),(_ucs2 0x01c7);
+insert into t1 values (_ucs2 0x01c8),(_ucs2 0x01c9),(_ucs2 0x01ca),(_ucs2 0x01cb);
+insert into t1 values (_ucs2 0x01cc),(_ucs2 0x01cd),(_ucs2 0x01ce),(_ucs2 0x01cf);
+insert into t1 values (_ucs2 0x01d0),(_ucs2 0x01d1),(_ucs2 0x01d2),(_ucs2 0x01d3);
+insert into t1 values (_ucs2 0x01d4),(_ucs2 0x01d5),(_ucs2 0x01d6),(_ucs2 0x01d7);
+insert into t1 values (_ucs2 0x01d8),(_ucs2 0x01d9),(_ucs2 0x01da),(_ucs2 0x01db);
+insert into t1 values (_ucs2 0x01dc),(_ucs2 0x01dd),(_ucs2 0x01de),(_ucs2 0x01df);
+insert into t1 values (_ucs2 0x01e0),(_ucs2 0x01e1),(_ucs2 0x01e2),(_ucs2 0x01e3);
+insert into t1 values (_ucs2 0x01e4),(_ucs2 0x01e5),(_ucs2 0x01e6),(_ucs2 0x01e7);
+insert into t1 values (_ucs2 0x01e8),(_ucs2 0x01e9),(_ucs2 0x01ea),(_ucs2 0x01eb);
+insert into t1 values (_ucs2 0x01ec),(_ucs2 0x01ed),(_ucs2 0x01ee),(_ucs2 0x01ef);
+insert into t1 values (_ucs2 0x01f0),(_ucs2 0x01f1),(_ucs2 0x01f2),(_ucs2 0x01f3);
+insert into t1 values (_ucs2 0x01f4),(_ucs2 0x01f5),(_ucs2 0x01f6),(_ucs2 0x01f7);
+insert into t1 values (_ucs2 0x01f8),(_ucs2 0x01f9),(_ucs2 0x01fa),(_ucs2 0x01fb);
+insert into t1 values (_ucs2 0x01fc),(_ucs2 0x01fd),(_ucs2 0x01fe),(_ucs2 0x01ff);
+INSERT INTO t1 VALUES (_ucs2 0x1EA0),(_ucs2 0x1EA1),(_ucs2 0x1EA2),(_ucs2 0x1EA3);
+INSERT INTO t1 VALUES (_ucs2 0x1EA4),(_ucs2 0x1EA5),(_ucs2 0x1EA6),(_ucs2 0x1EA7);
+INSERT INTO t1 VALUES (_ucs2 0x1EA8),(_ucs2 0x1EA9),(_ucs2 0x1EAA),(_ucs2 0x1EAB);
+INSERT INTO t1 VALUES (_ucs2 0x1EAC),(_ucs2 0x1EAD),(_ucs2 0x1EAE),(_ucs2 0x1EAF);
+INSERT INTO t1 VALUES (_ucs2 0x1EB0),(_ucs2 0x1EB1),(_ucs2 0x1EB2),(_ucs2 0x1EB3);
+INSERT INTO t1 VALUES (_ucs2 0x1EB4),(_ucs2 0x1EB5),(_ucs2 0x1EB6),(_ucs2 0x1EB7);
+INSERT INTO t1 VALUES (_ucs2 0x1EB8),(_ucs2 0x1EB9),(_ucs2 0x1EBA),(_ucs2 0x1EBB);
+INSERT INTO t1 VALUES (_ucs2 0x1EBC),(_ucs2 0x1EBD),(_ucs2 0x1EBE),(_ucs2 0x1EBF);
+INSERT INTO t1 VALUES (_ucs2 0x1EC0),(_ucs2 0x1EC1),(_ucs2 0x1EC2),(_ucs2 0x1EC3);
+INSERT INTO t1 VALUES (_ucs2 0x1EC4),(_ucs2 0x1EC5),(_ucs2 0x1EC6),(_ucs2 0x1EC7);
+INSERT INTO t1 VALUES (_ucs2 0x1EC8),(_ucs2 0x1EC9),(_ucs2 0x1ECA),(_ucs2 0x1ECB);
+INSERT INTO t1 VALUES (_ucs2 0x1ECC),(_ucs2 0x1ECD),(_ucs2 0x1ECE),(_ucs2 0x1ECF);
+INSERT INTO t1 VALUES (_ucs2 0x1ED0),(_ucs2 0x1ED1),(_ucs2 0x1ED2),(_ucs2 0x1ED3);
+INSERT INTO t1 VALUES (_ucs2 0x1ED4),(_ucs2 0x1ED5),(_ucs2 0x1ED6),(_ucs2 0x1ED7);
+INSERT INTO t1 VALUES (_ucs2 0x1ED8),(_ucs2 0x1ED9),(_ucs2 0x1EDA),(_ucs2 0x1EDB);
+INSERT INTO t1 VALUES (_ucs2 0x1EDC),(_ucs2 0x1EDD),(_ucs2 0x1EDE),(_ucs2 0x1EDF);
+INSERT INTO t1 VALUES (_ucs2 0x1EE0),(_ucs2 0x1EE1),(_ucs2 0x1EE2),(_ucs2 0x1EE3);
+INSERT INTO t1 VALUES (_ucs2 0x1EE4),(_ucs2 0x1EE5),(_ucs2 0x1EE6),(_ucs2 0x1EE7);
+INSERT INTO t1 VALUES (_ucs2 0x1EE8),(_ucs2 0x1EE9),(_ucs2 0x1EEA),(_ucs2 0x1EEB);
+INSERT INTO t1 VALUES (_ucs2 0x1EEC),(_ucs2 0x1EED),(_ucs2 0x1EEE),(_ucs2 0x1EEF);
+INSERT INTO t1 VALUES (_ucs2 0x1EF0),(_ucs2 0x1EF1);
+insert into t1 values ('AA'),('Aa'),('aa'),('aA');
+insert into t1 values ('AE'),('Ae'),('ae'),('aE');
+insert into t1 values ('CH'),('Ch'),('ch'),('cH');
+insert into t1 values ('DZ'),('Dz'),('dz'),('dZ');
+insert into t1 values ('DŽ'),('Dž'),('dž'),('dŽ');
+insert into t1 values ('IJ'),('Ij'),('ij'),('iJ');
+insert into t1 values ('LJ'),('Lj'),('lj'),('lJ');
+insert into t1 values ('LL'),('Ll'),('ll'),('lL');
+insert into t1 values ('NJ'),('Nj'),('nj'),('nJ');
+insert into t1 values ('OE'),('Oe'),('oe'),('oE');
+insert into t1 values ('SS'),('Ss'),('ss'),('sS');
+insert into t1 values ('RR'),('Rr'),('rr'),('rR');
+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;
+c1 HEX(WEIGHT_STRING(c1 LEVEL 1)) HEX(WEIGHT_STRING(c1 LEVEL 2))
+÷ 0552 0020
+× 0553 0020
+A 120F 0020
+a 120F 0020
+Ã 120F 00200032
+á 120F 00200032
+À 120F 00200035
+à 120F 00200035
+Ä‚ 120F 00200037
+ă 120F 00200037
+Ắ 120F 002000370032
+ắ 120F 002000370032
+Ằ 120F 002000370035
+ằ 120F 002000370035
+Ẵ 120F 00200037004E
+ẵ 120F 00200037004E
+Ẳ 120F 002000370064
+ẳ 120F 002000370064
+Â 120F 0020003C
+â 120F 0020003C
+Ấ 120F 0020003C0032
+ấ 120F 0020003C0032
+Ầ 120F 0020003C0035
+ầ 120F 0020003C0035
+Ẫ 120F 0020003C004E
+ẫ 120F 0020003C004E
+Ẩ 120F 0020003C0064
+ẩ 120F 0020003C0064
+Ç 120F 00200041
+ÇŽ 120F 00200041
+Ã… 120F 00200043
+Ã¥ 120F 00200043
+Ǻ 120F 002000430032
+Ç» 120F 002000430032
+Ä 120F 00200047
+ä 120F 00200047
+Çž 120F 00200047005B
+ÇŸ 120F 00200047005B
+Ã 120F 0020004E
+ã 120F 0020004E
+Ç  120F 00200052005B
+Ç¡ 120F 00200052005B
+Ä„ 120F 00200059
+Ä… 120F 00200059
+Ä€ 120F 0020005B
+Ä 120F 0020005B
+Ả 120F 00200064
+ả 120F 00200064
+Ạ 120F 00200070
+ạ 120F 00200070
+Ặ 120F 002000700037
+ặ 120F 002000700037
+Ậ 120F 00200070003C
+ậ 120F 00200070003C
+a 120F020A 00200020
+AA 120F120F 00200020
+Aa 120F120F 00200020
+aA 120F120F 00200020
+aa 120F120F 00200020
+AE 120F126B 00200020
+Ae 120F126B 00200020
+aE 120F126B 00200020
+ae 120F126B 00200020
+Æ 120F126B 002001590020
+æ 120F126B 002001590020
+Ǽ 120F126B 0020015900200032
+ǽ 120F126B 0020015900200032
+Ç¢ 120F126B 002001590020005B
+Ç£ 120F126B 002001590020005B
+B 1225 0020
+b 1225 0020
+Æ€ 122D 0020
+Æ 1235 0020
+Æ‚ 1239 0020
+ƃ 1239 0020
+C 123D 0020
+c 123D 0020
+Ć 123D 00200032
+ć 123D 00200032
+Ĉ 123D 0020003C
+ĉ 123D 0020003C
+ÄŠ 123D 00200052
+Ä‹ 123D 00200052
+Ç 123D 00200056
+ç 123D 00200056
+cH 123D12D3 00200020
+Č 123E 0020
+Ä 123E 0020
+Ƈ 1246 0020
+ƈ 1246 0020
+D 1250 0020
+d 1250 0020
+ÄŽ 1250 00200041
+Ä 1250 00200041
+Ä 1250 0020007D
+Ä‘ 1250 0020007D
+Ã 1250 00200159
+ð 1250 00200159
+DZ 125014AD 00200020
+Dz 125014AD 00200020
+dZ 125014AD 00200020
+dz 125014AD 00200020
+DZ 125014AD 00200020
+Dz 125014AD 00200020
+dz 125014AD 00200020
+Ç„ 125014AD 002000200041
+Ç… 125014AD 002000200041
+dž 125014AD 002000200041
+DŽ 125014AE 00200020
+Dž 125014AE 00200020
+dŽ 125014AE 00200020
+dž 125014AE 00200020
+Ɖ 1258 0020
+ÆŠ 125C 0020
+Æ‹ 1261 0020
+ƌ 1261 0020
+E 126B 0020
+e 126B 0020
+É 126B 00200032
+é 126B 00200032
+È 126B 00200035
+è 126B 00200035
+Ä” 126B 00200037
+Ä• 126B 00200037
+Ê 126B 0020003C
+ê 126B 0020003C
+Ế 126B 0020003C0032
+ế 126B 0020003C0032
+Ề 126B 0020003C0035
+á» 126B 0020003C0035
+Ễ 126B 0020003C004E
+á»… 126B 0020003C004E
+Ể 126B 0020003C0064
+ể 126B 0020003C0064
+Äš 126B 00200041
+Ä› 126B 00200041
+Ë 126B 00200047
+ë 126B 00200047
+Ẽ 126B 0020004E
+ẽ 126B 0020004E
+Ä– 126B 00200052
+Ä— 126B 00200052
+Ę 126B 00200059
+Ä™ 126B 00200059
+Ä’ 126B 0020005B
+Ä“ 126B 0020005B
+Ẻ 126B 00200064
+ẻ 126B 00200064
+Ẹ 126B 00200070
+ẹ 126B 00200070
+Ệ 126B 00200070003C
+ệ 126B 00200070003C
+ÆŽ 1276 0020
+Ç 1276 0020
+Æ 127B 0020
+Æ 1280 0020
+F 12A3 0020
+f 12A3 0020
+Æ‘ 12AA 0020
+Æ’ 12AA 0020
+G 12B0 0020
+g 12B0 0020
+Ç´ 12B0 00200032
+ǵ 12B0 00200032
+Äž 12B0 00200037
+ÄŸ 12B0 00200037
+Ĝ 12B0 0020003C
+Ä 12B0 0020003C
+Ǧ 12B0 00200041
+ǧ 12B0 00200041
+Ä  12B0 00200052
+Ä¡ 12B0 00200052
+Ä¢ 12B0 00200056
+Ä£ 12B0 00200056
+Ǥ 12BC 0020
+Ç¥ 12BC 0020
+Æ“ 12C1 0020
+Æ” 12CB 0020
+Æ¢ 12CF 0020
+Æ£ 12CF 0020
+H 12D3 0020
+h 12D3 0020
+Ĥ 12D3 0020003C
+Ä¥ 12D3 0020003C
+Ħ 12D3 0020007D
+ħ 12D3 0020007D
+CH 12D4 0020
+Ch 12D4 0020
+ch 12D4 0020
+Æ• 12DB 0020
+Ƕ 12DB 0020
+I 12EC 0020
+i 12EC 0020
+Ã 12EC 00200032
+í 12EC 00200032
+Ì 12EC 00200035
+ì 12EC 00200035
+Ĭ 12EC 00200037
+Ä­ 12EC 00200037
+ÃŽ 12EC 0020003C
+î 12EC 0020003C
+Ç 12EC 00200041
+Ç 12EC 00200041
+Ã 12EC 00200047
+ï 12EC 00200047
+Ĩ 12EC 0020004E
+Ä© 12EC 0020004E
+İ 12EC 00200052
+Ä® 12EC 00200059
+į 12EC 00200059
+Ī 12EC 0020005B
+Ä« 12EC 0020005B
+Ỉ 12EC 00200064
+ỉ 12EC 00200064
+Ị 12EC 00200070
+ị 12EC 00200070
+IJ 12EC1305 00200020
+Ij 12EC1305 00200020
+iJ 12EC1305 00200020
+ij 12EC1305 00200020
+IJ 12EC1305 00200020
+ij 12EC1305 00200020
+ı 12F0 0020
+Æ— 12FA 0020
+Æ– 1300 0020
+J 1305 0020
+j 1305 0020
+Ä´ 1305 0020003C
+ĵ 1305 0020003C
+ǰ 1305 00200041
+K 131E 0020
+k 131E 0020
+Ǩ 131E 00200041
+Ç© 131E 00200041
+Ķ 131E 00200056
+Ä· 131E 00200056
+Ƙ 1324 0020
+Æ™ 1324 0020
+L 1330 0020
+l 1330 0020
+Ĺ 1330 00200032
+ĺ 1330 00200032
+Ľ 1330 00200041
+ľ 1330 00200041
+Ä» 1330 00200056
+ļ 1330 00200056
+Å 1330 0020007D
+Å‚ 1330 0020007D
+Ä¿ 1330 00200159
+Å€ 1330 00200159
+LJ 13301305 00200020
+Lj 13301305 00200020
+lJ 13301305 00200020
+lj 13301305 00200020
+LJ 13301305 00200020
+Lj 13301305 00200020
+lj 13301305 00200020
+LL 13301330 00200020
+Ll 13301330 00200020
+lL 13301330 00200020
+ll 13301330 00200020
+Æš 133B 0020
+Æ› 1357 0020
+M 135F 0020
+m 135F 0020
+N 136D 0020
+n 136D 0020
+Ń 136D 00200032
+Å„ 136D 00200032
+Ǹ 136D 00200035
+ǹ 136D 00200035
+Ň 136D 00200041
+ň 136D 00200041
+Ñ 136D 0020004E
+ñ 136D 0020004E
+Å… 136D 00200056
+ņ 136D 00200056
+NJ 136D1305 00200020
+Nj 136D1305 00200020
+nJ 136D1305 00200020
+nj 136D1305 00200020
+ÇŠ 136D1305 00200020
+Ç‹ 136D1305 00200020
+nj 136D1305 00200020
+Æ 1378 0020
+Æž 137C 0020
+ÅŠ 138A 0020
+Å‹ 138A 0020
+O 138E 0020
+o 138E 0020
+Ó 138E 00200032
+ó 138E 00200032
+Ã’ 138E 00200035
+ò 138E 00200035
+ÅŽ 138E 00200037
+Å 138E 00200037
+Ô 138E 0020003C
+ô 138E 0020003C
+á» 138E 0020003C0032
+ố 138E 0020003C0032
+á»’ 138E 0020003C0035
+ồ 138E 0020003C0035
+á»– 138E 0020003C004E
+á»— 138E 0020003C004E
+á»” 138E 0020003C0064
+ổ 138E 0020003C0064
+Ç‘ 138E 00200041
+Ç’ 138E 00200041
+Ö 138E 00200047
+ö 138E 00200047
+Å 138E 0020004D
+Å‘ 138E 0020004D
+Õ 138E 0020004E
+õ 138E 0020004E
+Ø 138E 00200054
+ø 138E 00200054
+Ǿ 138E 002000540032
+Ç¿ 138E 002000540032
+Ǫ 138E 00200059
+Ç« 138E 00200059
+Ǭ 138E 00200059005B
+Ç­ 138E 00200059005B
+Ō 138E 0020005B
+Å 138E 0020005B
+Ỏ 138E 00200064
+á» 138E 00200064
+Æ  138E 00200068
+Æ¡ 138E 00200068
+Ớ 138E 002000680032
+á»› 138E 002000680032
+Ờ 138E 002000680035
+á» 138E 002000680035
+á»  138E 00200068004E
+ỡ 138E 00200068004E
+Ở 138E 002000680064
+ở 138E 002000680064
+Ợ 138E 002000680070
+ợ 138E 002000680070
+Ọ 138E 00200070
+á» 138E 00200070
+Ộ 138E 00200070003C
+á»™ 138E 00200070003C
+OE 138E126B 00200020
+Oe 138E126B 00200020
+oE 138E126B 00200020
+oe 138E126B 00200020
+Å’ 138E126B 002001590020
+Å“ 138E126B 002001590020
+Ɔ 139A 0020
+ÆŸ 13A5 0020
+P 13B3 0020
+p 13B3 0020
+Ƥ 13BC 0020
+Æ¥ 13BC 0020
+Q 13C8 0020
+q 13C8 0020
+ĸ 13D6 0020
+R 13DA 0020
+r 13DA 0020
+Å” 13DA 00200032
+Å• 13DA 00200032
+Å– 13DA 00200056
+Å— 13DA 00200056
+RR 13DA13DA 00200020
+Rr 13DA13DA 00200020
+rR 13DA13DA 00200020
+rr 13DA13DA 00200020
+Ř 13DB 0020
+Å™ 13DB 0020
+Ʀ 13DE 0020
+S 1410 0020
+s 1410 0020
+Åš 1410 00200032
+Å› 1410 00200032
+Ŝ 1410 0020003C
+Å 1410 0020003C
+Åž 1410 00200056
+ÅŸ 1410 00200056
+Å¿ 1410 0020015A
+SS 14101410 00200020
+Ss 14101410 00200020
+sS 14101410 00200020
+ss 14101410 00200020
+ß 14101410 002001590020
+Å  1411 0020
+Å¡ 1411 0020
+Æ© 1421 0020
+ƪ 1426 0020
+T 1433 0020
+t 1433 0020
+Ť 1433 00200041
+Å¥ 1433 00200041
+Å¢ 1433 00200056
+Å£ 1433 00200056
+ƾ 14331410 00200020
+Ŧ 1438 0020
+ŧ 1438 0020
+Æ« 143E 0020
+Ƭ 1442 0020
+Æ­ 1442 0020
+Æ® 1446 0020
+U 1453 0020
+u 1453 0020
+Ú 1453 00200032
+ú 1453 00200032
+Ù 1453 00200035
+ù 1453 00200035
+Ŭ 1453 00200037
+Å­ 1453 00200037
+Û 1453 0020003C
+û 1453 0020003C
+Ç“ 1453 00200041
+Ç” 1453 00200041
+Å® 1453 00200043
+ů 1453 00200043
+Ü 1453 00200047
+ü 1453 00200047
+Ç— 1453 002000470032
+ǘ 1453 002000470032
+Ç› 1453 002000470035
+ǜ 1453 002000470035
+Ç™ 1453 002000470041
+Çš 1453 002000470041
+Ç• 1453 00200047005B
+Ç– 1453 00200047005B
+Ű 1453 0020004D
+ű 1453 0020004D
+Ũ 1453 0020004E
+Å© 1453 0020004E
+Ų 1453 00200059
+ų 1453 00200059
+Ū 1453 0020005B
+Å« 1453 0020005B
+Ủ 1453 00200064
+á»§ 1453 00200064
+Ư 1453 00200068
+ư 1453 00200068
+Ứ 1453 002000680032
+ứ 1453 002000680032
+Ừ 1453 002000680035
+ừ 1453 002000680035
+á»® 1453 00200068004E
+ữ 1453 00200068004E
+Ử 1453 002000680064
+á»­ 1453 002000680064
+á»° 1453 002000680070
+á»± 1453 002000680070
+Ụ 1453 00200070
+ụ 1453 00200070
+Ɯ 146D 0020
+Ʊ 1476 0020
+V 147B 0020
+v 147B 0020
+Ʋ 1482 0020
+W 148D 0020
+w 148D 0020
+Å´ 148D 0020003C
+ŵ 148D 0020003C
+X 1497 0020
+x 1497 0020
+Y 149C 0020
+y 149C 0020
+Ã 149C 00200032
+ý 149C 00200032
+Ŷ 149C 0020003C
+Å· 149C 0020003C
+ÿ 149C 00200047
+Ÿ 149C 00200047
+Ƴ 14A8 0020
+Æ´ 14A8 0020
+Z 14AD 0020
+z 14AD 0020
+Ź 14AD 00200032
+ź 14AD 00200032
+Å» 14AD 00200052
+ż 14AD 00200052
+Æ 14AD148D 00200020
+Ž 14AE 0020
+ž 14AE 0020
+Ƶ 14B2 0020
+ƶ 14B2 0020
+Æ· 14CA 0020
+Ç® 14CA 00200041
+ǯ 14CA 00200041
+Ƹ 14CF 0020
+ƹ 14CF 0020
+ƺ 14D4 0020
+Þ 14E0 0020
+þ 14E0 0020
+Æ¿ 14E6 0020
+Ç· 14E6 0020
+Æ» 14EF 0020
+Ƨ 14F6 0020
+ƨ 14F6 0020
+Ƽ 14FA 0020
+ƽ 14FA 0020
+Æ„ 14FE 0020
+Æ… 14FE 0020
+ʼn 150B136D 00200020
+Ç€ 1525 0020
+Ç 1529 0020
+Ç‚ 152D 0020
+ǃ 1531 0020
+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;
+c1 HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 1)) HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 2))
+A 120F02000200 002000200020
+a 120F02000200 002000200020
+Ã 120F02000200 002000320020
+á 120F02000200 002000320020
+À 120F02000200 002000350020
+à 120F02000200 002000350020
+Ä‚ 120F02000200 002000370020
+ă 120F02000200 002000370020
+Ắ 120F02000200 002000370032
+ắ 120F02000200 002000370032
+Ằ 120F02000200 002000370035
+ằ 120F02000200 002000370035
+Ẵ 120F02000200 00200037004E
+ẵ 120F02000200 00200037004E
+Ẳ 120F02000200 002000370064
+ẳ 120F02000200 002000370064
+Â 120F02000200 0020003C0020
+â 120F02000200 0020003C0020
+Ấ 120F02000200 0020003C0032
+ấ 120F02000200 0020003C0032
+Ầ 120F02000200 0020003C0035
+ầ 120F02000200 0020003C0035
+Ẫ 120F02000200 0020003C004E
+ẫ 120F02000200 0020003C004E
+Ẩ 120F02000200 0020003C0064
+ẩ 120F02000200 0020003C0064
+Ç 120F02000200 002000410020
+ÇŽ 120F02000200 002000410020
+Ã… 120F02000200 002000430020
+Ã¥ 120F02000200 002000430020
+Ǻ 120F02000200 002000430032
+Ç» 120F02000200 002000430032
+Ä 120F02000200 002000470020
+ä 120F02000200 002000470020
+Çž 120F02000200 00200047005B
+ÇŸ 120F02000200 00200047005B
+Ã 120F02000200 0020004E0020
+ã 120F02000200 0020004E0020
+Ç  120F02000200 00200052005B
+Ç¡ 120F02000200 00200052005B
+Ä„ 120F02000200 002000590020
+Ä… 120F02000200 002000590020
+Ä€ 120F02000200 0020005B0020
+Ä 120F02000200 0020005B0020
+Ả 120F02000200 002000640020
+ả 120F02000200 002000640020
+Ạ 120F02000200 002000700020
+ạ 120F02000200 002000700020
+Ặ 120F02000200 002000700037
+ặ 120F02000200 002000700037
+Ậ 120F02000200 00200070003C
+ậ 120F02000200 00200070003C
+a 120F020A0200 002000200020
+AA 120F120F0200 002000200020
+Aa 120F120F0200 002000200020
+aA 120F120F0200 002000200020
+aa 120F120F0200 002000200020
+AE 120F126B0200 002000200020
+Ae 120F126B0200 002000200020
+aE 120F126B0200 002000200020
+ae 120F126B0200 002000200020
+Æ 120F126B0200 002001590020
+æ 120F126B0200 002001590020
+Ǽ 120F126B0200 002001590020
+ǽ 120F126B0200 002001590020
+Ç¢ 120F126B0200 002001590020
+Ç£ 120F126B0200 002001590020
+DROP TABLE t1;
+SELECT 'a' = 'a ';
+'a' = 'a '
+0
+SELECT 'a' < 'á';
+'a' < 'á'
+1
+SELECT 'áa' < 'ab';
+'áa' < 'ab'
+1
+SELECT 'á' < 'ä';
+'á' < 'ä'
+1
+SELECT 'äa' < 'áb';
+'äa' < 'áb'
+1
+SELECT 'c' < 'Ä';
+'c' < 'Ä'
+1
+SELECT 'cb' < 'Äa';
+'cb' < 'Äa'
+1
+SELECT 'd' < 'Ä';
+'d' < 'Ä'
+1
+SELECT 'Äa' < 'db';
+'Äa' < 'db'
+1
+SELECT 'e' < 'é';
+'e' < 'é'
+1
+SELECT 'éa' < 'eb';
+'éa' < 'eb'
+1
+SELECT 'é' < 'ě';
+'é' < 'ě'
+1
+SELECT 'ěa' < 'éb';
+'ěa' < 'éb'
+1
+SELECT 'i' < 'í';
+'i' < 'í'
+1
+SELECT 'ía' < 'ib';
+'ía' < 'ib'
+1
+SELECT 'n' < 'ň';
+'n' < 'ň'
+1
+SELECT 'ňa' < 'nb';
+'ňa' < 'nb'
+1
+SELECT 'o' < 'ó';
+'o' < 'ó'
+1
+SELECT 'óa' < 'ob';
+'óa' < 'ob'
+1
+SELECT 'ó' < 'ö';
+'ó' < 'ö'
+1
+SELECT 'öa' < 'ób';
+'öa' < 'ób'
+1
+SELECT 'r' < 'Å™';
+'r' < 'Å™'
+1
+SELECT 'rb' < 'řa';
+'rb' < 'řa'
+1
+SELECT 's' < 'Å¡';
+'s' < 'Å¡'
+1
+SELECT 'sb' < 'ša';
+'sb' < 'ša'
+1
+SELECT 't' < 'Å¥';
+'t' < 'Å¥'
+1
+SELECT 'Å¥a' < 'tb';
+'Å¥a' < 'tb'
+1
+SELECT 'u' < 'ú';
+'u' < 'ú'
+1
+SELECT 'úa' < 'ub';
+'úa' < 'ub'
+1
+SELECT 'ú' < 'ů';
+'ú' < 'ů'
+1
+SELECT 'ůa' < 'úb';
+'ůa' < 'úb'
+1
+SELECT 'ů' < 'ü';
+'ů' < 'ü'
+1
+SELECT 'üa' < 'ůb';
+'üa' < 'ůb'
+1
+SELECT 'y' < 'ý';
+'y' < 'ý'
+1
+SELECT 'ýa' < 'yb';
+'ýa' < 'yb'
+1
+SELECT 'z' < 'ž';
+'z' < 'ž'
+1
+SELECT 'zb' < 'ža';
+'zb' < 'ža'
+1
+SELECT 'hž' < 'ch';
+'hž' < 'ch'
+1
+SELECT 'chž'< 'i';
+'chž'< 'i'
+1
+SELECT 'a' COLLATE utf8_czech_test_bad_w2;
+ERROR HY000: Unknown collation: 'utf8_czech_test_bad_w2'
diff --git a/mysql-test/r/ctype_like_range.result b/mysql-test/r/ctype_like_range.result
index be66c680e3a..d8e621fd056 100644
--- a/mysql-test/r/ctype_like_range.result
+++ b/mysql-test/r/ctype_like_range.result
@@ -4404,3 +4404,76 @@ id name val
36 sp --------------------------------
DROP VIEW v1;
DROP TABLE t1;
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-10134 Add full support for DEFAULT
+#
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `mn` varchar(10) DEFAULT like_range_min(`a`,10),
+ `mx` varchar(10) DEFAULT like_range_max(`a`,10)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('a'),('a_'),('a%');
+SELECT a, HEX(mn), HEX(mx) FROM t1;
+a HEX(mn) HEX(mx)
+a 61 61
+a_ 6100 61FF
+a% 61000000000000000000 61FFFFFFFFFFFFFFFFFF
+DROP TABLE t1;
+#
+# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
+#
+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;
+a HEX(LIKE_RANGE_MIN(a,200))
+111% 313131
+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;
+a HEX(LIKE_RANGE_MIN(a,200))
+111% 313131
+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;
+a HEX(LIKE_RANGE_MIN(a,200))
+111% 313131
+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;
+a HEX(LIKE_RANGE_MIN(a,200))
+111% 313131
+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;
+a HEX(LIKE_RANGE_MIN(a,200))
+111% 003100310031
+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;
+a HEX(LIKE_RANGE_MIN(a,200))
+111% 003100310031
+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;
+a HEX(LIKE_RANGE_MIN(a,200))
+111% 000000310000003100000031
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result
index 59443a3a2d5..d73a478b0c0 100644
--- a/mysql-test/r/ctype_many.result
+++ b/mysql-test/r/ctype_many.result
@@ -1302,6 +1302,7 @@ CYR SMALL YA CYR CAPIT YA
CYR SMALL YA CYR SMALL YA
SET CHARACTER SET utf8;
ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t1 CHANGE ucs2_f ucs2_f CHAR(32) UNICODE NOT NULL;
INSERT INTO t1 (ucs2_f,comment) VALUES (0x0391,'GREEK CAPIT ALPHA');
INSERT INTO t1 (ucs2_f,comment) VALUES (0x0392,'GREEK CAPIT BETA');
@@ -1764,7 +1765,7 @@ DROP TABLE t1;
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 INTO t2 SELECT * FROM t1;
+INSERT IGNORE INTO t2 SELECT * FROM t1;
Warnings:
Warning 1366 Incorrect string value: '\x00\x01\x00\x82' for column 'a' at row 1
Warning 1366 Incorrect string value: '\x00\x01\x23\x45' for column 'a' at row 2
diff --git a/mysql-test/r/ctype_mb.result b/mysql-test/r/ctype_mb.result
index b6e93bae65a..015457cc1b3 100644
--- a/mysql-test/r/ctype_mb.result
+++ b/mysql-test/r/ctype_mb.result
@@ -15,7 +15,7 @@ t1 CREATE TABLE `t1` (
`c2` varchar(4) CHARACTER SET utf8 NOT NULL,
`c3` char(4) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-INSERT INTO t1 VALUES ('aaaabbbbccccdddd','aaaabbbbccccdddd','aaaabbbbccccdddd');
+INSERT IGNORE INTO t1 VALUES ('aaaabbbbccccdddd','aaaabbbbccccdddd','aaaabbbbccccdddd');
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
Warning 1265 Data truncated for column 'c2' at row 1
diff --git a/mysql-test/r/ctype_nopad_8bit.result b/mysql-test/r/ctype_nopad_8bit.result
new file mode 100644
index 00000000000..b5dadc2f5da
--- /dev/null
+++ b/mysql-test/r/ctype_nopad_8bit.result
@@ -0,0 +1,12771 @@
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET character_set_connection=dec8;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'dec8_swedish_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE dec8_swedish_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=dec8 COLLATE=dec8_swedish_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'dec8_swedish_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'dec8_swedish_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'dec8_swedish_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'dec8_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'dec8_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'dec8_swedish_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_swedish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_swedish_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'dec8_swedish_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_swedish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_swedish_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'dec8_swedish_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE dec8_swedish_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=dec8 COLLATE=dec8_swedish_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'dec8_swedish_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'dec8_swedish_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'dec8_swedish_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'dec8_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'dec8_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'dec8_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'dec8_swedish_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'dec8_swedish_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_swedish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_swedish_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'dec8_swedish_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_swedish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_swedish_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'dec8_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE dec8_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=dec8 COLLATE=dec8_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'dec8_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'dec8_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'dec8_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'dec8_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'dec8_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'dec8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'dec8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'dec8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'dec8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'dec8_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'dec8_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'dec8_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'dec8_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'dec8_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'dec8_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'dec8_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE dec8_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=dec8 COLLATE=dec8_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'dec8_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'dec8_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'dec8_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'dec8_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'dec8_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'dec8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'dec8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'dec8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'dec8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'dec8_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'dec8_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'dec8_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'dec8_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'dec8_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'dec8_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'dec8_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=cp850;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp850_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp850_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=cp850 COLLATE=cp850_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp850_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp850_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp850_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp850_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp850_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp850_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp850_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp850_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp850_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp850_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp850_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp850_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp850_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=cp850 COLLATE=cp850_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp850_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp850_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp850_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp850_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp850_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp850_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp850_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp850_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp850_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp850_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp850_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp850_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp850_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp850_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=cp850 COLLATE=cp850_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp850_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp850_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp850_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp850_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp850_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp850_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp850_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp850_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp850_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp850_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp850_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp850_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp850_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp850_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp850_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp850_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp850_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=cp850 COLLATE=cp850_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp850_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp850_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp850_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp850_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp850_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp850_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp850_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp850_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp850_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp850_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp850_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp850_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp850_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp850_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp850_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp850_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=hp8;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hp8_english_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE hp8_english_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=hp8 COLLATE=hp8_english_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'hp8_english_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hp8_english_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'hp8_english_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'hp8_english_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'hp8_english_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'hp8_english_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'hp8_english_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'hp8_english_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'hp8_english_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hp8_english_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_english_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_english_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'hp8_english_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_english_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_english_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hp8_english_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE hp8_english_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=hp8 COLLATE=hp8_english_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'hp8_english_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hp8_english_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'hp8_english_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'hp8_english_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'hp8_english_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'hp8_english_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'hp8_english_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'hp8_english_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'hp8_english_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'hp8_english_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hp8_english_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_english_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_english_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'hp8_english_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_english_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_english_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hp8_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE hp8_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=hp8 COLLATE=hp8_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'hp8_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hp8_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'hp8_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'hp8_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'hp8_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'hp8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'hp8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'hp8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'hp8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'hp8_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'hp8_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'hp8_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'hp8_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hp8_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'hp8_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hp8_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE hp8_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=hp8 COLLATE=hp8_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'hp8_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hp8_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'hp8_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'hp8_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'hp8_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'hp8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'hp8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'hp8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'hp8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'hp8_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'hp8_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'hp8_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'hp8_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hp8_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'hp8_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hp8_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=koi8r;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8r_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE koi8r_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=koi8r COLLATE=koi8r_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'koi8r_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8r_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'koi8r_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'koi8r_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'koi8r_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8r_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'koi8r_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8r_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE koi8r_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=koi8r COLLATE=koi8r_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'koi8r_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8r_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'koi8r_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'koi8r_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'koi8r_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'koi8r_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'koi8r_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8r_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'koi8r_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8r_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE koi8r_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=koi8r COLLATE=koi8r_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'koi8r_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8r_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'koi8r_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'koi8r_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'koi8r_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'koi8r_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'koi8r_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'koi8r_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'koi8r_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'koi8r_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'koi8r_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'koi8r_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'koi8r_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8r_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'koi8r_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8r_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE koi8r_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=koi8r COLLATE=koi8r_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'koi8r_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8r_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'koi8r_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'koi8r_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'koi8r_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'koi8r_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'koi8r_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'koi8r_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'koi8r_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'koi8r_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'koi8r_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'koi8r_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'koi8r_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8r_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'koi8r_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8r_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=latin2;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin2_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE latin2_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin2 COLLATE=latin2_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin2_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin2_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin2_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'latin2_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'latin2_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'latin2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'latin2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'latin2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'latin2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin2_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin2_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin2_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE latin2_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin2 COLLATE=latin2_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin2_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin2_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin2_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'latin2_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'latin2_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'latin2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'latin2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'latin2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'latin2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'latin2_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin2_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin2_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin2_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE latin2_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin2 COLLATE=latin2_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin2_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin2_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin2_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'latin2_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'latin2_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'latin2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'latin2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'latin2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'latin2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'latin2_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'latin2_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'latin2_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'latin2_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin2_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin2_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin2_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE latin2_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin2 COLLATE=latin2_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin2_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin2_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin2_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'latin2_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'latin2_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'latin2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'latin2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'latin2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'latin2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'latin2_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'latin2_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'latin2_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'latin2_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin2_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin2_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin2_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=swe7;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_swedish_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE swe7_swedish_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=swe7 COLLATE=swe7_swedish_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'swe7_swedish_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_swedish_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'swe7_swedish_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_swedish_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'swe7_swedish_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_swedish_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE swe7_swedish_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=swe7 COLLATE=swe7_swedish_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'swe7_swedish_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_swedish_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'swe7_swedish_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_swedish_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'swe7_swedish_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE swe7_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=swe7 COLLATE=swe7_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'swe7_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'swe7_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'swe7_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE swe7_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=swe7 COLLATE=swe7_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'swe7_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'swe7_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'swe7_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=ascii;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ascii_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE ascii_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=ascii COLLATE=ascii_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ascii_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ascii_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ascii_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'ascii_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'ascii_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'ascii_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'ascii_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'ascii_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'ascii_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ascii_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ascii_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ascii_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE ascii_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=ascii COLLATE=ascii_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ascii_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ascii_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ascii_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'ascii_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'ascii_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'ascii_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'ascii_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'ascii_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'ascii_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'ascii_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ascii_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ascii_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ascii_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE ascii_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=ascii COLLATE=ascii_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ascii_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ascii_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ascii_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'ascii_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'ascii_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'ascii_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'ascii_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'ascii_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'ascii_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'ascii_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'ascii_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'ascii_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'ascii_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ascii_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ascii_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ascii_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE ascii_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=ascii COLLATE=ascii_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ascii_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ascii_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ascii_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'ascii_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'ascii_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'ascii_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'ascii_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'ascii_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'ascii_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'ascii_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'ascii_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'ascii_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'ascii_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ascii_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ascii_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ascii_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=hebrew;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hebrew_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE hebrew_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=hebrew COLLATE=hebrew_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'hebrew_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hebrew_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'hebrew_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'hebrew_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'hebrew_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hebrew_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'hebrew_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hebrew_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE hebrew_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=hebrew COLLATE=hebrew_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'hebrew_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hebrew_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'hebrew_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'hebrew_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'hebrew_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'hebrew_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'hebrew_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hebrew_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'hebrew_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hebrew_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE hebrew_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=hebrew COLLATE=hebrew_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'hebrew_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hebrew_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'hebrew_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'hebrew_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'hebrew_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'hebrew_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'hebrew_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'hebrew_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'hebrew_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'hebrew_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'hebrew_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'hebrew_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'hebrew_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hebrew_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'hebrew_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'hebrew_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE hebrew_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=hebrew COLLATE=hebrew_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'hebrew_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hebrew_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'hebrew_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'hebrew_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'hebrew_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'hebrew_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'hebrew_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'hebrew_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'hebrew_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'hebrew_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'hebrew_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'hebrew_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'hebrew_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'hebrew_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'hebrew_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'hebrew_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=koi8u;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8u_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE koi8u_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=koi8u COLLATE=koi8u_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'koi8u_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8u_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'koi8u_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'koi8u_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'koi8u_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8u_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'koi8u_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8u_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE koi8u_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=koi8u COLLATE=koi8u_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'koi8u_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8u_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'koi8u_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'koi8u_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'koi8u_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'koi8u_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'koi8u_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8u_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'koi8u_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8u_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE koi8u_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=koi8u COLLATE=koi8u_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'koi8u_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8u_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'koi8u_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'koi8u_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'koi8u_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'koi8u_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'koi8u_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'koi8u_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'koi8u_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'koi8u_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'koi8u_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'koi8u_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'koi8u_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8u_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'koi8u_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'koi8u_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE koi8u_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=koi8u COLLATE=koi8u_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'koi8u_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8u_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'koi8u_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'koi8u_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'koi8u_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'koi8u_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'koi8u_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'koi8u_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'koi8u_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'koi8u_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'koi8u_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'koi8u_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'koi8u_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'koi8u_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'koi8u_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'koi8u_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=greek;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'greek_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE greek_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=greek COLLATE=greek_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'greek_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'greek_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'greek_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'greek_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'greek_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'greek_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'greek_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'greek_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'greek_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'greek_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'greek_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'greek_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'greek_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'greek_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'greek_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'greek_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE greek_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=greek COLLATE=greek_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'greek_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'greek_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'greek_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'greek_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'greek_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'greek_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'greek_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'greek_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'greek_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'greek_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'greek_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'greek_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'greek_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'greek_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'greek_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'greek_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE greek_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=greek COLLATE=greek_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'greek_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'greek_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'greek_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'greek_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'greek_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'greek_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'greek_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'greek_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'greek_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'greek_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'greek_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'greek_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'greek_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'greek_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'greek_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'greek_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE greek_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=greek COLLATE=greek_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'greek_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'greek_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'greek_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'greek_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'greek_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'greek_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'greek_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'greek_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'greek_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'greek_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'greek_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'greek_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'greek_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'greek_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'greek_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'greek_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=cp1250;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1250_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp1250_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1250_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1250_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1250_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp1250_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp1250_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1250_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1250_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1250_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp1250_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=cp1250 COLLATE=cp1250_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1250_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1250_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1250_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp1250_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp1250_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp1250_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp1250_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1250_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1250_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1250_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp1250_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1250_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1250_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1250_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp1250_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp1250_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp1250_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp1250_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp1250_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp1250_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp1250_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp1250_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp1250_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp1250_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1250_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1250_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1250_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp1250_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=cp1250 COLLATE=cp1250_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1250_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1250_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1250_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp1250_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp1250_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp1250_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp1250_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp1250_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp1250_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp1250_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp1250_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp1250_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp1250_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1250_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1250_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1250_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=cp1257;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1257_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp1257_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=cp1257 COLLATE=cp1257_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1257_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1257_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1257_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp1257_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp1257_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1257_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1257_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1257_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp1257_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=cp1257 COLLATE=cp1257_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1257_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1257_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1257_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp1257_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp1257_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp1257_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp1257_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1257_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1257_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1257_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp1257_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=cp1257 COLLATE=cp1257_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1257_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1257_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1257_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp1257_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp1257_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp1257_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp1257_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp1257_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp1257_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp1257_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp1257_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp1257_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp1257_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1257_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1257_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1257_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp1257_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=cp1257 COLLATE=cp1257_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1257_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1257_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1257_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp1257_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp1257_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp1257_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp1257_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp1257_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp1257_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp1257_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp1257_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp1257_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp1257_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1257_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1257_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1257_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=latin5;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin5_turkish_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE latin5_turkish_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin5 COLLATE=latin5_turkish_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin5_turkish_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin5_turkish_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin5_turkish_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'latin5_turkish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'latin5_turkish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin5_turkish_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_turkish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_turkish_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin5_turkish_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_turkish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_turkish_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin5_turkish_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE latin5_turkish_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin5 COLLATE=latin5_turkish_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin5_turkish_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin5_turkish_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin5_turkish_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'latin5_turkish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'latin5_turkish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'latin5_turkish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'latin5_turkish_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin5_turkish_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_turkish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_turkish_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin5_turkish_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_turkish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_turkish_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin5_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE latin5_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin5 COLLATE=latin5_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin5_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin5_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin5_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'latin5_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'latin5_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'latin5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'latin5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'latin5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'latin5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'latin5_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'latin5_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'latin5_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'latin5_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin5_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin5_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin5_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE latin5_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin5 COLLATE=latin5_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin5_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin5_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin5_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'latin5_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'latin5_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'latin5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'latin5_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'latin5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'latin5_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'latin5_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'latin5_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'latin5_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'latin5_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin5_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin5_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin5_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=armscii8;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'armscii8_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE armscii8_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=armscii8 COLLATE=armscii8_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'armscii8_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'armscii8_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'armscii8_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'armscii8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'armscii8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'armscii8_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'armscii8_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'armscii8_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE armscii8_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=armscii8 COLLATE=armscii8_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'armscii8_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'armscii8_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'armscii8_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'armscii8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'armscii8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'armscii8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'armscii8_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'armscii8_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'armscii8_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'armscii8_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE armscii8_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=armscii8 COLLATE=armscii8_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'armscii8_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'armscii8_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'armscii8_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'armscii8_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'armscii8_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'armscii8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'armscii8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'armscii8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'armscii8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'armscii8_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'armscii8_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'armscii8_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'armscii8_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'armscii8_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'armscii8_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'armscii8_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE armscii8_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=armscii8 COLLATE=armscii8_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'armscii8_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'armscii8_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'armscii8_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'armscii8_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'armscii8_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'armscii8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'armscii8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'armscii8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'armscii8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'armscii8_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'armscii8_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'armscii8_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'armscii8_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'armscii8_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'armscii8_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'armscii8_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=cp866;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp866_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp866_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=cp866 COLLATE=cp866_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp866_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp866_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp866_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp866_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp866_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp866_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp866_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp866_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp866_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp866_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp866_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp866_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp866_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=cp866 COLLATE=cp866_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp866_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp866_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp866_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp866_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp866_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp866_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp866_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp866_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp866_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp866_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp866_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp866_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp866_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp866_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=cp866 COLLATE=cp866_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp866_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp866_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp866_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp866_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp866_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp866_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp866_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp866_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp866_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp866_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp866_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp866_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp866_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp866_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp866_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp866_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp866_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=cp866 COLLATE=cp866_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp866_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp866_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp866_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp866_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp866_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp866_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp866_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp866_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp866_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp866_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp866_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp866_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp866_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp866_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp866_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp866_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=keybcs2;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'keybcs2_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE keybcs2_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=keybcs2 COLLATE=keybcs2_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'keybcs2_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'keybcs2_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'keybcs2_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'keybcs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'keybcs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'keybcs2_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'keybcs2_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'keybcs2_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE keybcs2_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=keybcs2 COLLATE=keybcs2_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'keybcs2_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'keybcs2_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'keybcs2_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'keybcs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'keybcs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'keybcs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'keybcs2_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'keybcs2_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'keybcs2_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'keybcs2_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE keybcs2_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=keybcs2 COLLATE=keybcs2_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'keybcs2_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'keybcs2_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'keybcs2_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'keybcs2_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'keybcs2_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'keybcs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'keybcs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'keybcs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'keybcs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'keybcs2_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'keybcs2_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'keybcs2_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE keybcs2_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=keybcs2 COLLATE=keybcs2_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'keybcs2_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'keybcs2_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'keybcs2_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'keybcs2_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'keybcs2_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'keybcs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'keybcs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'keybcs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'keybcs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'keybcs2_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'keybcs2_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'keybcs2_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'keybcs2_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=macce;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macce_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE macce_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=macce COLLATE=macce_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'macce_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macce_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'macce_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'macce_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'macce_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'macce_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'macce_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'macce_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'macce_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'macce_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'macce_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'macce_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'macce_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macce_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'macce_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macce_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE macce_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=macce COLLATE=macce_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'macce_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macce_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'macce_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'macce_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'macce_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'macce_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'macce_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'macce_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'macce_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'macce_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'macce_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'macce_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'macce_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macce_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'macce_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macce_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE macce_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=macce COLLATE=macce_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'macce_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macce_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'macce_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'macce_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'macce_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'macce_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'macce_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'macce_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'macce_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'macce_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'macce_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'macce_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'macce_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macce_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'macce_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macce_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE macce_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=macce COLLATE=macce_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'macce_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macce_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'macce_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'macce_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'macce_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'macce_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'macce_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'macce_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'macce_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'macce_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'macce_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'macce_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'macce_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macce_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'macce_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macce_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=macroman;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macroman_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE macroman_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=macroman COLLATE=macroman_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'macroman_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macroman_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'macroman_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'macroman_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'macroman_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'macroman_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'macroman_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'macroman_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'macroman_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macroman_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'macroman_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macroman_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE macroman_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=macroman COLLATE=macroman_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'macroman_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macroman_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'macroman_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'macroman_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'macroman_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'macroman_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'macroman_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'macroman_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'macroman_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'macroman_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macroman_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'macroman_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macroman_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE macroman_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=macroman COLLATE=macroman_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'macroman_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macroman_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'macroman_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'macroman_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'macroman_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'macroman_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'macroman_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'macroman_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'macroman_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'macroman_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'macroman_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'macroman_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'macroman_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macroman_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'macroman_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'macroman_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE macroman_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=macroman COLLATE=macroman_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'macroman_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macroman_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'macroman_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'macroman_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'macroman_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'macroman_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'macroman_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'macroman_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'macroman_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'macroman_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'macroman_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'macroman_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'macroman_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'macroman_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'macroman_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'macroman_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=cp852;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp852_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp852_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=cp852 COLLATE=cp852_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp852_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp852_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp852_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp852_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp852_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp852_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp852_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp852_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp852_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp852_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp852_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp852_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp852_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=cp852 COLLATE=cp852_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp852_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp852_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp852_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp852_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp852_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp852_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp852_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp852_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp852_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp852_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp852_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp852_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp852_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp852_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=cp852 COLLATE=cp852_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp852_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp852_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp852_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp852_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp852_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp852_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp852_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp852_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp852_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp852_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp852_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp852_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp852_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp852_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp852_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp852_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp852_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=cp852 COLLATE=cp852_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp852_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp852_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp852_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp852_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp852_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp852_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp852_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp852_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp852_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp852_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp852_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp852_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp852_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp852_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp852_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp852_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=latin7;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin7_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE latin7_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin7 COLLATE=latin7_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin7_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin7_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin7_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+86000000000000000000
+86303000000000000000
+30860000000000000000
+30863000000000000000
+86303030000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'latin7_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'latin7_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'latin7_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'latin7_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'latin7_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'latin7_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin7_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin7_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin7_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE latin7_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin7 COLLATE=latin7_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin7_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin7_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin7_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+86000000000000000000
+86303000000000000000
+30860000000000000000
+30863000000000000000
+86303030000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'latin7_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'latin7_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'latin7_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'latin7_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'latin7_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'latin7_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'latin7_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin7_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin7_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin7_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE latin7_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin7 COLLATE=latin7_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin7_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin7_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin7_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'latin7_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'latin7_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'latin7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'latin7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'latin7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'latin7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'latin7_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'latin7_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'latin7_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'latin7_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin7_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin7_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin7_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE latin7_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=latin7 COLLATE=latin7_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin7_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin7_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin7_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'latin7_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'latin7_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'latin7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'latin7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'latin7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'latin7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'latin7_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'latin7_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'latin7_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'latin7_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin7_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin7_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin7_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=cp1251;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1251_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp1251_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1251_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1251_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1251_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp1251_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp1251_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1251_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1251_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1251_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp1251_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1251_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1251_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1251_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp1251_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp1251_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp1251_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp1251_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1251_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1251_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1251_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp1251_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1251_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1251_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1251_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp1251_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp1251_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp1251_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp1251_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp1251_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp1251_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp1251_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp1251_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp1251_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp1251_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1251_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1251_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1251_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp1251_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COLLATE=cp1251_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1251_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1251_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1251_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp1251_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp1251_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp1251_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp1251_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp1251_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp1251_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp1251_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp1251_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp1251_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp1251_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1251_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1251_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1251_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=cp1256;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1256_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp1256_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=cp1256 COLLATE=cp1256_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1256_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1256_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1256_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp1256_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp1256_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1256_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1256_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1256_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp1256_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=cp1256 COLLATE=cp1256_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1256_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1256_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1256_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp1256_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp1256_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp1256_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp1256_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1256_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1256_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1256_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp1256_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=cp1256 COLLATE=cp1256_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1256_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1256_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1256_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp1256_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp1256_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp1256_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp1256_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp1256_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp1256_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp1256_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp1256_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp1256_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp1256_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1256_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1256_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'cp1256_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE cp1256_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=cp1256 COLLATE=cp1256_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'cp1256_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1256_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'cp1256_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'cp1256_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'cp1256_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'cp1256_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'cp1256_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'cp1256_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'cp1256_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'cp1256_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'cp1256_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'cp1256_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'cp1256_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'cp1256_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'cp1256_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'cp1256_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET character_set_connection=geostd8;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'geostd8_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE geostd8_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=geostd8 COLLATE=geostd8_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'geostd8_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'geostd8_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'geostd8_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'geostd8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'geostd8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'geostd8_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'geostd8_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'geostd8_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE geostd8_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=geostd8 COLLATE=geostd8_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'geostd8_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'geostd8_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'geostd8_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'geostd8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'geostd8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'geostd8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'geostd8_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'geostd8_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'geostd8_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'geostd8_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE geostd8_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=geostd8 COLLATE=geostd8_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'geostd8_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'geostd8_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'geostd8_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'geostd8_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'geostd8_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'geostd8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'geostd8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'geostd8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'geostd8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'geostd8_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'geostd8_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'geostd8_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'geostd8_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'geostd8_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'geostd8_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'geostd8_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE geostd8_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=geostd8 COLLATE=geostd8_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'geostd8_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'geostd8_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'geostd8_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'geostd8_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'geostd8_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'geostd8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'geostd8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'geostd8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'geostd8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'geostd8_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'geostd8_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'geostd8_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'geostd8_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'geostd8_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'geostd8_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'geostd8_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result
index 2555749fa8c..806d9dc6997 100644
--- a/mysql-test/r/ctype_recoding.result
+++ b/mysql-test/r/ctype_recoding.result
@@ -30,7 +30,7 @@ CREATE TABLE t2 (a TEXT CHARACTER SET utf8);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` text CHARACTER SET cp1251
+ `a` text CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(a) FROM t1;
HEX(a)
@@ -169,7 +169,7 @@ ERROR HY000: Invalid utf8 character string: 'good\xD0\xCC\xCF\xC8\xCF'
set names latin1;
create table t1 (a char(10) character set koi8r, b text character set koi8r);
insert into t1 values ('test','test');
-insert into t1 values ('ÊÃÕË','ÊÃÕË');
+insert ignore into t1 values ('ÊÃÕË','ÊÃÕË');
Warnings:
Warning 1366 Incorrect string value: '\xCA\xC3\xD5\xCB' for column 'a' at row 1
Warning 1366 Incorrect string value: '\xCA\xC3\xD5\xCB' for column 'b' at row 1
diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result
index 46686933298..c19a0008e11 100644
--- a/mysql-test/r/ctype_sjis.result
+++ b/mysql-test/r/ctype_sjis.result
@@ -193,30 +193,18 @@ CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
hex(concat(repeat(0xF1F2, 10), '%'))
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
a hex(b) c
-2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
+2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
#
# MDEV-4842 STR_TO_DATE does not work with UCS2/UTF16/UTF32
@@ -230,8 +218,8 @@ STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR))
CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0;
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
-subject varchar(64) NO NULL
-pattern varchar(64) NO NULL
+subject varchar(64) YES NULL
+pattern varchar(64) YES NULL
INSERT INTO t1 VALUES (_utf8'2001÷01÷01',_utf8'%Y÷%m÷%d');
SELECT HEX(subject),HEX(pattern),STR_TO_DATE(subject, pattern) FROM t1;
HEX(subject) HEX(pattern) STR_TO_DATE(subject, pattern)
@@ -359,30 +347,18 @@ CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
hex(concat(repeat(0xF1F2, 10), '%'))
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
a hex(b) c
-2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
+2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
SET NAMES sjis;
SELECT HEX('²“‘@Œ\') FROM DUAL;
@@ -424,7 +400,7 @@ 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;
-INSERT t1 (code) SELECT head FROM head WHERE (head BETWEEN 'A1' AND 'DF');
+INSERT IGNORE t1 (code) SELECT head FROM head WHERE (head BETWEEN 'A1' AND 'DF');
Warnings:
Warning 1364 Field 'a' doesn't have a default value
DROP TEMPORARY TABLE head, tail;
@@ -434,7 +410,7 @@ t1 CREATE TABLE `t1` (
`code` varchar(8) DEFAULT NULL,
`a` varchar(1) CHARACTER SET sjis NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-UPDATE t1 SET a=unhex(code) ORDER BY code;
+UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
Warnings:
Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1
Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2
@@ -14972,7 +14948,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET sjis NOT NULL
+ `a` varchar(5) CHARACTER SET sjis DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -15231,7 +15207,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET sjis COLLATE sjis_bin NOT NULL
+ `a` varchar(5) CHARACTER SET sjis COLLATE sjis_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -15469,6 +15445,7 @@ hex(weight_string(cast(0x814081408140 as char),25, 4, 0xC0))
# Start of 10.0 tests
#
# Start of ctype_unescape.inc
+SET sql_mode = '';
SET @query=_binary'SELECT CHARSET(\'test\'),@@character_set_client,@@character_set_connection';
PREPARE stmt FROM @query;
EXECUTE stmt;
@@ -18531,6 +18508,7 @@ DROP FUNCTION wellformedness;
DROP FUNCTION mysql_real_escape_string_generated;
DROP FUNCTION iswellformed;
DROP TABLE allbytes;
+SET sql_mode = DEFAULT;
# End of ctype_backslash.inc
SET NAMES sjis;
# Start of ctype_E05C.inc
@@ -18574,7 +18552,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET sjis NOT NULL
+ `a` varchar(10) CHARACTER SET sjis DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\'),('à\t');
INSERT INTO t1 VALUES ('\\à\'),('\\à\t'),('\\à\t\t');
@@ -18613,7 +18591,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET sjis NOT NULL
+ `a` varchar(10) CHARACTER SET sjis DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (BINARY('à\')),(BINARY('à\t'));
INSERT INTO t1 VALUES (BINARY('\\à\')),(BINARY('\\à\t')),(BINARY('\\à\t\t'));
@@ -18652,7 +18630,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET sjis NOT NULL
+ `a` varchar(10) CHARACTER SET sjis DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_BINARY'à\'),(_BINARY'à\t');
INSERT INTO t1 VALUES (_BINARY'\\à\'),(_BINARY'\\à\t'),(_BINARY'\\à\t\t');
@@ -18698,7 +18676,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET sjis NOT NULL
+ `a` varchar(10) CHARACTER SET sjis DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\['),('\à\[');
SELECT HEX(a) FROM t1;
@@ -18718,7 +18696,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varbinary(10) NOT NULL
+ `a` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('à\['),('\à\[');
SELECT HEX(a) FROM t1;
@@ -18730,3 +18708,579 @@ DROP TABLE t1;
#
# End of 10.0 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
+#
+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;
+HEX(a)
+78835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C
+SELECT a=CONCAT('x', REPEAT(_sjis 0x835C, 200)) FROM t1;
+a=CONCAT('x', REPEAT(_sjis 0x835C, 200))
+1
+DROP TABLE t1;
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET character_set_connection=sjis;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'sjis_japanese_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE sjis_japanese_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_japanese_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'sjis_japanese_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'sjis_japanese_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'sjis_japanese_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'sjis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'sjis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'sjis_japanese_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_japanese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_japanese_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'sjis_japanese_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_japanese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_japanese_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'sjis_japanese_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE sjis_japanese_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_japanese_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'sjis_japanese_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'sjis_japanese_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'sjis_japanese_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'sjis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'sjis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'sjis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'sjis_japanese_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'sjis_japanese_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_japanese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_japanese_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'sjis_japanese_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_japanese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_japanese_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'sjis_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE sjis_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=sjis COLLATE=sjis_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'sjis_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'sjis_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'sjis_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'sjis_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'sjis_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'sjis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'sjis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'sjis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'sjis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'sjis_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'sjis_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'sjis_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'sjis_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'sjis_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'sjis_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'sjis_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE sjis_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=sjis COLLATE=sjis_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'sjis_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'sjis_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'sjis_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'sjis_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'sjis_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'sjis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'sjis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'sjis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'sjis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'sjis_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'sjis_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'sjis_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'sjis_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'sjis_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'sjis_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'sjis_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_swe7.result b/mysql-test/r/ctype_swe7.result
index ccab77c21d1..63da7d362ca 100644
--- a/mysql-test/r/ctype_swe7.result
+++ b/mysql-test/r/ctype_swe7.result
@@ -3,6 +3,7 @@
#
SET NAMES swe7;
# Start of ctype_unescape.inc
+SET sql_mode = '';
SET @query=_binary'SELECT CHARSET(\'test\'),@@character_set_client,@@character_set_connection';
PREPARE stmt FROM @query;
EXECUTE stmt;
@@ -3065,7 +3066,572 @@ DROP FUNCTION wellformedness;
DROP FUNCTION mysql_real_escape_string_generated;
DROP FUNCTION iswellformed;
DROP TABLE allbytes;
+SET sql_mode = DEFAULT;
# End of ctype_backslash.inc
#
# End of 10.0 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET character_set_connection=swe7;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_swedish_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE ?t1? (
+ ?a? varchar(10) COLLATE swe7_swedish_nopad_ci NOT NULL,
+ PRIMARY KEY (?a?)
+) ENGINE=MyISAM DEFAULT CHARSET=swe7 COLLATE=swe7_swedish_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'swe7_swedish_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_swedish_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'swe7_swedish_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_swedish_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'swe7_swedish_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_swedish_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE ?t1? (
+ ?a? varchar(10) COLLATE swe7_swedish_nopad_ci NOT NULL,
+ PRIMARY KEY (?a?)
+) ENGINE=MEMORY DEFAULT CHARSET=swe7 COLLATE=swe7_swedish_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'swe7_swedish_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_swedish_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'swe7_swedish_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'swe7_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'swe7_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'swe7_swedish_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_swedish_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'swe7_swedish_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_swedish_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE ?t1? (
+ ?a? varchar(10) COLLATE swe7_nopad_bin NOT NULL,
+ PRIMARY KEY (?a?)
+) ENGINE=MyISAM DEFAULT CHARSET=swe7 COLLATE=swe7_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'swe7_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'swe7_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'swe7_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'swe7_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE ?t1? (
+ ?a? varchar(10) COLLATE swe7_nopad_bin NOT NULL,
+ PRIMARY KEY (?a?)
+) ENGINE=MEMORY DEFAULT CHARSET=swe7 COLLATE=swe7_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'swe7_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'swe7_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'swe7_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'swe7_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'swe7_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'swe7_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'swe7_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'swe7_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'swe7_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'swe7_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_tis620.result b/mysql-test/r/ctype_tis620.result
index 947aeb5ff5b..d5b4c632c31 100644
--- a/mysql-test/r/ctype_tis620.result
+++ b/mysql-test/r/ctype_tis620.result
@@ -121,7 +121,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`recid` int(11) NOT NULL AUTO_INCREMENT,
- `dyninfo` text,
+ `dyninfo` text DEFAULT NULL,
PRIMARY KEY (`recid`)
) ENGINE=MyISAM DEFAULT CHARSET=tis620
INSERT INTO t1 VALUES (1,'color=\"STB,NPG\"\r\nengine=\"J30A13\"\r\nframe=\"MRHCG1640YP4\"\r\ngrade=\"V6\"\r\nmodel=\"ACCORD\"\r\nmodelcode=\"CG164YEN\"\r\ntype=\"VT6\"\r\n');
@@ -3122,7 +3122,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET tis620 NOT NULL
+ `c1` varchar(10) CHARACTER SET tis620 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -3139,13 +3139,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a '))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a '
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET tis620 NOT NULL
+ `c1` varchar(10) CHARACTER SET tis620 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -3162,13 +3162,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET tis620 NOT NULL
+ `c1` varchar(10) CHARACTER SET tis620 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -3185,13 +3185,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET tis620 NOT NULL
+ `c1` varchar(10) CHARACTER SET tis620 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -3208,7 +3208,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
#
# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
@@ -3217,7 +3217,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET tis620 NOT NULL
+ `a` varchar(10) CHARACTER SET tis620 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
@@ -3230,7 +3230,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a '))))
+Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a '
DROP TABLE t1;
#
# End of MDEV-8694
@@ -3338,7 +3338,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL
+ `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -3355,13 +3355,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a '))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a '
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL
+ `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -3378,13 +3378,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL
+ `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -3401,13 +3401,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL
+ `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -3424,7 +3424,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
#
# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
@@ -3433,7 +3433,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL
+ `a` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
@@ -3446,7 +3446,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a '))))
+Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a '
DROP TABLE t1;
#
# End of MDEV-8694
@@ -3486,7 +3486,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET tis620 NOT NULL
+ `a` varchar(5) CHARACTER SET tis620 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -3630,6 +3630,21 @@ hex(weight_string('abc' as char(5) LEVEL 1 DESC))
select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE));
hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))
DFDF9C9D9E
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+-1 1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+-1 1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+-1 1
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+-1 1
select hex(weight_string(cast(0xE0A1 as char)));
hex(weight_string(cast(0xE0A1 as char)))
A1E0
@@ -3664,7 +3679,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL
+ `a` varchar(5) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -3808,6 +3823,21 @@ hex(weight_string('abc' as char(5) LEVEL 1 DESC))
select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE));
hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))
DFDF9C9D9E
+SELECT strcmp('a','a '), strcmp('a ','a');
+strcmp('a','a ') strcmp('a ','a')
+0 0
+SELECT strcmp('a\0','a' ), strcmp('a','a\0');
+strcmp('a\0','a' ) strcmp('a','a\0')
+-1 1
+SELECT strcmp('a\0','a '), strcmp('a ','a\0');
+strcmp('a\0','a ') strcmp('a ','a\0')
+-1 1
+SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
+strcmp('a\t','a' ) strcmp('a', 'a\t')
+-1 1
+SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
+strcmp('a\t','a ') strcmp('a ', 'a\t')
+-1 1
select hex(weight_string(cast(0xE0A1 as char)));
hex(weight_string(cast(0xE0A1 as char)))
E0A1
@@ -3817,3 +3847,567 @@ E0
#
# End of 5.6 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET character_set_connection=tis620;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'tis620_thai_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE tis620_thai_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=tis620 COLLATE=tis620_thai_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'tis620_thai_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_thai_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'tis620_thai_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_thai_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'tis620_thai_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'tis620_thai_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE tis620_thai_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=tis620 COLLATE=tis620_thai_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'tis620_thai_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_thai_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'tis620_thai_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_thai_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'tis620_thai_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'tis620_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE tis620_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=tis620 COLLATE=tis620_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'tis620_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'tis620_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'tis620_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'tis620_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE tis620_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=tis620 COLLATE=tis620_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'tis620_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'tis620_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'tis620_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result
index d9cba536814..6c6dceba9cb 100644
--- a/mysql-test/r/ctype_uca.result
+++ b/mysql-test/r/ctype_uca.result
@@ -6080,7 +6080,7 @@ want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
-insert into t1 values (),();
+insert ignore into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
@@ -6326,7 +6326,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
@@ -6520,30 +6520,18 @@ CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
hex(concat(repeat(0xF1F2, 10), '%'))
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F20025
3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
a hex(b) c
-2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
+2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
set names utf8;
End for 5.0 tests
@@ -6746,7 +6734,7 @@ ADD KEY(ch);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
KEY `ch` (`ch`)
@@ -6834,7 +6822,7 @@ aÖ€
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index
+1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
@@ -6861,7 +6849,7 @@ Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index
+1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
@@ -6894,7 +6882,7 @@ z
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index
+1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
@@ -6905,7 +6893,7 @@ Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index
+1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
@@ -6990,7 +6978,7 @@ ADD KEY(ch);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
KEY `ch` (`ch`)
@@ -7245,7 +7233,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci NOT NULL
+ `a` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -7489,7 +7477,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
+ `a` varchar(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -8117,7 +8105,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL,
+ `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_german2_ci DEFAULT NULL,
`b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
@@ -8147,7 +8135,7 @@ CREATE TABLE t1 AS SELECT repeat('a', 10) as c LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL
+ `c` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_utf32 0x0180),(_utf32 0x023A);
INSERT INTO t1 VALUES (_utf32 0x023B),(_utf32 0x023C);
@@ -8420,7 +8408,7 @@ F09090A8 30D2 ð¨
ALTER TABLE t1 ADD KEY(c);
EXPLAIN SELECT hex(c) FROM t1 WHERE c LIKE 'a%' ORDER BY c;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 42 NULL 3 Using where; Using index
+1 SIMPLE t1 range c c 43 NULL 3 Using where; Using index
SELECT hex(c), hex(weight_string(c)) FROM t1 WHERE c LIKE 'a%' ORDER BY c;
hex(c) hex(weight_string(c))
61 120F
@@ -8451,7 +8439,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -8468,13 +8456,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a '))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a '
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -8491,13 +8479,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -8514,13 +8502,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -8537,7 +8525,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
#
# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
@@ -8546,7 +8534,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
+ `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
@@ -8559,7 +8547,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((not((`test`.`t1`.`a` like 'a '))) and (`test`.`t1`.`a` = 'a'))
+Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` not like 'a ' and `test`.`t1`.`a` = 'a'
DROP TABLE t1;
#
# End of MDEV-8694
@@ -8571,7 +8559,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('ae'),('ä');
SELECT * FROM t1 WHERE c1='ä';
@@ -8586,7 +8574,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((`test`.`t1`.`c1` = 'ä') and (`test`.`t1`.`c1` like 'ae'))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where `test`.`t1`.`c1` = 'ä' and `test`.`t1`.`c1` like 'ae'
SELECT * FROM t1 WHERE CONCAT(c1)='ä';
c1
ä
@@ -8599,7 +8587,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae'
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'ä') and (concat(`test`.`t1`.`c1`) like 'ae'))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'ä' and concat(`test`.`t1`.`c1`) like 'ae'
DROP TABLE IF EXISTS t1;
SET NAMES utf8 COLLATE utf8_german2_ci;
#
@@ -8609,7 +8597,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -8626,13 +8614,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a '))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a '
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -8649,13 +8637,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -8672,13 +8660,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -8695,7 +8683,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
#
# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
@@ -8704,7 +8692,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL
+ `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
@@ -8717,7 +8705,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((not((`test`.`t1`.`a` like 'a '))) and (`test`.`t1`.`a` = 'a'))
+Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` not like 'a ' and `test`.`t1`.`a` = 'a'
DROP TABLE t1;
#
# End of MDEV-8694
@@ -8729,7 +8717,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('ae'),('ä');
SELECT * FROM t1 WHERE c1='ä';
@@ -8746,7 +8734,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((`test`.`t1`.`c1` = 'ä') and (`test`.`t1`.`c1` like 'ae'))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where `test`.`t1`.`c1` = 'ä' and `test`.`t1`.`c1` like 'ae'
SELECT * FROM t1 WHERE CONCAT(c1)='ä';
c1
ae
@@ -8761,7 +8749,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae'
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'ä') and (concat(`test`.`t1`.`c1`) like 'ae'))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'ä' and concat(`test`.`t1`.`c1`) like 'ae'
DROP TABLE IF EXISTS t1;
#
# MDEV-4929 Myanmar collation
@@ -8782,7 +8770,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `s1` varchar(64) CHARACTER SET utf8 COLLATE utf8_myanmar_ci NOT NULL,
+ `s1` varchar(64) CHARACTER SET utf8 COLLATE utf8_myanmar_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 (s1) VALUES
@@ -11358,7 +11346,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `s1` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_myanmar_ci NOT NULL,
+ `s1` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_myanmar_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 (s1) VALUES
@@ -13944,12 +13932,12 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' AND a='oe' COLLATE utf8_german2_c
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'oe') and (`test`.`t1`.`a` = 'oe'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'oe' and `test`.`t1`.`a` = 'oe'
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci AND a='oe';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'oe') and (`test`.`t1`.`a` = 'oe'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'oe' and `test`.`t1`.`a` = 'oe'
DROP TABLE t1;
#
# End of MariaDB-10.0 tests
@@ -13998,7 +13986,7 @@ CREATE TABLE t1 AS SELECT SPACE(3) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(3) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 NOT NULL
+ `a` varchar(3) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (SPACE(0)),(SPACE(1)),(SPACE(2));
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(8))) FROM t1;
@@ -14031,7 +14019,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 NOT NULL
+ `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_ucs2 0x3400);
INSERT INTO t1 VALUES (_ucs2 0xF001);
@@ -14044,7 +14032,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 NOT NULL
+ `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('A'),('À'),('Ã'),('Â'),('Ã'),('Ä'),('Ã…');
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a;
@@ -14103,7 +14091,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 NOT NULL
+ `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('cota'),('cote'),('cotz');
INSERT INTO t1 VALUES ('coté'),('côte'),('côté'),('cotë'),('côtë');
@@ -14692,7 +14680,7 @@ CREATE TABLE t1 AS SELECT SPACE(3) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 NOT NULL
+ `a` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (SPACE(0)),(SPACE(1)),(SPACE(2));
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(8))) FROM t1;
@@ -14725,7 +14713,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 NOT NULL
+ `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_ucs2 0x3400);
INSERT INTO t1 VALUES (_ucs2 0xF001);
@@ -14738,7 +14726,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 NOT NULL
+ `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('A'),('À'),('Ã'),('Â'),('Ã'),('Ä'),('Ã…');
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a;
@@ -14797,7 +14785,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 NOT NULL
+ `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('cota'),('cote'),('cotz');
INSERT INTO t1 VALUES ('coté'),('côte'),('côté'),('cotë'),('côtë');
@@ -15369,3 +15357,23 @@ DROP TABLE t1;
#
# End of MariaDB-10.1 tests
#
+#
+# Start of MariaDB-10.2 tests
+#
+#
+# MDEV-9407 Illegal mix of collation when using GROUP_CONCAT in a VIEW
+#
+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;
+col1
+f
+a
+b
+DROP VIEW v1;
+DROP TABLE t1;
+#
+# End of MariaDB-10.2 tests
+#
diff --git a/mysql-test/r/ctype_uca_innodb.result b/mysql-test/r/ctype_uca_innodb.result
index f189e698da1..c04a99c8cd3 100644
--- a/mysql-test/r/ctype_uca_innodb.result
+++ b/mysql-test/r/ctype_uca_innodb.result
@@ -15,7 +15,7 @@ ADD KEY(ch);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
+ `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
KEY `ch` (`ch`)
@@ -103,7 +103,7 @@ aÖ€
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index
+1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
@@ -130,7 +130,7 @@ Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index
+1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
@@ -163,7 +163,7 @@ z
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index
+1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
@@ -174,7 +174,7 @@ Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index
+1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
diff --git a/mysql-test/r/ctype_uca_partitions.result b/mysql-test/r/ctype_uca_partitions.result
index 11d4e82e27b..154de148ee0 100644
--- a/mysql-test/r/ctype_uca_partitions.result
+++ b/mysql-test/r/ctype_uca_partitions.result
@@ -6,8 +6,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (c1)
-PARTITIONS 3 */
+ PARTITION BY KEY (`c1`)
+PARTITIONS 3
INSERT INTO t1 VALUES ('A'),('À'),('Ã'),('Â'),('Ã'),('Ä'),('Ã…');
INSERT INTO t1 VALUES ('B');
INSERT INTO t1 VALUES ('C');
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 55caabbaa12..f6d3d86e2cd 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -55,7 +55,7 @@ want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
-insert into t1 values (),();
+insert ignore into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
@@ -196,8 +196,8 @@ RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `l` varchar(10) CHARACTER SET ucs2 NOT NULL,
- `r` varchar(10) CHARACTER SET ucs2 NOT NULL
+ `l` varchar(10) CHARACTER SET ucs2 DEFAULT NULL,
+ `r` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
@@ -933,7 +933,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET ucs2 NOT NULL,
+ `a` varchar(1) CHARACTER SET ucs2 DEFAULT NULL,
`b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
@@ -959,30 +959,18 @@ CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
hex(concat(repeat(0xF1F2, 10), '%'))
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F20025
3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
a hex(b) c
-2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
+2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
#
# MDEV-4842 STR_TO_DATE does not work with UCS2/UTF16/UTF32
@@ -996,8 +984,8 @@ STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR))
CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0;
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
-subject varchar(64) NO NULL
-pattern varchar(64) NO NULL
+subject varchar(64) YES NULL
+pattern varchar(64) YES NULL
INSERT INTO t1 VALUES (_utf8'2001÷01÷01',_utf8'%Y÷%m÷%d');
SELECT HEX(subject),HEX(pattern),STR_TO_DATE(subject, pattern) FROM t1;
HEX(subject) HEX(pattern) STR_TO_DATE(subject, pattern)
@@ -1104,30 +1092,18 @@ CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
hex(concat(repeat(0xF1F2, 10), '%'))
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F20025
3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
a hex(b) c
-2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
+2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
select hex(substr(_ucs2 0x00e400e50068,1));
hex(substr(_ucs2 0x00e400e50068,1))
@@ -1156,7 +1132,7 @@ Field1
-1
DROP TABLE t1;
CREATE TABLE t1 (Field1 int(10) unsigned default '0');
-INSERT INTO t1 VALUES ('-1');
+INSERT IGNORE INTO t1 VALUES ('-1');
Warnings:
Warning 1264 Out of range value for column 'Field1' at row 1
DROP TABLE t1;
@@ -1622,7 +1598,7 @@ create table t1 as select concat(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -1635,7 +1611,7 @@ create table t1 as select concat(18446744073709551615) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(20) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(20) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -1648,7 +1624,7 @@ create table t1 as select concat(1.1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -1661,7 +1637,7 @@ create table t1 as select concat(1+2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1-2));
@@ -1671,7 +1647,7 @@ create table t1 as select concat(1-2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1*2));
@@ -1681,7 +1657,7 @@ create table t1 as select concat(1*2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1/2));
@@ -1721,7 +1697,7 @@ create table t1 as select concat(-1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(-(1+2)));
@@ -1731,7 +1707,7 @@ create table t1 as select concat(-(1+2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1|2));
@@ -1741,7 +1717,7 @@ create table t1 as select concat(1|2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1&2));
@@ -1751,7 +1727,7 @@ create table t1 as select concat(1&2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_count(12)));
@@ -1761,7 +1737,7 @@ create table t1 as select concat(bit_count(12)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2<<1));
@@ -1771,7 +1747,7 @@ create table t1 as select concat(2<<1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2>>1));
@@ -1781,7 +1757,7 @@ create table t1 as select concat(2>>1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(~0));
@@ -1791,7 +1767,7 @@ create table t1 as select concat(~0) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(3^2));
@@ -1801,7 +1777,7 @@ create table t1 as select concat(3^2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(abs(-2)));
@@ -1811,7 +1787,7 @@ create table t1 as select concat(abs(-2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(concat(exp(2)),1));
@@ -1941,7 +1917,7 @@ create table t1 as select concat(degrees(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(23) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(radians(0)));
@@ -1951,7 +1927,7 @@ create table t1 as select concat(radians(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(23) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ceiling(0.5)));
@@ -1961,7 +1937,7 @@ create table t1 as select concat(ceiling(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
@@ -1971,7 +1947,7 @@ create table t1 as select concat(floor(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
@@ -1981,7 +1957,7 @@ create table t1 as select concat(round(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sign(0.5)));
@@ -1991,14 +1967,14 @@ create table t1 as select concat(sign(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(rand()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(23) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(length('a')));
@@ -2008,7 +1984,7 @@ create table t1 as select concat(length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(char_length('a')));
@@ -2018,7 +1994,7 @@ create table t1 as select concat(char_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_length('a')));
@@ -2028,7 +2004,7 @@ create table t1 as select concat(bit_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coercibility('a')));
@@ -2038,7 +2014,7 @@ create table t1 as select concat(coercibility('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(locate('a','a')));
@@ -2048,7 +2024,7 @@ create table t1 as select concat(locate('a','a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(11) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(11) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(field('c','a','b','c')));
@@ -2058,7 +2034,7 @@ create table t1 as select concat(field('c','a','b','c')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ascii(61)));
@@ -2068,7 +2044,7 @@ create table t1 as select concat(ascii(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ord(61)));
@@ -2078,7 +2054,7 @@ create table t1 as select concat(ord(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(find_in_set('b','a,b,c,d')));
@@ -2088,7 +2064,7 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select md5('a'), hex(md5('a'));
@@ -2098,7 +2074,7 @@ create table t1 as select md5('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(32) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(32) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select old_password('a'), hex(old_password('a'));
@@ -2108,7 +2084,7 @@ create table t1 as select old_password('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(16) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(16) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select password('a'), hex(password('a'));
@@ -2118,7 +2094,7 @@ create table t1 as select password('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(41) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(41) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha('a'), hex(sha('a'));
@@ -2128,7 +2104,7 @@ create table t1 as select sha('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(40) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(40) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha1('a'), hex(sha1('a'));
@@ -2138,7 +2114,7 @@ create table t1 as select sha1('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(40) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(40) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('-1' as signed)));
@@ -2148,7 +2124,7 @@ create table t1 as select concat(cast('-1' as signed)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('1' as unsigned)));
@@ -2158,7 +2134,7 @@ create table t1 as select concat(cast('1' as unsigned)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast(1/2 as decimal(5,5))));
@@ -2217,7 +2193,7 @@ create table t1 as select concat(least(1,2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(greatest(1,2)));
@@ -2227,7 +2203,7 @@ create table t1 as select concat(greatest(1,2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(case when 11 then 22 else 33 end));
@@ -2237,7 +2213,7 @@ create table t1 as select concat(case when 11 then 22 else 33 end) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coalesce(1,2)));
@@ -2247,7 +2223,7 @@ create table t1 as select concat(coalesce(1,2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat_ws(1,2,3));
@@ -2257,7 +2233,7 @@ create table t1 as select concat_ws(1,2,3) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(group_concat(1,2,3));
@@ -2267,7 +2243,7 @@ create table t1 as select group_concat(1,2,3) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(512) CHARACTER SET ucs2 DEFAULT NULL
+ `c1` mediumtext CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select 1 as c1 union select 'a';
@@ -2285,7 +2261,7 @@ create table t1 as select concat(last_insert_id()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(benchmark(0,0)));
@@ -2295,7 +2271,7 @@ create table t1 as select concat(benchmark(0,0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sleep(0)));
@@ -2305,7 +2281,7 @@ create table t1 as select concat(sleep(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx')));
@@ -2339,7 +2315,7 @@ create table t1 as select concat(crc32('')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(uncompressed_length('')));
@@ -2356,7 +2332,7 @@ create table t1 as select concat(connection_id()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(inet_aton('127.1.1.1')));
@@ -2392,7 +2368,7 @@ create table t1 as select concat(row_count()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(found_rows()));
@@ -2402,21 +2378,21 @@ create table t1 as select concat(found_rows()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(uuid_short()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(uuid()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(36) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(36) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select coercibility(uuid()), coercibility(cast('a' as char character set latin1));
@@ -2429,7 +2405,7 @@ create table t1 as select concat(uuid(), cast('a' as char character set latin1))
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(37) NOT NULL
+ `c1` varchar(37) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1;
@@ -2449,7 +2425,7 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL,
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL,
`c2` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -2507,7 +2483,7 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET ucs2 NOT NULL,
+ `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL,
`c2` decimal(2,1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -2523,7 +2499,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(83) CHARACTER SET ucs2 DEFAULT NULL,
- `c2` decimal(65,30) DEFAULT NULL
+ `c2` decimal(65,38) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(@@ft_max_word_len));
@@ -2546,7 +2522,7 @@ create table t1 as select concat('a'='a' IS TRUE) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a'='a' IS NOT TRUE));
@@ -2556,7 +2532,7 @@ create table t1 as select concat('a'='a' IS NOT TRUE) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(NOT 'a'='a'));
@@ -2566,7 +2542,7 @@ create table t1 as select concat(NOT 'a'='a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NULL));
@@ -2576,7 +2552,7 @@ create table t1 as select concat('a' IS NULL) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NOT NULL));
@@ -2586,7 +2562,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' rlike 'a'));
@@ -2596,7 +2572,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(strcmp('a','b')));
@@ -2606,7 +2582,7 @@ create table t1 as select concat(strcmp('a','b')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' like 'a'));
@@ -2616,7 +2592,7 @@ create table t1 as select concat('a' like 'b') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' between 'b' and 'c'));
@@ -2626,7 +2602,7 @@ create table t1 as select concat('a' between 'b' and 'c') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' in ('a','b')));
@@ -2636,7 +2612,7 @@ create table t1 as select concat('a' in ('a','b')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(interval(23, 1, 15, 17, 30, 44, 200)));
@@ -2646,7 +2622,7 @@ create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a varchar(10), fulltext key(a));
@@ -2678,7 +2654,7 @@ create table t1 as select concat(ifnull(1,1)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ifnull(1.1,1.1)));
@@ -2688,7 +2664,7 @@ create table t1 as select concat(ifnull(1.1,1.1)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(if(1,'b',1));
@@ -2718,7 +2694,7 @@ create table t1 as select concat(if(1,1,1)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(nullif(1,2)));
@@ -2873,7 +2849,7 @@ create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` longtext CHARACTER SET ucs2
+ `c1` longtext CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(period_add(200902, 2)));
@@ -2883,12 +2859,13 @@ create table t1 as select concat(period_add(200902, 2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(6) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(6) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(period_diff(200902, 200802)));
hex(concat(period_diff(200902, 200802)))
00310032
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t1 as select concat(period_add(200902, 200802)) as c1;
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
@@ -3092,21 +3069,21 @@ create table t1 as select concat(curdate()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(utc_date()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(curtime()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select repeat('a',20) as c1 limit 0;
@@ -3122,7 +3099,7 @@ create table t1 as select concat(utc_time()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sec_to_time(2378)));
@@ -3215,21 +3192,21 @@ create table t1 as select concat(now()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(19) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(utc_timestamp()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(19) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(sysdate()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(19) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(addtime('00:00:00','11:22:33')));
@@ -3269,7 +3246,7 @@ create table t1 as select export_set(1,2,3,4,2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(127) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(127) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(insert(1133,3,0,22));
@@ -3279,7 +3256,7 @@ create table t1 as select insert(1133,3,0,22) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(6) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(6) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lcase(123));
@@ -3289,7 +3266,7 @@ create table t1 as select lcase(123) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(123,1));
@@ -3299,7 +3276,7 @@ create table t1 as select left(123,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lower(123));
@@ -3309,7 +3286,7 @@ create table t1 as select lower(123) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lpad(1,2,0));
@@ -3319,7 +3296,7 @@ create table t1 as select lpad(1,2,0) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ltrim(1));
@@ -3329,7 +3306,7 @@ create table t1 as select ltrim(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(mid(1,1,1));
@@ -3339,7 +3316,7 @@ create table t1 as select mid(1,1,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(repeat(1,2));
@@ -3349,7 +3326,7 @@ create table t1 as select repeat(1,2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(replace(1,1,2));
@@ -3359,7 +3336,7 @@ create table t1 as select replace(1,1,2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(reverse(12));
@@ -3369,7 +3346,7 @@ create table t1 as select reverse(12) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(right(123,1));
@@ -3379,7 +3356,7 @@ create table t1 as select right(123,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rpad(1,2,0));
@@ -3389,7 +3366,7 @@ create table t1 as select rpad(1,2,0) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rtrim(1));
@@ -3399,7 +3376,7 @@ create table t1 as select rtrim(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(soundex(1));
@@ -3409,7 +3386,7 @@ create table t1 as select soundex(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(substring(1,1,1));
@@ -3419,7 +3396,7 @@ create table t1 as select substring(1,1,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(trim(1));
@@ -3429,7 +3406,7 @@ create table t1 as select trim(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ucase(1));
@@ -3439,7 +3416,7 @@ create table t1 as select ucase(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(upper(1));
@@ -3449,14 +3426,14 @@ create table t1 as select upper(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select repeat(' ', 64) as a limit 0;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(64) CHARACTER SET ucs2 NOT NULL
+ `a` varchar(64) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ("1.1"), ("2.1");
select a, hex(a) from t1;
@@ -3706,7 +3683,7 @@ create table t2 as select concat(a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `concat(a)` varchar(19) CHARACTER SET ucs2 NOT NULL
+ `concat(a)` varchar(19) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a date);
@@ -4005,7 +3982,7 @@ insert into t1 values ('2001-02-03 04:05:06');
create view v1(a) as select concat(a) from t1;
show columns from v1;
Field Type Null Key Default Extra
-a varchar(19) NO
+a varchar(19) YES NULL
select hex(a) from v1;
hex(a)
0030003000300030002D00300030002D00300030002000300030003A00300030003A00300030
@@ -4230,7 +4207,7 @@ GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END)
1234567
SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(a,'') 253 9 7 Y 0 31 8
+def COALESCE(a,'') 253 9 7 Y 0 39 8
COALESCE(a,'')
1234567
# All columns must be VARCHAR(9) with the same length:
@@ -4256,14 +4233,14 @@ CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET ucs2 NOT NULL
+ `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET ucs2 NOT NULL
+ `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
@@ -4284,35 +4261,35 @@ CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `REPEAT(1,2)` varchar(2) CHARACTER SET ucs2 NOT NULL
+ `REPEAT(1,2)` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `LEFT(123,2)` varchar(2) CHARACTER SET ucs2 NOT NULL
+ `LEFT(123,2)` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `RIGHT(123,2)` varchar(2) CHARACTER SET ucs2 NOT NULL
+ `RIGHT(123,2)` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `LTRIM(123)` varchar(3) CHARACTER SET ucs2 NOT NULL
+ `LTRIM(123)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `RTRIM(123)` varchar(3) CHARACTER SET ucs2 NOT NULL
+ `RTRIM(123)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
@@ -4326,35 +4303,35 @@ CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `REPLACE(111,2,3)` varchar(3) CHARACTER SET ucs2 NOT NULL
+ `REPLACE(111,2,3)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET ucs2 NOT NULL
+ `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET ucs2 NOT NULL
+ `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `SOUNDEX(1)` varchar(4) CHARACTER SET ucs2 NOT NULL
+ `SOUNDEX(1)` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8);
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET ucs2 NOT NULL
+ `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
@@ -4478,11 +4455,11 @@ NULL
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
-Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
+Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()`
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select concat(convert(v_LastPaymentDate@0 using ucs2),convert(now() using ucs2)) AS `CONCAT(v_LastPaymentDate, NOW())`
+Note 1003 select concat(convert(v_LastPaymentDate@0 using ucs2),convert(current_timestamp() using ucs2)) AS `CONCAT(v_LastPaymentDate, NOW())`
DROP PROCEDURE p1;
#
# Bug#52159 returning time type from function and empty left join causes debug assertion
@@ -4534,6 +4511,7 @@ SET NAMES latin1;
#
# Bug #13832953 MY_STRNXFRM_UNICODE: ASSERTION `SRC' FAILED
#
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t1 (c1 SET('','') CHARACTER SET ucs2);
Warnings:
Note 1291 Column 'c1' has duplicated value '' in SET
@@ -4596,6 +4574,7 @@ Warning 1292 Truncated incorrect time value: '77760000'
#
# MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535
#
+set sql_mode="";
CREATE TABLE t1 (c1 VARCHAR(32766) CHARACTER SET ucs2);
DESCRIBE t1;
Field Type Null Key Default Extra
@@ -4615,6 +4594,7 @@ DESCRIBE t1;
Field Type Null Key Default Extra
c1 mediumtext YES NULL
DROP TABLE t1;
+set sql_mode=default;
#
# MDEV-15624 Changing the default character set to utf8mb4 changes query evaluation in a very surprising way
#
@@ -4683,7 +4663,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET ucs2 NOT NULL
+ `a` varchar(5) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -4927,7 +4907,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL
+ `a` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -5236,7 +5216,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 64) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(64) CHARACTER SET ucs2 NOT NULL
+ `a` varchar(64) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('');
SELECT CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1;
@@ -5379,7 +5359,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_german2_ci NOT NULL,
+ `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_german2_ci DEFAULT NULL,
`b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
@@ -5422,7 +5402,7 @@ SET sql_mode='strict_all_tables';
INSERT INTO t1 VALUES (CONVERT('9e99999999' USING ucs2));
ERROR 22003: Out of range value for column 'a' at row 1
SET sql_mode=DEFAULT;
-INSERT INTO t1 VALUES (CONVERT('aaa' USING ucs2));
+INSERT IGNORE INTO t1 VALUES (CONVERT('aaa' USING ucs2));
Warnings:
Warning 1366 Incorrect decimal value: 'aaa' for column 'a' at row 1
DROP TABLE t1;
@@ -5440,7 +5420,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -5457,13 +5437,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a '))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a '
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -5480,13 +5460,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -5503,13 +5483,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -5526,7 +5506,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
#
# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
@@ -5535,7 +5515,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL
+ `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
@@ -5548,7 +5528,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a '))))
+Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a '
DROP TABLE t1;
#
# End of MDEV-8694
@@ -5561,7 +5541,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -5578,13 +5558,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a '))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a '
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -5601,13 +5581,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -5624,13 +5604,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 NOT NULL
+ `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -5647,7 +5627,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
#
# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
@@ -5656,7 +5636,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET ucs2 NOT NULL
+ `a` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
@@ -5669,7 +5649,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a '))))
+Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a '
DROP TABLE t1;
#
# End of MDEV-8694
@@ -5734,7 +5714,7 @@ SELECT * FROM t1 WHERE COALESCE(c,0)='3 ' AND COALESCE(d,0)=COALESCE(c,0);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where ((coalesce(`test`.`t1`.`c`,0) = '3 ') and (coalesce(`test`.`t1`.`d`,0) = '3 '))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where coalesce(`test`.`t1`.`c`,0) = '3 ' and coalesce(`test`.`t1`.`d`,0) = '3 '
DROP TABLE t1;
#
# MDEV-9178 Wrong result for CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED)
@@ -5748,3 +5728,630 @@ Warning 1292 Truncated incorrect INTEGER value: '1IJ3'
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET character_set_connection=ucs2;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE ucs2_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+00610062006300200020 abc
+006100620063 abc
+0061002000200020 a
+002000610020 a
+00200061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ucs2_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+00610020 a
+0061002000200020 a
+006100620063 abc
+0061006200630020 abc
+00610062006300200020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+0061 a
+006100200020 a
+0061002000200020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+0061002000200020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ucs2_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+00610061 1
+0061006100200020 1
+00610062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0041000000000000000000000000000000000000
+0041002000200000000000000000000000000000
+0020004100000000000000000000000000000000
+0020004100200000000000000000000000000000
+0041002000200020000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc '))
+0061006200630020
+SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc '))
+00610062006300200020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ucs2_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE ucs2_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+00610062006300200020 abc
+006100620063 abc
+0061002000200020 a
+002000610020 a
+00200061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ucs2_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+00610020 a
+0061002000200020 a
+006100620063 abc
+0061006200630020 abc
+00610062006300200020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+0061 a
+006100200020 a
+0061002000200020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+0061002000200020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ucs2_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+00610061 1
+0061006100200020 1
+00610062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0041000000000000000000000000000000000000
+0041002000200000000000000000000000000000
+0020004100000000000000000000000000000000
+0020004100200000000000000000000000000000
+0041002000200020000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc '))
+0061006200630020
+SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc '))
+00610062006300200020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ucs2_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE ucs2_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+00610062006300200020 abc
+006100620063 abc
+0061002000200020 a
+002000610020 a
+00200061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ucs2_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+00610020 a
+0061002000200020 a
+006100620063 abc
+0061006200630020 abc
+00610062006300200020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+0061 a
+006100200020 a
+0061002000200020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+0061002000200020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ucs2_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+00610061 1
+0061006100200020 1
+00610062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0061000000000000000000000000000000000000
+0061002000200000000000000000000000000000
+0020006100000000000000000000000000000000
+0020006100200000000000000000000000000000
+0061002000200020000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc '))
+0061006200630020
+SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc '))
+00610062006300200020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ucs2_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE ucs2_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+00610062006300200020 abc
+006100620063 abc
+0061002000200020 a
+002000610020 a
+00200061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ucs2_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+00610020 a
+0061002000200020 a
+006100620063 abc
+0061006200630020 abc
+00610062006300200020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+0061 a
+006100200020 a
+0061002000200020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+0061002000200020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ucs2_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+00610061 1
+0061006100200020 1
+00610062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0061000000000000000000000000000000000000
+0061002000200000000000000000000000000000
+0020006100000000000000000000000000000000
+0020006100200000000000000000000000000000
+0061002000200020000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc '))
+0061006200630020
+SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc '))
+00610062006300200020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ucs2_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+#
+# MDEV-10585 EXECUTE IMMEDIATE statement
+#
+SET character_set_connection=ucs2;
+EXECUTE IMMEDIATE 'SELECT COLLATION("a")';
+COLLATION("a")
+ucs2_general_ci
+SET @stmt='SELECT COLLATION("a")';
+EXECUTE IMMEDIATE @stmt;
+COLLATION("a")
+ucs2_general_ci
+#
+# MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions
+#
+SET NAMES utf8, collation_connection=ucs2_bin;
+SET @stmt='SELECT COLLATION(''a'')';
+EXECUTE IMMEDIATE @stmt;
+COLLATION('a')
+ucs2_bin
+SET NAMES utf8, character_set_connection=ucs2;
+SET @stmt='SELECT COLLATION(''a'')';
+EXECUTE IMMEDIATE @stmt;
+COLLATION('a')
+ucs2_general_ci
+EXECUTE IMMEDIATE CONCAT('SELECT ''a'' FROM DUAL');
+a
+a
+SELECT HEX('aä') FROM DUAL;
+HEX('aä')
+006100E4
+EXECUTE IMMEDIATE 'SELECT HEX(''aä'') FROM DUAL';
+HEX('aä')
+006100E4
+EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM DUAL');
+HEX('aä')
+006100E4
+EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM ', 'DUAL');
+HEX('aä')
+006100E4
+PREPARE stmt FROM 'SELECT HEX(''aä'') FROM DUAL';
+EXECUTE stmt;
+HEX('aä')
+006100E4
+DEALLOCATE PREPARE stmt;
+SET @table='DUAL';
+SELECT HEX(@table);
+HEX(@table)
+004400550041004C
+EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM ', @table);
+HEX('aä')
+006100E4
+EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM ', CONVERT(@table USING utf8));
+HEX('aä')
+006100E4
+SET @stmt='SELECT HEX(''aä'') FROM DUAL';
+EXECUTE IMMEDIATE @stmt;
+HEX('aä')
+006100E4
+PREPARE stmt FROM @stmt;
+EXECUTE stmt;
+HEX('aä')
+006100E4
+DEALLOCATE PREPARE stmt;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_ucs2_uca.result b/mysql-test/r/ctype_ucs2_uca.result
new file mode 100644
index 00000000000..44a623842c6
--- /dev/null
+++ b/mysql-test/r/ctype_ucs2_uca.result
@@ -0,0 +1,590 @@
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-10877 xxx_unicode_nopad_ci collations
+#
+SET NAMES utf8, character_set_connection=ucs2;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_unicode_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE ucs2_unicode_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_unicode_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+00610062006300200020 abc
+006100620063 abc
+0061002000200020 a
+002000610020 a
+00200061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ucs2_unicode_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+00610020 a
+0061002000200020 a
+006100620063 abc
+0061006200630020 abc
+00610062006300200020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_unicode_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+0061 a
+006100200020 a
+0061002000200020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+0061002000200020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ucs2_unicode_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+00610061 1
+0061006100200020 1
+00610062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0E33020002000200020002000200020002000200
+0E33020902090200020002000200020002000200
+02090E3302000200020002000200020002000200
+02090E3302090200020002000200020002000200
+0E33020902090209020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'ucs2_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'ucs2_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc '))
+0061006200630020
+SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc '))
+00610062006300200020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_unicode_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_unicode_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ucs2_unicode_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_unicode_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_unicode_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE ucs2_unicode_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_unicode_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+00610062006300200020 abc
+006100620063 abc
+0061002000200020 a
+002000610020 a
+00200061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ucs2_unicode_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+00610020 a
+0061002000200020 a
+006100620063 abc
+0061006200630020 abc
+00610062006300200020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_unicode_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+0061 a
+006100200020 a
+0061002000200020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+0061002000200020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ucs2_unicode_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+00610061 1
+0061006100200020 1
+00610062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0E33020002000200020002000200020002000200
+0E33020902090200020002000200020002000200
+02090E3302000200020002000200020002000200
+02090E3302090200020002000200020002000200
+0E33020902090209020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'ucs2_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'ucs2_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'ucs2_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc '))
+0061006200630020
+SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_nopad_ci', 'abc '))
+00610062006300200020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_unicode_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_unicode_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ucs2_unicode_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_unicode_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_unicode_520_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE ucs2_unicode_520_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_unicode_520_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+00610062006300200020 abc
+006100620063 abc
+0061002000200020 a
+002000610020 a
+00200061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ucs2_unicode_520_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+00610020 a
+0061002000200020 a
+006100620063 abc
+0061006200630020 abc
+00610062006300200020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_unicode_520_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+0061 a
+006100200020 a
+0061002000200020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+0061002000200020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ucs2_unicode_520_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+00610061 1
+0061006100200020 1
+00610062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+120F020002000200020002000200020002000200
+120F020A020A0200020002000200020002000200
+020A120F02000200020002000200020002000200
+020A120F020A0200020002000200020002000200
+120F020A020A020A020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc '))
+0061006200630020
+SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc '))
+00610062006300200020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_unicode_520_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_unicode_520_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ucs2_unicode_520_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_unicode_520_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_unicode_520_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE ucs2_unicode_520_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_unicode_520_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+00610062006300200020 abc
+006100620063 abc
+0061002000200020 a
+002000610020 a
+00200061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ucs2_unicode_520_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+00610020 a
+0061002000200020 a
+006100620063 abc
+0061006200630020 abc
+00610062006300200020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_unicode_520_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+0061 a
+006100200020 a
+0061002000200020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+0061002000200020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ucs2_unicode_520_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+00610061 1
+0061006100200020 1
+00610062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+120F020002000200020002000200020002000200
+120F020A020A0200020002000200020002000200
+020A120F02000200020002000200020002000200
+020A120F020A0200020002000200020002000200
+120F020A020A020A020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'ucs2_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc '))
+0061006200630020
+SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'ucs2_unicode_520_nopad_ci', 'abc '))
+00610062006300200020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_unicode_520_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_unicode_520_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ucs2_unicode_520_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_unicode_520_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET NAMES utf8, collation_connection=ucs2_unicode_520_nopad_ci;
+#
+# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
+#
+CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
+ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(50) CHARACTER SET ucs2 COLLATE ucs2_unicode_520_nopad_ci DEFAULT NULL,
+ `b` varchar(50) CHARACTER SET ucs2 COLLATE ucs2_unicode_520_nopad_ci DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('111', '111');
+INSERT INTO t1 VALUES ('222', '222');
+INSERT INTO t1 VALUES ('333', '333');
+INSERT INTO t1 VALUES ('444', '444');
+SELECT * FROM t1 WHERE a LIKE '111%';
+a b
+111 111
+SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
+a b
+111 111
+DROP TABLE t1;
+SET NAMES utf8;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result
index 61541ec7678..cb9de83fedc 100644
--- a/mysql-test/r/ctype_ujis.result
+++ b/mysql-test/r/ctype_ujis.result
@@ -2331,30 +2331,18 @@ CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
hex(concat(repeat(0xF1F2, 10), '%'))
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
a hex(b) c
-2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
+2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
SET collation_connection='ujis_bin';
create table t1 select repeat('a',4000) a;
@@ -2478,30 +2466,18 @@ CREATE TABLE t1 AS
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
-Warnings:
-Warning 1364 Field 'c' doesn't have a default value
-Warning 1364 Field 'd' doesn't have a default value
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
hex(concat(repeat(0xF1F2, 10), '%'))
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
a hex(b) c
-2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
-4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
+2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
+4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
select hex(convert(_ujis 0xA5FE41 using ucs2));
hex(convert(_ujis 0xA5FE41 using ucs2))
@@ -2569,18 +2545,18 @@ CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1
CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT 'XXXXXX' AS code, ' ' AS a LIMIT 0;
-INSERT INTO t1 (code) SELECT concat('8E', head) FROM head
+INSERT IGNORE INTO t1 (code) SELECT concat('8E', head) FROM head
WHERE (head BETWEEN 'A1' AND 'DF') ORDER BY head;
Warnings:
Warning 1364 Field 'a' doesn't have a default value
-INSERT INTO t1 (code) SELECT concat(head, tail)
+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;
Warnings:
Warning 1364 Field 'a' doesn't have a default value
-INSERT INTO t1 (code) SELECT concat('8F', head, tail)
+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;
@@ -2593,7 +2569,7 @@ t1 CREATE TABLE `t1` (
`code` varchar(6) CHARACTER SET ujis NOT NULL,
`a` varchar(1) CHARACTER SET ujis NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-UPDATE t1 SET a=unhex(code) ORDER BY code;
+UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
Warnings:
Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1
Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2
@@ -25318,7 +25294,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET ujis NOT NULL
+ `a` varchar(5) CHARACTER SET ujis DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -25751,7 +25727,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET ujis COLLATE ujis_bin NOT NULL
+ `a` varchar(5) CHARACTER SET ujis COLLATE ujis_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -26166,7 +26142,7 @@ hex(weight_string(cast(0x8FA2C38FA2C38FA2C3 as char),25, 4, 0xC0))
# MDEV-6776 ujis and eucjmps erroneously accept 0x8EA0 as a valid byte sequence
#
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ujis);
-INSERT INTO t1 VALUES (0x8EA0);
+INSERT IGNORE INTO t1 VALUES (0x8EA0);
SELECT HEX(a), CHAR_LENGTH(a) FROM t1;
HEX(a) CHAR_LENGTH(a)
3F3F 2
@@ -26218,3 +26194,582 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
+#
+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;
+HEX(a)
+3F
+78787831
+3F3F
+78787832
+8FA1A1
+78787833
+3F3F
+DROP TABLE t1;
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET character_set_connection=ujis;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ujis_japanese_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE ujis_japanese_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_japanese_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ujis_japanese_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ujis_japanese_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ujis_japanese_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'ujis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'ujis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ujis_japanese_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_japanese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_japanese_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ujis_japanese_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_japanese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_japanese_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ujis_japanese_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE ujis_japanese_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_japanese_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ujis_japanese_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ujis_japanese_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ujis_japanese_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+41000000000000000000
+41202000000000000000
+20410000000000000000
+20412000000000000000
+41202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'ujis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'ujis_japanese_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'ujis_japanese_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'ujis_japanese_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ujis_japanese_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_japanese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_japanese_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ujis_japanese_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_japanese_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_japanese_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ujis_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE ujis_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=ujis COLLATE=ujis_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ujis_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ujis_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ujis_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'ujis_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'ujis_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'ujis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'ujis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'ujis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'ujis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'ujis_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'ujis_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'ujis_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'ujis_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ujis_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ujis_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ujis_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE ujis_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=ujis COLLATE=ujis_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ujis_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ujis_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ujis_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+61000000000000000000
+61202000000000000000
+20610000000000000000
+20612000000000000000
+61202020000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'ujis_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'ujis_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'ujis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'ujis_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'ujis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'ujis_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'ujis_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'ujis_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'ujis_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'ujis_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ujis_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ujis_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ujis_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_ujis_ucs2.result b/mysql-test/r/ctype_ujis_ucs2.result
index 3c63e7c0441..77961046346 100644
--- a/mysql-test/r/ctype_ujis_ucs2.result
+++ b/mysql-test/r/ctype_ujis_ucs2.result
@@ -1138,7 +1138,7 @@ update t1 set name='U+9FA3 <CJK>' where ujis=0x8FEDE2;
update t1 set name='U+9FA5 <CJK>' where ujis=0x8FEDE3;
update t1 set name='User defined range #2' where ujis >= 0x8FF5A1 and ujis <= 0x8FFEFE;
update t1 set name='UNASSIGNED' where name='';
-update t1 set ucs2=ujis, ujis2=ucs2;
+update ignore t1 set ucs2=ujis, ujis2=ucs2;
Warnings:
Warning 1366 Incorrect string value: '\xA2\xAF' for column 'ucs2' at row 237
Warning 1366 Incorrect string value: '\xA2\xB0' for column 'ucs2' at row 238
@@ -19129,7 +19129,7 @@ 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 t1 set ujis=ucs2;
+update ignore t1 set ujis=ucs2;
Warnings:
Warning 1366 Incorrect string value: '\x00\xA5' for column 'ujis' at row 1
Warning 1366 Incorrect string value: '\x20\x14' for column 'ujis' at row 2
diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result
index c8ba1fedab8..8de21a14bd9 100644
--- a/mysql-test/r/ctype_utf16.result
+++ b/mysql-test/r/ctype_utf16.result
@@ -101,8 +101,8 @@ RPAD(_utf16 X'0420',10,_utf16 X'0421') r;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `l` varchar(10) CHARACTER SET utf16 NOT NULL,
- `r` varchar(10) CHARACTER SET utf16 NOT NULL
+ `l` varchar(10) CHARACTER SET utf16 DEFAULT NULL,
+ `r` varchar(10) CHARACTER SET utf16 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(l), hex(r) from t1;
hex(l) hex(r)
@@ -755,7 +755,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL
+ `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84);
INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080);
@@ -1012,6 +1012,7 @@ DBFFDCFF
drop table t1;
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;
Warnings:
Warning 1366 Incorrect string value: '\xDF\x84' for column 's1' at row 1
@@ -1021,7 +1022,7 @@ hex(s1)
drop table t1;
create table t1 (s1 varchar(5) character set ucs2, s2 varchar(5) character set utf16);
insert into t1 (s1) values (0xdf84);
-update t1 set s2 = s1;
+update ignore t1 set s2 = s1;
Warnings:
Warning 1366 Incorrect string value: '\xDF\x84' for column 's2' at row 1
select hex(s2) from t1;
@@ -1250,7 +1251,7 @@ Warnings:
Warning 1292 Truncated incorrect INTEGER value: '123456789123456789123x'
create table t1 (a int);
insert into t1 values ('-1234.1e2');
-insert into t1 values ('-1234.1e2xxxx');
+insert ignore into t1 values ('-1234.1e2xxxx');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
insert into t1 values ('-1234.1e2 ');
@@ -1266,7 +1267,7 @@ create table t1 (a int);
insert into t1 values ('1 ');
Warnings:
Note 1265 Data truncated for column 'a' at row 1
-insert into t1 values ('1 x');
+insert ignore into t1 values ('1 x');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
@@ -1274,13 +1275,14 @@ a
1
1
drop table t1;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t1 (a varchar(17000) character set utf16);
Warnings:
Note 1246 Converting column 'a' from VARCHAR to TEXT
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` mediumtext CHARACTER SET utf16
+ `a` mediumtext CHARACTER SET utf16 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a varchar(250) character set utf16 primary key);
@@ -1419,7 +1421,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 64) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(64) CHARACTER SET utf16 NOT NULL
+ `a` varchar(64) CHARACTER SET utf16 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('');
SELECT CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1;
@@ -1468,7 +1470,7 @@ CREATE TABLE t1 AS SELECT repeat('a',2) as s1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `s1` varchar(2) CHARACTER SET utf16 NOT NULL
+ `s1` varchar(2) CHARACTER SET utf16 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
SELECT * FROM t1 ORDER BY s1;
@@ -1553,11 +1555,12 @@ SELECT space(date_add(101, INTERVAL CHAR('1' USING utf16) hour_second));
space(date_add(101, INTERVAL CHAR('1' USING utf16) hour_second))
NULL
Warnings:
-Warning 1301 Result of space() was larger than max_allowed_packet (4194304) - truncated
+Warning 1301 Result of space() was larger than max_allowed_packet (16777216) - truncated
#
# Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
#
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
@@ -1568,6 +1571,7 @@ id l
a 512
Warnings:
Warning 1260 Row 1 was cut by GROUP_CONCAT()
+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
@@ -1630,7 +1634,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET utf16 NOT NULL
+ `a` varchar(5) CHARACTER SET utf16 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1880,7 +1884,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL
+ `a` varchar(5) CHARACTER SET utf16 COLLATE utf16_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -2211,3 +2215,567 @@ Warning 1292 Truncated incorrect INTEGER value: '1IJ3'
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET character_set_connection=utf16;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf16_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf16 COLLATE=utf16_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+00610062006300200020 abc
+006100620063 abc
+0061002000200020 a
+002000610020 a
+00200061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+00610020 a
+0061002000200020 a
+006100620063 abc
+0061006200630020 abc
+00610062006300200020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+0061 a
+006100200020 a
+0061002000200020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+0061002000200020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+00610061 1
+0061006100200020 1
+00610062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0041000000000000000000000000000000000000
+0041002000200000000000000000000000000000
+0020004100000000000000000000000000000000
+0020004100200000000000000000000000000000
+0041002000200020000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf16_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf16_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf16_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf16_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf16_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf16_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc '))
+0061006200630020
+SELECT HEX(GREATEST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc '))
+00610062006300200020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf16_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf16 COLLATE=utf16_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+00610062006300200020 abc
+006100620063 abc
+0061002000200020 a
+002000610020 a
+00200061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+00610020 a
+0061002000200020 a
+006100620063 abc
+0061006200630020 abc
+00610062006300200020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+0061 a
+006100200020 a
+0061002000200020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+0061002000200020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+00610061 1
+0061006100200020 1
+00610062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0041000000000000000000000000000000000000
+0041002000200000000000000000000000000000
+0020004100000000000000000000000000000000
+0020004100200000000000000000000000000000
+0041002000200020000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf16_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf16_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf16_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf16_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf16_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf16_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc '))
+0061006200630020
+SELECT HEX(GREATEST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf16_general_nopad_ci', 'abc '))
+00610062006300200020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf16_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf16 COLLATE=utf16_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+00610062006300200020 abc
+006100620063 abc
+0061002000200020 a
+002000610020 a
+00200061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+00610020 a
+0061002000200020 a
+006100620063 abc
+0061006200630020 abc
+00610062006300200020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+0061 a
+006100200020 a
+0061002000200020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+0061002000200020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+00610061 1
+0061006100200020 1
+00610062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+000061000000000000000000000000000000000000000000000000000000
+000061000020000020000000000000000000000000000000000000000000
+000020000061000000000000000000000000000000000000000000000000
+000020000061000020000000000000000000000000000000000000000000
+000061000020000020000020000000000000000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf16_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf16_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf16_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf16_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf16_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf16_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf16_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf16_nopad_bin', 'abc '))
+0061006200630020
+SELECT HEX(GREATEST('abc ' COLLATE 'utf16_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf16_nopad_bin', 'abc '))
+00610062006300200020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf16_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf16 COLLATE=utf16_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+00610062006300200020 abc
+006100620063 abc
+0061002000200020 a
+002000610020 a
+00200061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+00610020 a
+0061002000200020 a
+006100620063 abc
+0061006200630020 abc
+00610062006300200020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+0061 a
+006100200020 a
+0061002000200020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+0061002000200020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+00610061 1
+0061006100200020 1
+00610062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+000061000000000000000000000000000000000000000000000000000000
+000061000020000020000000000000000000000000000000000000000000
+000020000061000000000000000000000000000000000000000000000000
+000020000061000020000000000000000000000000000000000000000000
+000061000020000020000020000000000000000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf16_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf16_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf16_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf16_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf16_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf16_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf16_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf16_nopad_bin', 'abc '))
+0061006200630020
+SELECT HEX(GREATEST('abc ' COLLATE 'utf16_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf16_nopad_bin', 'abc '))
+00610062006300200020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_utf16_uca.result b/mysql-test/r/ctype_utf16_uca.result
index 1e4c77ea83d..0cb9c4c74c1 100644
--- a/mysql-test/r/ctype_utf16_uca.result
+++ b/mysql-test/r/ctype_utf16_uca.result
@@ -2810,7 +2810,7 @@ want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
-insert into t1 values (),();
+insert ignore into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
@@ -3045,7 +3045,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL,
+ `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_unicode_ci DEFAULT NULL,
`b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
@@ -3228,7 +3228,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL
+ `a` varchar(5) CHARACTER SET utf16 COLLATE utf16_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -3695,7 +3695,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_german2_ci NOT NULL,
+ `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_german2_ci DEFAULT NULL,
`b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
@@ -3726,7 +3726,7 @@ CREATE TABLE t1 AS SELECT repeat('a', 10) as c LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c` varchar(10) CHARACTER SET utf16 COLLATE utf16_unicode_520_ci NOT NULL
+ `c` varchar(10) CHARACTER SET utf16 COLLATE utf16_unicode_520_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_utf32 0x0180),(_utf32 0x023A);
INSERT INTO t1 VALUES (_utf32 0x023B),(_utf32 0x023C);
@@ -3999,7 +3999,7 @@ D801DC28 30D2 ð¨
ALTER TABLE t1 ADD KEY(c);
EXPLAIN SELECT hex(c) FROM t1 WHERE c LIKE 'a%' ORDER BY c;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 42 NULL 2 Using where; Using index
+1 SIMPLE t1 range c c 43 NULL 2 Using where; Using index
SELECT hex(c), hex(weight_string(c)) FROM t1 WHERE c LIKE 'a%' ORDER BY c;
hex(c) hex(weight_string(c))
0061 120F
@@ -4042,7 +4042,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `s1` varchar(64) CHARACTER SET utf16 COLLATE utf16_myanmar_ci NOT NULL,
+ `s1` varchar(64) CHARACTER SET utf16 COLLATE utf16_myanmar_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 (s1) VALUES
@@ -6628,7 +6628,7 @@ CREATE TABLE t1 AS SELECT SPACE(3) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(3) CHARACTER SET utf16 COLLATE utf16_thai_520_w2 NOT NULL
+ `a` varchar(3) CHARACTER SET utf16 COLLATE utf16_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (SPACE(0)),(SPACE(1)),(SPACE(2));
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(8))) FROM t1;
@@ -6661,7 +6661,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET utf16 COLLATE utf16_thai_520_w2 NOT NULL
+ `a` varchar(10) CHARACTER SET utf16 COLLATE utf16_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_ucs2 0x3400);
INSERT INTO t1 VALUES (_ucs2 0xF001);
@@ -6674,7 +6674,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET utf16 COLLATE utf16_thai_520_w2 NOT NULL
+ `a` varchar(10) CHARACTER SET utf16 COLLATE utf16_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('A'),('À'),('Ã'),('Â'),('Ã'),('Ä'),('Ã…');
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a;
@@ -6733,7 +6733,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET utf16 COLLATE utf16_thai_520_w2 NOT NULL
+ `a` varchar(10) CHARACTER SET utf16 COLLATE utf16_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('cota'),('cote'),('cotz');
INSERT INTO t1 VALUES ('coté'),('côte'),('côté'),('cotë'),('côtë');
@@ -7305,3 +7305,593 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-10877 xxx_unicode_nopad_ci collations
+#
+SET NAMES utf8, character_set_connection=utf16;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_unicode_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf16_unicode_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf16 COLLATE=utf16_unicode_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+00610062006300200020 abc
+006100620063 abc
+0061002000200020 a
+002000610020 a
+00200061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16_unicode_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+00610020 a
+0061002000200020 a
+006100620063 abc
+0061006200630020 abc
+00610062006300200020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_unicode_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+0061 a
+006100200020 a
+0061002000200020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+0061002000200020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16_unicode_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+00610061 1
+0061006100200020 1
+00610062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0E33020002000200020002000200020002000200
+0E33020902090200020002000200020002000200
+02090E3302000200020002000200020002000200
+02090E3302090200020002000200020002000200
+0E33020902090209020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf16_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf16_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc '))
+0061006200630020
+SELECT HEX(GREATEST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc '))
+00610062006300200020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_unicode_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_unicode_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16_unicode_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_unicode_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_unicode_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf16_unicode_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf16 COLLATE=utf16_unicode_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+00610062006300200020 abc
+006100620063 abc
+0061002000200020 a
+002000610020 a
+00200061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16_unicode_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+00610020 a
+0061002000200020 a
+006100620063 abc
+0061006200630020 abc
+00610062006300200020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_unicode_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+0061 a
+006100200020 a
+0061002000200020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+0061002000200020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16_unicode_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+00610061 1
+0061006100200020 1
+00610062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0E33020002000200020002000200020002000200
+0E33020902090200020002000200020002000200
+02090E3302000200020002000200020002000200
+02090E3302090200020002000200020002000200
+0E33020902090209020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf16_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf16_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf16_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc '))
+0061006200630020
+SELECT HEX(GREATEST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf16_unicode_nopad_ci', 'abc '))
+00610062006300200020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_unicode_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_unicode_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16_unicode_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_unicode_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_unicode_520_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf16_unicode_520_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf16 COLLATE=utf16_unicode_520_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+00610062006300200020 abc
+006100620063 abc
+0061002000200020 a
+002000610020 a
+00200061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16_unicode_520_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+00610020 a
+0061002000200020 a
+006100620063 abc
+0061006200630020 abc
+00610062006300200020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_unicode_520_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+0061 a
+006100200020 a
+0061002000200020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+0061002000200020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16_unicode_520_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+00610061 1
+0061006100200020 1
+00610062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+120F020002000200020002000200020002000200
+120F020A020A0200020002000200020002000200
+020A120F02000200020002000200020002000200
+020A120F020A0200020002000200020002000200
+120F020A020A020A020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf16_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf16_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc '))
+0061006200630020
+SELECT HEX(GREATEST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc '))
+00610062006300200020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_unicode_520_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_unicode_520_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16_unicode_520_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_unicode_520_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16_unicode_520_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf16_unicode_520_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf16 COLLATE=utf16_unicode_520_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+00200061 a
+002000610020 a
+0061002000200020 a
+006100620063 abc
+00610062006300200020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+00610062006300200020 abc
+006100620063 abc
+0061002000200020 a
+002000610020 a
+00200061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16_unicode_520_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+00610020 a
+0061002000200020 a
+006100620063 abc
+0061006200630020 abc
+00610062006300200020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_unicode_520_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+00200061 a
+002000610020 a
+0061 a
+006100200020 a
+0061002000200020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+0061002000200020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16_unicode_520_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+00610061 1
+0061006100200020 1
+00610062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+120F020002000200020002000200020002000200
+120F020A020A0200020002000200020002000200
+020A120F02000200020002000200020002000200
+020A120F020A0200020002000200020002000200
+120F020A020A020A020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf16_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf16_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf16_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc '))
+0061006200630020
+SELECT HEX(GREATEST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf16_unicode_520_nopad_ci', 'abc '))
+00610062006300200020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16_unicode_520_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_unicode_520_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16_unicode_520_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16_unicode_520_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET NAMES utf8, collation_connection=utf16_unicode_520_nopad_ci;
+#
+# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
+#
+CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
+ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(50) CHARACTER SET utf16 COLLATE utf16_unicode_520_nopad_ci DEFAULT NULL,
+ `b` varchar(50) CHARACTER SET utf16 COLLATE utf16_unicode_520_nopad_ci DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('111', '111');
+INSERT INTO t1 VALUES ('222', '222');
+INSERT INTO t1 VALUES ('333', '333');
+INSERT INTO t1 VALUES ('444', '444');
+SELECT * FROM t1 WHERE a LIKE '111%';
+a b
+111 111
+SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
+a b
+111 111
+DROP TABLE t1;
+SET NAMES utf8;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_utf16le.result b/mysql-test/r/ctype_utf16le.result
index 93fce843dc8..0fedff7d3bf 100644
--- a/mysql-test/r/ctype_utf16le.result
+++ b/mysql-test/r/ctype_utf16le.result
@@ -82,7 +82,7 @@ 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 INTO t1 VALUES (_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423');
+INSERT IGNORE INTO t1 VALUES (_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
INSERT INTO t1 VALUES (_utf32 X'010000', 10, _ucs2 X'0421');
@@ -102,8 +102,8 @@ RPAD(_utf16le X'2004',10,_utf16le X'2104') r;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `l` varchar(10) CHARACTER SET utf16le NOT NULL,
- `r` varchar(10) CHARACTER SET utf16le NOT NULL
+ `l` varchar(10) CHARACTER SET utf16le DEFAULT NULL,
+ `r` varchar(10) CHARACTER SET utf16le DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(l), HEX(r) FROM t1;
HEX(l) HEX(r)
@@ -798,7 +798,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL
+ `a` varchar(1) CHARACTER SET utf16le COLLATE utf16le_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84);
INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080);
@@ -1121,6 +1121,7 @@ DROP TABLE t1;
#
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;
Warnings:
Warning 1366 Incorrect string value: '\xDF\x84' for column 's1' at row 1
@@ -1133,7 +1134,7 @@ DROP TABLE t1;
#
CREATE TABLE t1 (s1 VARCHAR(5) CHARACTER SET ucs2, s2 VARCHAR(5) CHARACTER SET utf16le);
INSERT INTO t1 (s1) VALUES (0xdf84);
-UPDATE t1 set s2 = s1;
+UPDATE IGNORE t1 set s2 = s1;
Warnings:
Warning 1366 Incorrect string value: '\xDF\x84' for column 's2' at row 1
SELECT HEX(s2) FROM t1;
@@ -1470,7 +1471,7 @@ Warning 1292 Truncated incorrect INTEGER value: '123456789123456789123x'
#
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES ('-1234.1e2');
-INSERT INTO t1 VALUES ('-1234.1e2xxxx');
+INSERT IGNORE INTO t1 VALUES ('-1234.1e2xxxx');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
INSERT INTO t1 VALUES ('-1234.1e2 ');
@@ -1524,7 +1525,7 @@ CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES ('1 ');
Warnings:
Note 1265 Data truncated for column 'a' at row 1
-INSERT INTO t1 VALUES ('1 x');
+INSERT IGNORE INTO t1 VALUES ('1 x');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
SELECT * FROM t1;
@@ -1535,13 +1536,14 @@ DROP TABLE t1;
#
# Testing auto-conversion to TEXT
#
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t1 (a VARCHAR(17000) CHARACTER SET utf16le);
Warnings:
Note 1246 Converting column 'a' from VARCHAR to TEXT
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` mediumtext CHARACTER SET utf16le
+ `a` mediumtext CHARACTER SET utf16le DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
@@ -1690,7 +1692,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 64) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(64) CHARACTER SET utf16le NOT NULL
+ `a` varchar(64) CHARACTER SET utf16le DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('');
SELECT CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1;
@@ -1741,7 +1743,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',2) as s1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `s1` varchar(2) CHARACTER SET utf16le NOT NULL
+ `s1` varchar(2) CHARACTER SET utf16le DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
SELECT * FROM t1 ORDER BY s1;
@@ -1854,7 +1856,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET utf16le NOT NULL
+ `a` varchar(5) CHARACTER SET utf16le DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -2104,7 +2106,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL
+ `a` varchar(5) CHARACTER SET utf16le COLLATE utf16le_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -2393,3 +2395,567 @@ Warning 1292 Truncated incorrect INTEGER value: '1IJ3'
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET character_set_connection=utf16le;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16le_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf16le_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf16le COLLATE=utf16le_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+20006100 a
+200061002000 a
+6100200020002000 a
+610062006300 abc
+61006200630020002000 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+20006100 a
+200061002000 a
+6100200020002000 a
+610062006300 abc
+61006200630020002000 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+61006200630020002000 abc
+610062006300 abc
+6100200020002000 a
+200061002000 a
+20006100 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16le_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+20006100 a
+200061002000 a
+61002000 a
+6100200020002000 a
+610062006300 abc
+6100620063002000 abc
+61006200630020002000 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16le_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+20006100 a
+200061002000 a
+6100 a
+610020002000 a
+6100200020002000 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+6100200020002000 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16le_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+61006100 1
+6100610020002000 1
+61006200 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0041000000000000000000000000000000000000
+0041002000200000000000000000000000000000
+0020004100000000000000000000000000000000
+0020004100200000000000000000000000000000
+0041002000200020000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf16le_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf16le_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc '))
+6100620063002000
+SELECT HEX(GREATEST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc '))
+61006200630020002000
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16le_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16le_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16le_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf16le_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf16le COLLATE=utf16le_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+20006100 a
+200061002000 a
+6100200020002000 a
+610062006300 abc
+61006200630020002000 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+20006100 a
+200061002000 a
+6100200020002000 a
+610062006300 abc
+61006200630020002000 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+61006200630020002000 abc
+610062006300 abc
+6100200020002000 a
+200061002000 a
+20006100 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16le_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+20006100 a
+200061002000 a
+61002000 a
+6100200020002000 a
+610062006300 abc
+6100620063002000 abc
+61006200630020002000 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16le_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+20006100 a
+200061002000 a
+6100 a
+610020002000 a
+6100200020002000 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+6100200020002000 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16le_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+61006100 1
+6100610020002000 1
+61006200 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0041000000000000000000000000000000000000
+0041002000200000000000000000000000000000
+0020004100000000000000000000000000000000
+0020004100200000000000000000000000000000
+0041002000200020000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf16le_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf16le_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf16le_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc '))
+6100620063002000
+SELECT HEX(GREATEST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf16le_general_nopad_ci', 'abc '))
+61006200630020002000
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16le_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16le_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16le_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf16le_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf16le COLLATE=utf16le_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+20006100 a
+200061002000 a
+6100200020002000 a
+610062006300 abc
+61006200630020002000 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+20006100 a
+200061002000 a
+6100200020002000 a
+610062006300 abc
+61006200630020002000 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+61006200630020002000 abc
+610062006300 abc
+6100200020002000 a
+200061002000 a
+20006100 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16le_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+20006100 a
+200061002000 a
+61002000 a
+6100200020002000 a
+610062006300 abc
+6100620063002000 abc
+61006200630020002000 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16le_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+20006100 a
+200061002000 a
+6100 a
+610020002000 a
+6100200020002000 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+6100200020002000 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16le_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+61006100 1
+6100610020002000 1
+61006200 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+000061000000000000000000000000000000000000000000000000000000
+000061000020000020000000000000000000000000000000000000000000
+000020000061000000000000000000000000000000000000000000000000
+000020000061000020000000000000000000000000000000000000000000
+000061000020000020000020000000000000000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf16le_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf16le_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf16le_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf16le_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf16le_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf16le_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf16le_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf16le_nopad_bin', 'abc '))
+6100620063002000
+SELECT HEX(GREATEST('abc ' COLLATE 'utf16le_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf16le_nopad_bin', 'abc '))
+61006200630020002000
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16le_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16le_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf16le_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf16le_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf16le COLLATE=utf16le_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+20006100 a
+200061002000 a
+6100200020002000 a
+610062006300 abc
+61006200630020002000 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+20006100 a
+200061002000 a
+6100200020002000 a
+610062006300 abc
+61006200630020002000 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+61006200630020002000 abc
+610062006300 abc
+6100200020002000 a
+200061002000 a
+20006100 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf16le_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+20006100 a
+200061002000 a
+61002000 a
+6100200020002000 a
+610062006300 abc
+6100620063002000 abc
+61006200630020002000 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16le_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+20006100 a
+200061002000 a
+6100 a
+610020002000 a
+6100200020002000 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+6100200020002000 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf16le_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+61006100 1
+6100610020002000 1
+61006200 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+000061000000000000000000000000000000000000000000000000000000
+000061000020000020000000000000000000000000000000000000000000
+000020000061000000000000000000000000000000000000000000000000
+000020000061000020000000000000000000000000000000000000000000
+000061000020000020000020000000000000000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf16le_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf16le_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf16le_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf16le_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf16le_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf16le_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf16le_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf16le_nopad_bin', 'abc '))
+6100620063002000
+SELECT HEX(GREATEST('abc ' COLLATE 'utf16le_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf16le_nopad_bin', 'abc '))
+61006200630020002000
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf16le_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf16le_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf16le_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result
index 22b0e9c0fc0..59ce4c2f445 100644
--- a/mysql-test/r/ctype_utf32.result
+++ b/mysql-test/r/ctype_utf32.result
@@ -100,8 +100,8 @@ RPAD(_utf32 X'0420',10,_utf32 X'0421') r;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `l` varchar(10) CHARACTER SET utf32 NOT NULL,
- `r` varchar(10) CHARACTER SET utf32 NOT NULL
+ `l` varchar(10) CHARACTER SET utf32 DEFAULT NULL,
+ `r` varchar(10) CHARACTER SET utf32 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(l), hex(r) from t1;
hex(l) hex(r)
@@ -754,7 +754,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL
+ `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84);
INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080);
@@ -983,31 +983,31 @@ hex(a)
drop table t1;
create table t1 (utf32 varchar(2) character set utf32);
Wrong character with pad
-insert into t1 values (0x110000);
+insert ignore into t1 values (0x110000);
Warnings:
Warning 1366 Incorrect string value: '\x11\x00\x00' for column 'utf32' at row 1
Wrong chsaracter without pad
-insert into t1 values (0x00110000);
+insert ignore into t1 values (0x00110000);
Warnings:
Warning 1366 Incorrect string value: '\x00\x11\x00\x00' for column 'utf32' at row 1
Wrong character with pad followed by another wrong character
-insert into t1 values (0x11000000110000);
+insert ignore into t1 values (0x11000000110000);
Warnings:
Warning 1366 Incorrect string value: '\x11\x00\x00\x00\x11\x00...' for column 'utf32' at row 1
Good character with pad followed by bad character
-insert into t1 values (0x10000000110000);
+insert ignore into t1 values (0x10000000110000);
Warnings:
Warning 1366 Incorrect string value: '\x00\x11\x00\x00' for column 'utf32' at row 1
Good character without pad followed by bad character
-insert into t1 values (0x0010000000110000);
+insert ignore into t1 values (0x0010000000110000);
Warnings:
Warning 1366 Incorrect string value: '\x00\x11\x00\x00' for column 'utf32' at row 1
Wrong character with the second byte higher than 0x10
-insert into t1 values (0x00800037);
+insert ignore into t1 values (0x00800037);
Warnings:
Warning 1366 Incorrect string value: '\x00\x80\x007' for column 'utf32' at row 1
Wrong character with pad with the second byte higher than 0x10
-insert into t1 values (0x00800037);
+insert ignore into t1 values (0x00800037);
Warnings:
Warning 1366 Incorrect string value: '\x00\x80\x007' for column 'utf32' at row 1
drop table t1;
@@ -1248,7 +1248,7 @@ Warnings:
Warning 1292 Truncated incorrect INTEGER value: '123456789123456789123x'
create table t1 (a int);
insert into t1 values ('-1234.1e2');
-insert into t1 values ('-1234.1e2xxxx');
+insert ignore into t1 values ('-1234.1e2xxxx');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
insert into t1 values ('-1234.1e2 ');
@@ -1264,7 +1264,7 @@ create table t1 (a int);
insert into t1 values ('1 ');
Warnings:
Note 1265 Data truncated for column 'a' at row 1
-insert into t1 values ('1 x');
+insert ignore into t1 values ('1 x');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
@@ -1272,13 +1272,14 @@ a
1
1
drop table t1;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t1 (a varchar(17000) character set utf32);
Warnings:
Note 1246 Converting column 'a' from VARCHAR to TEXT
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` mediumtext CHARACTER SET utf32
+ `a` mediumtext CHARACTER SET utf32 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a varchar(250) character set utf32 primary key);
@@ -1367,7 +1368,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 64) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(64) CHARACTER SET utf32 NOT NULL
+ `a` varchar(64) CHARACTER SET utf32 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('');
SELECT CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1;
@@ -1467,7 +1468,7 @@ hex(char(0x010203 using utf32))
00010203
select hex(char(0x01020304 using utf32));
hex(char(0x01020304 using utf32))
-
+NULL
Warnings:
Warning 1300 Invalid utf32 character string: '010203'
create table t1 (s1 varchar(1) character set utf32, s2 text character set utf32);
@@ -1482,7 +1483,7 @@ CREATE TABLE t1 AS SELECT repeat('a',2) as s1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `s1` varchar(2) CHARACTER SET utf32 NOT NULL
+ `s1` varchar(2) CHARACTER SET utf32 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
SELECT * FROM t1 ORDER BY s1;
@@ -1558,12 +1559,12 @@ DROP TABLE t1;
#
CREATE TABLE t1 (utf32 CHAR(5) CHARACTER SET utf32, latin1 CHAR(5) CHARACTER SET latin1);
INSERT INTO t1 (utf32) VALUES (0xc581);
-UPDATE t1 SET latin1 = utf32;
+UPDATE IGNORE t1 SET latin1 = utf32;
Warnings:
Warning 1366 Incorrect string value: '\x00\x00\xC5\x81' for column 'latin1' at row 1
DELETE FROM t1;
INSERT INTO t1 (utf32) VALUES (0x100cc);
-UPDATE t1 SET latin1 = utf32;
+UPDATE IGNORE t1 SET latin1 = utf32;
Warnings:
Warning 1366 Incorrect string value: '\x00\x01\x00\xCC' for column 'latin1' at row 1
DROP TABLE t1;
@@ -1575,7 +1576,7 @@ CREATE TABLE t1 AS SELECT format(123,2,'no_NO');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `format(123,2,'no_NO')` varchar(37) CHARACTER SET utf32 NOT NULL
+ `format(123,2,'no_NO')` varchar(45) CHARACTER SET utf32 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t1;
format(123,2,'no_NO')
@@ -1613,6 +1614,7 @@ DROP TABLE t1;
# Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
#
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
@@ -1680,6 +1682,7 @@ SET NAMES utf8;
#
# MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535
#
+set sql_mode='';
CREATE TABLE t1 (c1 VARCHAR(16383) CHARACTER SET utf32);
DESCRIBE t1;
Field Type Null Key Default Extra
@@ -1692,6 +1695,7 @@ DESCRIBE t1;
Field Type Null Key Default Extra
c1 mediumtext YES NULL
DROP TABLE t1;
+set sql_mode=default;
#
# End of 5.5 tests
#
@@ -1729,7 +1733,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET utf32 NOT NULL
+ `a` varchar(5) CHARACTER SET utf32 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -1979,7 +1983,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL
+ `a` varchar(5) CHARACTER SET utf32 COLLATE utf32_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -2267,3 +2271,567 @@ Warning 1292 Truncated incorrect INTEGER value: '1IJ3'
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET character_set_connection=utf32;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf32_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf32 COLLATE=utf32_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+0000006100000062000000630000002000000020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+0000006100000062000000630000002000000020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+0000006100000062000000630000002000000020 abc
+000000610000006200000063 abc
+00000061000000200000002000000020 a
+000000200000006100000020 a
+0000002000000061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf32_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+0000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+00000061000000620000006300000020 abc
+0000006100000062000000630000002000000020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061 a
+000000610000002000000020 a
+00000061000000200000002000000020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+00000061000000200000002000000020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf32_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+0000006100000061 1
+00000061000000610000002000000020 1
+0000006100000062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0041000000000000000000000000000000000000
+0041002000200000000000000000000000000000
+0020004100000000000000000000000000000000
+0020004100200000000000000000000000000000
+0041002000200020000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf32_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf32_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf32_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf32_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf32_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf32_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc '))
+00000061000000620000006300000020
+SELECT HEX(GREATEST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc '))
+0000006100000062000000630000002000000020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf32_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf32_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf32 COLLATE=utf32_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+0000006100000062000000630000002000000020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+0000006100000062000000630000002000000020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+0000006100000062000000630000002000000020 abc
+000000610000006200000063 abc
+00000061000000200000002000000020 a
+000000200000006100000020 a
+0000002000000061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf32_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+0000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+00000061000000620000006300000020 abc
+0000006100000062000000630000002000000020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061 a
+000000610000002000000020 a
+00000061000000200000002000000020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+00000061000000200000002000000020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf32_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+0000006100000061 1
+00000061000000610000002000000020 1
+0000006100000062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0041000000000000000000000000000000000000
+0041002000200000000000000000000000000000
+0020004100000000000000000000000000000000
+0020004100200000000000000000000000000000
+0041002000200020000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf32_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf32_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf32_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf32_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf32_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf32_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc '))
+00000061000000620000006300000020
+SELECT HEX(GREATEST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf32_general_nopad_ci', 'abc '))
+0000006100000062000000630000002000000020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf32_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf32_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf32 COLLATE=utf32_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+0000006100000062000000630000002000000020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+0000006100000062000000630000002000000020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+0000006100000062000000630000002000000020 abc
+000000610000006200000063 abc
+00000061000000200000002000000020 a
+000000200000006100000020 a
+0000002000000061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf32_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+0000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+00000061000000620000006300000020 abc
+0000006100000062000000630000002000000020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061 a
+000000610000002000000020 a
+00000061000000200000002000000020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+00000061000000200000002000000020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf32_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+0000006100000061 1
+00000061000000610000002000000020 1
+0000006100000062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+000061000000000000000000000000000000000000000000000000000000
+000061000020000020000000000000000000000000000000000000000000
+000020000061000000000000000000000000000000000000000000000000
+000020000061000020000000000000000000000000000000000000000000
+000061000020000020000020000000000000000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf32_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf32_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf32_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf32_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf32_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf32_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf32_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf32_nopad_bin', 'abc '))
+00000061000000620000006300000020
+SELECT HEX(GREATEST('abc ' COLLATE 'utf32_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf32_nopad_bin', 'abc '))
+0000006100000062000000630000002000000020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf32_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf32_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf32 COLLATE=utf32_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+0000006100000062000000630000002000000020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+0000006100000062000000630000002000000020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+0000006100000062000000630000002000000020 abc
+000000610000006200000063 abc
+00000061000000200000002000000020 a
+000000200000006100000020 a
+0000002000000061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf32_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+0000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+00000061000000620000006300000020 abc
+0000006100000062000000630000002000000020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061 a
+000000610000002000000020 a
+00000061000000200000002000000020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+00000061000000200000002000000020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf32_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+0000006100000061 1
+00000061000000610000002000000020 1
+0000006100000062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+000061000000000000000000000000000000000000000000000000000000
+000061000020000020000000000000000000000000000000000000000000
+000020000061000000000000000000000000000000000000000000000000
+000020000061000020000000000000000000000000000000000000000000
+000061000020000020000020000000000000000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf32_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf32_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf32_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf32_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf32_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf32_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf32_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf32_nopad_bin', 'abc '))
+00000061000000620000006300000020
+SELECT HEX(GREATEST('abc ' COLLATE 'utf32_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf32_nopad_bin', 'abc '))
+0000006100000062000000630000002000000020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf32_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_utf32_uca.result b/mysql-test/r/ctype_utf32_uca.result
index 234a01bb108..a112918c0c3 100644
--- a/mysql-test/r/ctype_utf32_uca.result
+++ b/mysql-test/r/ctype_utf32_uca.result
@@ -2810,7 +2810,7 @@ want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
-insert into t1 values (),();
+insert ignore into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
@@ -3045,7 +3045,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL,
+ `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_unicode_ci DEFAULT NULL,
`b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
@@ -3248,7 +3248,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL
+ `a` varchar(5) CHARACTER SET utf32 COLLATE utf32_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -3715,7 +3715,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_german2_ci NOT NULL,
+ `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_german2_ci DEFAULT NULL,
`b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
@@ -3746,7 +3746,7 @@ CREATE TABLE t1 AS SELECT repeat('a', 10) as c LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c` varchar(10) CHARACTER SET utf32 COLLATE utf32_unicode_520_ci NOT NULL
+ `c` varchar(10) CHARACTER SET utf32 COLLATE utf32_unicode_520_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_utf32 0x0180),(_utf32 0x023A);
INSERT INTO t1 VALUES (_utf32 0x023B),(_utf32 0x023C);
@@ -4019,7 +4019,7 @@ hex(c) hex(weight_string(c)) c
ALTER TABLE t1 ADD KEY(c);
EXPLAIN SELECT hex(c) FROM t1 WHERE c LIKE 'a%' ORDER BY c;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 42 NULL 2 Using where; Using index
+1 SIMPLE t1 range c c 43 NULL 2 Using where; Using index
SELECT hex(c), hex(weight_string(c)) FROM t1 WHERE c LIKE 'a%' ORDER BY c;
hex(c) hex(weight_string(c))
00000061 120F
@@ -4062,7 +4062,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `s1` varchar(64) CHARACTER SET utf32 COLLATE utf32_myanmar_ci NOT NULL,
+ `s1` varchar(64) CHARACTER SET utf32 COLLATE utf32_myanmar_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 (s1) VALUES
@@ -6648,7 +6648,7 @@ CREATE TABLE t1 AS SELECT SPACE(3) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(3) CHARACTER SET utf32 COLLATE utf32_thai_520_w2 NOT NULL
+ `a` varchar(3) CHARACTER SET utf32 COLLATE utf32_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (SPACE(0)),(SPACE(1)),(SPACE(2));
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(8))) FROM t1;
@@ -6681,7 +6681,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET utf32 COLLATE utf32_thai_520_w2 NOT NULL
+ `a` varchar(10) CHARACTER SET utf32 COLLATE utf32_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_ucs2 0x3400);
INSERT INTO t1 VALUES (_ucs2 0xF001);
@@ -6694,7 +6694,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET utf32 COLLATE utf32_thai_520_w2 NOT NULL
+ `a` varchar(10) CHARACTER SET utf32 COLLATE utf32_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('A'),('À'),('Ã'),('Â'),('Ã'),('Ä'),('Ã…');
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a;
@@ -6753,7 +6753,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET utf32 COLLATE utf32_thai_520_w2 NOT NULL
+ `a` varchar(10) CHARACTER SET utf32 COLLATE utf32_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('cota'),('cote'),('cotz');
INSERT INTO t1 VALUES ('coté'),('côte'),('côté'),('cotë'),('côtë');
@@ -7325,3 +7325,593 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-10877 xxx_unicode_nopad_ci collations
+#
+SET NAMES utf8, character_set_connection=utf32;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_unicode_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf32_unicode_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf32 COLLATE=utf32_unicode_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+0000006100000062000000630000002000000020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+0000006100000062000000630000002000000020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+0000006100000062000000630000002000000020 abc
+000000610000006200000063 abc
+00000061000000200000002000000020 a
+000000200000006100000020 a
+0000002000000061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf32_unicode_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+0000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+00000061000000620000006300000020 abc
+0000006100000062000000630000002000000020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_unicode_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061 a
+000000610000002000000020 a
+00000061000000200000002000000020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+00000061000000200000002000000020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf32_unicode_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+0000006100000061 1
+00000061000000610000002000000020 1
+0000006100000062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0E33020002000200020002000200020002000200
+0E33020902090200020002000200020002000200
+02090E3302000200020002000200020002000200
+02090E3302090200020002000200020002000200
+0E33020902090209020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf32_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf32_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc '))
+00000061000000620000006300000020
+SELECT HEX(GREATEST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc '))
+0000006100000062000000630000002000000020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_unicode_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_unicode_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf32_unicode_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_unicode_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_unicode_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf32_unicode_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf32 COLLATE=utf32_unicode_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+0000006100000062000000630000002000000020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+0000006100000062000000630000002000000020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+0000006100000062000000630000002000000020 abc
+000000610000006200000063 abc
+00000061000000200000002000000020 a
+000000200000006100000020 a
+0000002000000061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf32_unicode_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+0000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+00000061000000620000006300000020 abc
+0000006100000062000000630000002000000020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_unicode_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061 a
+000000610000002000000020 a
+00000061000000200000002000000020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+00000061000000200000002000000020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf32_unicode_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+0000006100000061 1
+00000061000000610000002000000020 1
+0000006100000062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0E33020002000200020002000200020002000200
+0E33020902090200020002000200020002000200
+02090E3302000200020002000200020002000200
+02090E3302090200020002000200020002000200
+0E33020902090209020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf32_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf32_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf32_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc '))
+00000061000000620000006300000020
+SELECT HEX(GREATEST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf32_unicode_nopad_ci', 'abc '))
+0000006100000062000000630000002000000020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_unicode_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_unicode_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf32_unicode_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_unicode_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_unicode_520_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf32_unicode_520_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf32 COLLATE=utf32_unicode_520_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+0000006100000062000000630000002000000020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+0000006100000062000000630000002000000020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+0000006100000062000000630000002000000020 abc
+000000610000006200000063 abc
+00000061000000200000002000000020 a
+000000200000006100000020 a
+0000002000000061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf32_unicode_520_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+0000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+00000061000000620000006300000020 abc
+0000006100000062000000630000002000000020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_unicode_520_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061 a
+000000610000002000000020 a
+00000061000000200000002000000020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+00000061000000200000002000000020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf32_unicode_520_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+0000006100000061 1
+00000061000000610000002000000020 1
+0000006100000062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+120F020002000200020002000200020002000200
+120F020A020A0200020002000200020002000200
+020A120F02000200020002000200020002000200
+020A120F020A0200020002000200020002000200
+120F020A020A020A020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf32_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf32_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc '))
+00000061000000620000006300000020
+SELECT HEX(GREATEST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc '))
+0000006100000062000000630000002000000020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_unicode_520_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_unicode_520_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf32_unicode_520_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_unicode_520_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf32_unicode_520_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf32_unicode_520_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf32 COLLATE=utf32_unicode_520_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+0000006100000062000000630000002000000020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+0000006100000062000000630000002000000020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+0000006100000062000000630000002000000020 abc
+000000610000006200000063 abc
+00000061000000200000002000000020 a
+000000200000006100000020 a
+0000002000000061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf32_unicode_520_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+0000006100000020 a
+00000061000000200000002000000020 a
+000000610000006200000063 abc
+00000061000000620000006300000020 abc
+0000006100000062000000630000002000000020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_unicode_520_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+0000002000000061 a
+000000200000006100000020 a
+00000061 a
+000000610000002000000020 a
+00000061000000200000002000000020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+00000061000000200000002000000020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf32_unicode_520_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+0000006100000061 1
+00000061000000610000002000000020 1
+0000006100000062 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+120F020002000200020002000200020002000200
+120F020A020A0200020002000200020002000200
+020A120F02000200020002000200020002000200
+020A120F020A0200020002000200020002000200
+120F020A020A020A020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf32_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf32_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf32_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc '))
+00000061000000620000006300000020
+SELECT HEX(GREATEST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf32_unicode_520_nopad_ci', 'abc '))
+0000006100000062000000630000002000000020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf32_unicode_520_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_unicode_520_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf32_unicode_520_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf32_unicode_520_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET NAMES utf8, collation_connection=utf32_unicode_520_nopad_ci;
+#
+# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
+#
+CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
+ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(50) CHARACTER SET utf32 COLLATE utf32_unicode_520_nopad_ci DEFAULT NULL,
+ `b` varchar(50) CHARACTER SET utf32 COLLATE utf32_unicode_520_nopad_ci DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('111', '111');
+INSERT INTO t1 VALUES ('222', '222');
+INSERT INTO t1 VALUES ('333', '333');
+INSERT INTO t1 VALUES ('444', '444');
+SELECT * FROM t1 WHERE a LIKE '111%';
+a b
+111 111
+SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
+a b
+111 111
+DROP TABLE t1;
+SET NAMES utf8;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 3da74d12877..46b7386d993 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -157,7 +157,7 @@ drop table t1;
set LC_TIME_NAMES='en_US';
set names koi8r;
create table t1 (s1 char(1) character set utf8);
-insert into t1 values (_koi8r'ÁÂ');
+insert ignore into t1 values (_koi8r'ÁÂ');
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
@@ -165,19 +165,19 @@ s1 hex(s1) char_length(s1) octet_length(s1)
Á D0B0 1 2
drop table t1;
create table t1 (s1 tinytext character set utf8);
-insert into t1 select repeat('a',300);
+insert ignore into t1 select repeat('a',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ñ',300);
+insert ignore into t1 select repeat('Ñ',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('aÑ',300);
+insert ignore into t1 select repeat('aÑ',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ña',300);
+insert ignore into t1 select repeat('Ña',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('ÑÑ',300);
+insert ignore into t1 select repeat('ÑÑ',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
select hex(s1) from t1;
@@ -196,19 +196,19 @@ length(s1) char_length(s1)
254 127
drop table t1;
create table t1 (s1 text character set utf8);
-insert into t1 select repeat('a',66000);
+insert ignore into t1 select repeat('a',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ñ',66000);
+insert ignore into t1 select repeat('Ñ',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('aÑ',66000);
+insert ignore into t1 select repeat('aÑ',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ña',66000);
+insert ignore into t1 select repeat('Ña',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('ÑÑ',66000);
+insert ignore into t1 select repeat('ÑÑ',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
select length(s1),char_length(s1) from t1;
@@ -220,7 +220,7 @@ length(s1) char_length(s1)
65534 32767
drop table t1;
create table t1 (s1 char(10) character set utf8);
-insert into t1 values (0x41FF);
+insert ignore into t1 values (0x41FF);
Warnings:
Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
select hex(s1) from t1;
@@ -228,7 +228,7 @@ hex(s1)
413F
drop table t1;
create table t1 (s1 varchar(10) character set utf8);
-insert into t1 values (0x41FF);
+insert ignore into t1 values (0x41FF);
Warnings:
Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
select hex(s1) from t1;
@@ -236,7 +236,7 @@ hex(s1)
413F
drop table t1;
create table t1 (s1 text character set utf8);
-insert into t1 values (0x41FF);
+insert ignore into t1 values (0x41FF);
Warnings:
Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
select hex(s1) from t1;
@@ -901,8 +901,8 @@ create table t2 select concat(a,_utf8'') as a, concat(b,_utf8'')as b from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` varchar(5) CHARACTER SET utf8 NOT NULL,
- `b` varchar(15) CHARACTER SET utf8 NOT NULL
+ `a` varchar(5) CHARACTER SET utf8 DEFAULT NULL,
+ `b` varchar(15) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2;
drop table t1;
@@ -1126,7 +1126,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf8 NOT NULL,
+ `a` varchar(1) CHARACTER SET utf8 DEFAULT NULL,
`b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
@@ -1160,8 +1160,8 @@ STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR))
CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0;
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
-subject varchar(64) NO NULL
-pattern varchar(64) NO NULL
+subject varchar(64) YES NULL
+pattern varchar(64) YES NULL
INSERT INTO t1 VALUES (_utf8'2001÷01÷01',_utf8'%Y÷%m÷%d');
SELECT HEX(subject),HEX(pattern),STR_TO_DATE(subject, pattern) FROM t1;
HEX(subject) HEX(pattern) STR_TO_DATE(subject, pattern)
@@ -1387,6 +1387,7 @@ ERR Имри.Ðфимим.Ðеимимримдмримрмрирор имримÑ
DROP TABLE t1,t2;
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;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1863,24 +1864,28 @@ insert into t1 (a) values ('abcdefghijklmnopqrstuvwxyz');
select * from t1;
a
abcdefghijklmnopqrstuvwxyz
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a varchar(20) character set utf8 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
abcdefghijklmnopqrst
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a char(15) character set utf8 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
abcdefghijklmno
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a char(10) character set utf8 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
abcdefghij
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a varchar(5) character set utf8 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1892,6 +1897,7 @@ 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;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1914,7 +1920,7 @@ char(53647 using utf8)
Ñ
select char(0xff,0x8f using utf8);
char(0xff,0x8f using utf8)
-
+NULL
Warnings:
Warning 1300 Invalid utf8 character string: 'FF8F'
select convert(char(0xff,0x8f) using utf8);
@@ -2128,7 +2134,7 @@ ERROR HY000: Invalid utf8 character string: 'FF'
set sql_mode=default;
select hex(char(0xFF using utf8));
hex(char(0xFF using utf8))
-
+NULL
Warnings:
Warning 1300 Invalid utf8 character string: 'FF'
select hex(convert(0xFF using utf8));
@@ -2275,8 +2281,8 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`clipid` int(11) NOT NULL,
- `mos` tinyint(4) DEFAULT '0',
- `Tape` tinytext,
+ `mos` tinyint(4) DEFAULT 0,
+ `Tape` tinytext DEFAULT NULL,
PRIMARY KEY (`clipid`),
KEY `tape` (`Tape`(255))
) ENGINE=MyISAM DEFAULT CHARSET=utf8
@@ -2464,7 +2470,7 @@ create table t1 as select concat(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -2477,7 +2483,7 @@ create table t1 as select concat(18446744073709551615) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(20) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(20) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -2490,7 +2496,7 @@ create table t1 as select concat(1.1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select hex(c1) from t1;
hex(c1)
@@ -2503,7 +2509,7 @@ create table t1 as select concat(1+2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1-2));
@@ -2513,7 +2519,7 @@ create table t1 as select concat(1-2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1*2));
@@ -2523,7 +2529,7 @@ create table t1 as select concat(1*2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1/2));
@@ -2563,7 +2569,7 @@ create table t1 as select concat(-1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(-(1+2)));
@@ -2573,7 +2579,7 @@ create table t1 as select concat(-(1+2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1|2));
@@ -2583,7 +2589,7 @@ create table t1 as select concat(1|2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(1&2));
@@ -2593,7 +2599,7 @@ create table t1 as select concat(1&2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_count(12)));
@@ -2603,7 +2609,7 @@ create table t1 as select concat(bit_count(12)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2<<1));
@@ -2613,7 +2619,7 @@ create table t1 as select concat(2<<1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(2>>1));
@@ -2623,7 +2629,7 @@ create table t1 as select concat(2>>1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(~0));
@@ -2633,7 +2639,7 @@ create table t1 as select concat(~0) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(3^2));
@@ -2643,7 +2649,7 @@ create table t1 as select concat(3^2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(abs(-2)));
@@ -2653,7 +2659,7 @@ create table t1 as select concat(abs(-2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(concat(exp(2)),1));
@@ -2783,7 +2789,7 @@ create table t1 as select concat(degrees(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(23) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(radians(0)));
@@ -2793,7 +2799,7 @@ create table t1 as select concat(radians(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(23) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ceiling(0.5)));
@@ -2803,7 +2809,7 @@ create table t1 as select concat(ceiling(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
@@ -2813,7 +2819,7 @@ create table t1 as select concat(floor(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
@@ -2823,7 +2829,7 @@ create table t1 as select concat(round(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sign(0.5)));
@@ -2833,14 +2839,14 @@ create table t1 as select concat(sign(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(rand()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(23) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(length('a')));
@@ -2850,7 +2856,7 @@ create table t1 as select concat(length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(char_length('a')));
@@ -2860,7 +2866,7 @@ create table t1 as select concat(char_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(bit_length('a')));
@@ -2870,7 +2876,7 @@ create table t1 as select concat(bit_length('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coercibility('a')));
@@ -2880,7 +2886,7 @@ create table t1 as select concat(coercibility('a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(locate('a','a')));
@@ -2890,7 +2896,7 @@ create table t1 as select concat(locate('a','a')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(11) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(11) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(field('c','a','b','c')));
@@ -2900,7 +2906,7 @@ create table t1 as select concat(field('c','a','b','c')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ascii(61)));
@@ -2910,7 +2916,7 @@ create table t1 as select concat(ascii(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ord(61)));
@@ -2920,7 +2926,7 @@ create table t1 as select concat(ord(61)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(find_in_set('b','a,b,c,d')));
@@ -2930,7 +2936,7 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select md5('a'), hex(md5('a'));
@@ -2940,7 +2946,7 @@ create table t1 as select md5('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(32) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(32) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select old_password('a'), hex(old_password('a'));
@@ -2950,7 +2956,7 @@ create table t1 as select old_password('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(16) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(16) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select password('a'), hex(password('a'));
@@ -2960,7 +2966,7 @@ create table t1 as select password('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(41) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(41) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha('a'), hex(sha('a'));
@@ -2970,7 +2976,7 @@ create table t1 as select sha('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(40) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(40) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select sha1('a'), hex(sha1('a'));
@@ -2980,7 +2986,7 @@ create table t1 as select sha1('a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(40) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(40) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('-1' as signed)));
@@ -2990,7 +2996,7 @@ create table t1 as select concat(cast('-1' as signed)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast('1' as unsigned)));
@@ -3000,7 +3006,7 @@ create table t1 as select concat(cast('1' as unsigned)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(cast(1/2 as decimal(5,5))));
@@ -3059,7 +3065,7 @@ create table t1 as select concat(least(1,2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(greatest(1,2)));
@@ -3069,7 +3075,7 @@ create table t1 as select concat(greatest(1,2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(case when 11 then 22 else 33 end));
@@ -3079,7 +3085,7 @@ create table t1 as select concat(case when 11 then 22 else 33 end) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(coalesce(1,2)));
@@ -3089,7 +3095,7 @@ create table t1 as select concat(coalesce(1,2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat_ws(1,2,3));
@@ -3099,7 +3105,7 @@ create table t1 as select concat_ws(1,2,3) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(group_concat(1,2,3));
@@ -3109,7 +3115,7 @@ create table t1 as select group_concat(1,2,3) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` text CHARACTER SET utf8
+ `c1` mediumtext CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select 1 as c1 union select 'a';
@@ -3127,7 +3133,7 @@ create table t1 as select concat(last_insert_id()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(benchmark(0,0)));
@@ -3137,7 +3143,7 @@ create table t1 as select concat(benchmark(0,0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sleep(0)));
@@ -3147,7 +3153,7 @@ create table t1 as select concat(sleep(0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx')));
@@ -3181,7 +3187,7 @@ create table t1 as select concat(crc32('')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(uncompressed_length('')));
@@ -3198,7 +3204,7 @@ create table t1 as select concat(connection_id()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(inet_aton('127.1.1.1')));
@@ -3234,7 +3240,7 @@ create table t1 as select concat(row_count()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(found_rows()));
@@ -3244,21 +3250,21 @@ create table t1 as select concat(found_rows()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(uuid_short()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(21) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(uuid()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(36) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(36) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select coercibility(uuid()), coercibility(cast('a' as char character set latin1));
@@ -3271,7 +3277,7 @@ create table t1 as select concat(uuid(), cast('a' as char character set latin1))
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(37) NOT NULL
+ `c1` varchar(37) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1;
@@ -3291,7 +3297,7 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL,
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL,
`c2` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -3349,7 +3355,7 @@ hex(c1)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET utf8 NOT NULL,
+ `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL,
`c2` decimal(2,1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -3365,7 +3371,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(83) CHARACTER SET utf8 DEFAULT NULL,
- `c2` decimal(65,30) DEFAULT NULL
+ `c2` decimal(65,38) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(@@ft_max_word_len));
@@ -3388,7 +3394,7 @@ create table t1 as select concat('a'='a' IS TRUE) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a'='a' IS NOT TRUE));
@@ -3398,7 +3404,7 @@ create table t1 as select concat('a'='a' IS NOT TRUE) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(NOT 'a'='a'));
@@ -3408,7 +3414,7 @@ create table t1 as select concat(NOT 'a'='a') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NULL));
@@ -3418,7 +3424,7 @@ create table t1 as select concat('a' IS NULL) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' IS NOT NULL));
@@ -3428,7 +3434,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' rlike 'a'));
@@ -3438,7 +3444,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(strcmp('a','b')));
@@ -3448,7 +3454,7 @@ create table t1 as select concat(strcmp('a','b')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' like 'a'));
@@ -3458,7 +3464,7 @@ create table t1 as select concat('a' like 'b') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' between 'b' and 'c'));
@@ -3468,7 +3474,7 @@ create table t1 as select concat('a' between 'b' and 'c') as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat('a' in ('a','b')));
@@ -3478,7 +3484,7 @@ create table t1 as select concat('a' in ('a','b')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(interval(23, 1, 15, 17, 30, 44, 200)));
@@ -3488,7 +3494,7 @@ create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a varchar(10), fulltext key(a));
@@ -3520,7 +3526,7 @@ create table t1 as select concat(ifnull(1,1)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(ifnull(1.1,1.1)));
@@ -3530,7 +3536,7 @@ create table t1 as select concat(ifnull(1.1,1.1)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(if(1,'b',1));
@@ -3560,7 +3566,7 @@ create table t1 as select concat(if(1,1,1)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(nullif(1,2)));
@@ -3715,7 +3721,7 @@ create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` longtext CHARACTER SET utf8
+ `c1` longtext CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(period_add(200902, 2)));
@@ -3725,12 +3731,13 @@ create table t1 as select concat(period_add(200902, 2)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(6) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(6) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(period_diff(200902, 200802)));
hex(concat(period_diff(200902, 200802)))
3132
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t1 as select concat(period_add(200902, 200802)) as c1;
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
@@ -3934,21 +3941,21 @@ create table t1 as select concat(curdate()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(utc_date()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(curtime()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select repeat('a',20) as c1 limit 0;
@@ -3964,7 +3971,7 @@ create table t1 as select concat(utc_time()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(sec_to_time(2378)));
@@ -4057,21 +4064,21 @@ create table t1 as select concat(now()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(19) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(utc_timestamp()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(19) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select concat(sysdate()) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(19) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(addtime('00:00:00','11:22:33')));
@@ -4111,7 +4118,7 @@ create table t1 as select export_set(1,2,3,4,2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(127) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(127) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(insert(1133,3,0,22));
@@ -4121,7 +4128,7 @@ create table t1 as select insert(1133,3,0,22) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(6) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(6) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lcase(123));
@@ -4131,7 +4138,7 @@ create table t1 as select lcase(123) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(left(123,1));
@@ -4141,7 +4148,7 @@ create table t1 as select left(123,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lower(123));
@@ -4151,7 +4158,7 @@ create table t1 as select lower(123) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(3) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(lpad(1,2,0));
@@ -4161,7 +4168,7 @@ create table t1 as select lpad(1,2,0) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ltrim(1));
@@ -4171,7 +4178,7 @@ create table t1 as select ltrim(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(mid(1,1,1));
@@ -4181,7 +4188,7 @@ create table t1 as select mid(1,1,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(repeat(1,2));
@@ -4191,7 +4198,7 @@ create table t1 as select repeat(1,2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(replace(1,1,2));
@@ -4201,7 +4208,7 @@ create table t1 as select replace(1,1,2) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(reverse(12));
@@ -4211,7 +4218,7 @@ create table t1 as select reverse(12) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(right(123,1));
@@ -4221,7 +4228,7 @@ create table t1 as select right(123,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rpad(1,2,0));
@@ -4231,7 +4238,7 @@ create table t1 as select rpad(1,2,0) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(2) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(rtrim(1));
@@ -4241,7 +4248,7 @@ create table t1 as select rtrim(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(soundex(1));
@@ -4251,7 +4258,7 @@ create table t1 as select soundex(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(substring(1,1,1));
@@ -4261,7 +4268,7 @@ create table t1 as select substring(1,1,1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(trim(1));
@@ -4271,7 +4278,7 @@ create table t1 as select trim(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(ucase(1));
@@ -4281,7 +4288,7 @@ create table t1 as select ucase(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(upper(1));
@@ -4291,14 +4298,14 @@ create table t1 as select upper(1) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(1) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 as select repeat(' ', 64) as a limit 0;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(64) CHARACTER SET utf8 NOT NULL
+ `a` varchar(64) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ("1.1"), ("2.1");
select a, hex(a) from t1;
@@ -4548,7 +4555,7 @@ create table t2 as select concat(a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `concat(a)` varchar(19) CHARACTER SET utf8 NOT NULL
+ `concat(a)` varchar(19) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a date);
@@ -4847,7 +4854,7 @@ insert into t1 values ('2001-02-03 04:05:06');
create view v1(a) as select concat(a) from t1;
show columns from v1;
Field Type Null Key Default Extra
-a varchar(19) NO
+a varchar(19) YES NULL
select hex(a) from v1;
hex(a)
303030302D30302D30302030303A30303A3030
@@ -5072,7 +5079,7 @@ GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END)
1234567
SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def COALESCE(a,'') 253 27 7 Y 0 31 33
+def COALESCE(a,'') 253 27 7 Y 0 39 33
COALESCE(a,'')
1234567
# All columns must be VARCHAR(9) with the same length:
@@ -5098,14 +5105,14 @@ CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET utf8 NOT NULL
+ `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET utf8 NOT NULL
+ `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
@@ -5126,35 +5133,35 @@ CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `REPEAT(1,2)` varchar(2) CHARACTER SET utf8 NOT NULL
+ `REPEAT(1,2)` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `LEFT(123,2)` varchar(2) CHARACTER SET utf8 NOT NULL
+ `LEFT(123,2)` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `RIGHT(123,2)` varchar(2) CHARACTER SET utf8 NOT NULL
+ `RIGHT(123,2)` varchar(2) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `LTRIM(123)` varchar(3) CHARACTER SET utf8 NOT NULL
+ `LTRIM(123)` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `RTRIM(123)` varchar(3) CHARACTER SET utf8 NOT NULL
+ `RTRIM(123)` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
@@ -5168,35 +5175,35 @@ CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `REPLACE(111,2,3)` varchar(3) CHARACTER SET utf8 NOT NULL
+ `REPLACE(111,2,3)` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET utf8 NOT NULL
+ `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET utf8 NOT NULL
+ `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `SOUNDEX(1)` varchar(4) CHARACTER SET utf8 NOT NULL
+ `SOUNDEX(1)` varchar(4) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8);
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET utf8 NOT NULL
+ `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
@@ -5320,11 +5327,11 @@ NULL
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
-Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
+Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()`
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select concat(convert(v_LastPaymentDate@0 using utf8),now()) AS `CONCAT(v_LastPaymentDate, NOW())`
+Note 1003 select concat(convert(v_LastPaymentDate@0 using utf8),current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())`
DROP PROCEDURE p1;
#
# Bug#52159 returning time type from function and empty left join causes debug assertion
@@ -5411,17 +5418,13 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
GROUP BY id
ORDER BY l DESC;
id l
-a 1024
-Warnings:
-Warning 1260 Row 2 was cut by GROUP_CONCAT()
+a 1401
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;
id l
-a 1024
-Warnings:
-Warning 1260 Row 2 was cut by GROUP_CONCAT()
+a 1401
#
# MDEV-7814 Assertion `args[0]->fixed' fails in Item_func_conv_charset::Item_func_conv_charset
#
@@ -5444,7 +5447,7 @@ ADD KEY(ch);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ch` varchar(60) CHARACTER SET utf8 NOT NULL,
+ `ch` varchar(60) CHARACTER SET utf8 DEFAULT NULL,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
KEY `ch` (`ch`)
@@ -5532,7 +5535,7 @@ aÖ€
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index
+1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
@@ -5559,7 +5562,7 @@ Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index
+1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
@@ -5592,7 +5595,7 @@ z
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index
+1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
@@ -5603,7 +5606,7 @@ Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index
+1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
@@ -5688,7 +5691,7 @@ ADD KEY(ch);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ch` varchar(60) CHARACTER SET utf8 NOT NULL,
+ `ch` varchar(60) CHARACTER SET utf8 DEFAULT NULL,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
KEY `ch` (`ch`)
@@ -5776,7 +5779,7 @@ aÖ€
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index
+1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch;
@@ -5803,7 +5806,7 @@ Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index
+1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch;
@@ -5836,7 +5839,7 @@ z
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index
+1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch;
@@ -5847,7 +5850,7 @@ Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1
EXPLAIN
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index
+1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1
SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch;
@@ -5932,7 +5935,7 @@ ADD KEY(ch);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ch` varchar(60) CHARACTER SET utf8 NOT NULL,
+ `ch` varchar(60) CHARACTER SET utf8 DEFAULT NULL,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
KEY `ch` (`ch`)
@@ -6201,6 +6204,7 @@ INSERT INTO t1 VALUES (REPEAT('A',100));
SELECT OCTET_LENGTH(a) FROM t1;
OCTET_LENGTH(a)
300
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t1 MODIFY a TINYTEXT CHARACTER SET utf8;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -6254,7 +6258,7 @@ CREATE TABLE t1 (i INT, KEY(i));
INSERT INTO t1 VALUES (20081205),(20050327);
SELECT HEX(i), HEX(CHAR(i USING utf8)) FROM t1;
HEX(i) HEX(CHAR(i USING utf8))
-131F197 0131
+131F197 NULL
1326A35 01326A35
Warnings:
Warning 1300 Invalid utf8 character string: 'F197'
@@ -6276,6 +6280,7 @@ DROP TABLE t1;
#
# MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535
#
+SET sql_mode='';
CREATE TABLE t1 (c1 VARCHAR(21844) CHARACTER SET utf8);
DESCRIBE t1;
Field Type Null Key Default Extra
@@ -6295,6 +6300,7 @@ DESCRIBE t1;
Field Type Null Key Default Extra
c1 mediumtext YES NULL
DROP TABLE t1;
+SET sql_mode=default;
#
# End of 5.5 tests
#
@@ -6332,7 +6338,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET utf8 NOT NULL
+ `a` varchar(5) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -6576,7 +6582,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL
+ `a` varchar(5) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -6828,7 +6834,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -6845,13 +6851,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a '))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a '
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -6868,13 +6874,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -6891,13 +6897,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -6914,7 +6920,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
#
# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
@@ -6923,7 +6929,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL
+ `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
@@ -6936,7 +6942,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a '))))
+Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a '
DROP TABLE t1;
#
# End of MDEV-8694
@@ -6949,7 +6955,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
@@ -6966,13 +6972,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a '))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a '
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
@@ -6989,13 +6995,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
@@ -7012,13 +7018,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
@@ -7035,7 +7041,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`)))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
#
# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
@@ -7044,7 +7050,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET utf8 NOT NULL
+ `a` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('a'),('a ');
SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
@@ -7057,7 +7063,7 @@ EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((not((`test`.`t1`.`a` like 'a '))) and (`test`.`t1`.`a` = 'a'))
+Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` not like 'a ' and `test`.`t1`.`a` = 'a'
DROP TABLE t1;
#
# End of MDEV-8694
@@ -7069,7 +7075,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('ae'),('ä');
SELECT * FROM t1 WHERE c1='ä';
@@ -7084,7 +7090,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((`test`.`t1`.`c1` = 'ä') and (`test`.`t1`.`c1` like 'ae'))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where `test`.`t1`.`c1` = 'ä' and `test`.`t1`.`c1` like 'ae'
SELECT * FROM t1 WHERE CONCAT(c1)='ä';
c1
ä
@@ -7097,7 +7103,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae'
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'ä') and (concat(`test`.`t1`.`c1`) like 'ae'))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'ä' and concat(`test`.`t1`.`c1`) like 'ae'
DROP TABLE IF EXISTS t1;
#
# MDEV-6666 Malformed result for CONCAT(utf8_column, binary_string)
@@ -7200,6 +7206,7 @@ SELECT _utf8 0x7E, _utf8 X'7E', _utf8 B'01111110';
_utf8 0x7E _utf8 X'7E' _utf8 B'01111110'
~ ~ ~
# Start of ctype_unescape.inc
+SET sql_mode = '';
SET @query=_binary'SELECT CHARSET(\'test\'),@@character_set_client,@@character_set_connection';
PREPARE stmt FROM @query;
EXECUTE stmt;
@@ -10262,6 +10269,7 @@ DROP FUNCTION wellformedness;
DROP FUNCTION mysql_real_escape_string_generated;
DROP FUNCTION iswellformed;
DROP TABLE allbytes;
+SET sql_mode = DEFAULT;
# End of ctype_backslash.inc
#
# MDEV-12681 Wrong VIEW results for CHAR(0xDF USING latin1)
@@ -10319,7 +10327,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,a)=(10,'1e1');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 10) and (`test`.`t1`.`a` = '1e1'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 10 and `test`.`t1`.`a` = '1e1'
DROP TABLE t1;
#
# MDEV-8688 Wrong result for SELECT..WHERE varchar_column IN (1,2,3) AND varchar_column=' 1';
@@ -10346,12 +10354,12 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '1ë1') and (`test`.`t1`.`a` in (1,2)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '1ë1' and `test`.`t1`.`a` in (1,2)
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,'x') AND a='1ë1';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '1ë1') and (`test`.`t1`.`a` in (1,2,'x')))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '1ë1' and `test`.`t1`.`a` in (1,2,'x')
DROP TABLE IF EXISTS t1;
#
# MDEV-8816 Equal field propagation is not applied for WHERE varbinary_column>=_utf8'a' COLLATE utf8_swedish_ci AND varbinary_column='A';
@@ -10366,7 +10374,7 @@ SELECT * FROM t1 WHERE c>=_utf8'a' COLLATE utf8_general_ci AND c='A';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`c` = 'A')
+Note 1003 select `test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`c` = 'A'
DROP TABLE t1;
#
# MDEV-7231 Field ROUTINE_DEFINITION in INFORMATION_SCHEMA.`ROUTINES` contains broken procedure body when used shielding quotes inside.
@@ -10550,3 +10558,696 @@ CONVERT(1, CHAR) IN ('100', '10', '1')
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9824 LOAD DATA does not work with multi-byte strings in LINES TERMINATED BY when IGNORE is specified
+#
+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 'ёё';
+Warnings:
+Warning 1638 Non-ASCII separator arguments are not fully supported
+SELECT c1 FROM t1;
+c1
+a
+b
+c
+DELETE FROM t1;
+LOAD DATA INFILE '../../std_data/loaddata/mdev9824.txt' INTO TABLE t1 CHARACTER SET utf8 LINES TERMINATED BY 'ёё' IGNORE 1 LINES;
+Warnings:
+Warning 1638 Non-ASCII separator arguments are not fully supported
+SELECT c1 FROM t1 ORDER BY c1;
+c1
+b
+c
+DROP TABLE t1;
+#
+# MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
+#
+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;
+Warnings:
+Warning 1366 Incorrect string value: '\xD0' for column 'a' at row 1
+Warning 1366 Incorrect string value: '\xE1\x80' for column 'a' at row 3
+Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 5
+Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column 'a' at row 7
+Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 8
+SELECT HEX(a) FROM t1;
+HEX(a)
+3F
+78787831
+3F3F
+78787832
+3F3F3F
+78787833
+3F3F3F3F
+3F3F3F
+DROP TABLE t1;
+#
+# MDEV-9874 LOAD XML INFILE does not handle well broken multi-byte characters
+#
+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>';
+Warnings:
+Warning 1366 Incorrect string value: '\xD0' for column 'a' at row 1
+SELECT HEX(a) FROM t1;
+HEX(a)
+613F
+DROP TABLE t1;
+#
+# MDEV-10134 Add full support for DEFAULT
+#
+SET NAMES latin1;
+CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß'));
+SET NAMES utf8;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(30) DEFAULT concat('ß')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+SELECT HEX(a),a FROM t1;
+HEX(a) a
+C39F ß
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(30) DEFAULT concat('ß'),
+ `b` varchar(30) DEFAULT concat('ß'),
+ `c` varchar(30) DEFAULT concat('ß')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DELETE FROM t1;
+INSERT INTO t1 VALUES();
+SELECT * FROM t1;
+a b c
+ß ß ß
+SET NAMES latin1;
+DELETE FROM t1;
+INSERT INTO t1 VALUES();
+SET NAMES utf8;
+SELECT * FROM t1;
+a b c
+ß ß ß
+DROP TABLE t1;
+SET NAMES latin1;
+CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 DEFAULT CONCAT('ß'));
+SET NAMES utf8;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(30) CHARACTER SET utf8 DEFAULT concat('ß')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+SELECT HEX(a), a FROM t1;
+HEX(a) a
+C383C5B8 ß
+DROP TABLE t1;
+SET NAMES utf8;
+CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß'));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(30) DEFAULT concat('ß')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+SELECT HEX(a) FROM t1;
+HEX(a)
+DF
+DROP TABLE t1;
+SET NAMES utf8;
+CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 DEFAULT CONCAT('ß'));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(30) CHARACTER SET utf8 DEFAULT concat('ß')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+SELECT HEX(a) FROM t1;
+HEX(a)
+C39F
+DROP TABLE t1;
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf8_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0041000000000000000000000000000000000000
+0041002000200000000000000000000000000000
+0020004100000000000000000000000000000000
+0020004100200000000000000000000000000000
+0041002000200020000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf8_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0041000000000000000000000000000000000000
+0041002000200000000000000000000000000000
+0020004100000000000000000000000000000000
+0020004100200000000000000000000000000000
+0041002000200020000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf8_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0061000000000000000000000000000000000000
+0061002000200000000000000000000000000000
+0020006100000000000000000000000000000000
+0020006100200000000000000000000000000000
+0061002000200020000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf8_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0061000000000000000000000000000000000000
+0061002000200000000000000000000000000000
+0020006100000000000000000000000000000000
+0020006100200000000000000000000000000000
+0061002000200020000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_utf8_uca.result b/mysql-test/r/ctype_utf8_uca.result
new file mode 100644
index 00000000000..23e9802b61a
--- /dev/null
+++ b/mysql-test/r/ctype_utf8_uca.result
@@ -0,0 +1,589 @@
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-10877 xxx_unicode_nopad_ci collations
+#
+SET NAMES utf8;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_unicode_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf8_unicode_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_unicode_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_unicode_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_unicode_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0E33020002000200020002000200020002000200
+0E33020902090200020002000200020002000200
+02090E3302000200020002000200020002000200
+02090E3302090200020002000200020002000200
+0E33020902090209020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf8_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf8_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_unicode_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_unicode_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_unicode_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_unicode_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_unicode_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf8_unicode_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_unicode_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_unicode_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_unicode_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0E33020002000200020002000200020002000200
+0E33020902090200020002000200020002000200
+02090E3302000200020002000200020002000200
+02090E3302090200020002000200020002000200
+0E33020902090209020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf8_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf8_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf8_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf8_unicode_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_unicode_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_unicode_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_unicode_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_unicode_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_unicode_520_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf8_unicode_520_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_unicode_520_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_unicode_520_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_unicode_520_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+120F020002000200020002000200020002000200
+120F020A020A0200020002000200020002000200
+020A120F02000200020002000200020002000200
+020A120F020A0200020002000200020002000200
+120F020A020A020A020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf8_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf8_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_unicode_520_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_unicode_520_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_unicode_520_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_unicode_520_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_unicode_520_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf8_unicode_520_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_520_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_unicode_520_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_unicode_520_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_unicode_520_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+120F020002000200020002000200020002000200
+120F020A020A0200020002000200020002000200
+020A120F02000200020002000200020002000200
+020A120F020A0200020002000200020002000200
+120F020A020A020A020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf8_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf8_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf8_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf8_unicode_520_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_unicode_520_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_unicode_520_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_unicode_520_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_unicode_520_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET NAMES utf8 COLLATE utf8_unicode_nopad_ci;
+#
+# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
+#
+CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
+ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci DEFAULT NULL,
+ `b` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('111', '111');
+INSERT INTO t1 VALUES ('222', '222');
+INSERT INTO t1 VALUES ('333', '333');
+INSERT INTO t1 VALUES ('444', '444');
+SELECT * FROM t1 WHERE a LIKE '111%';
+a b
+111 111
+SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
+a b
+111 111
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result
index 904f432af20..7e5e99354ea 100644
--- a/mysql-test/r/ctype_utf8mb4.result
+++ b/mysql-test/r/ctype_utf8mb4.result
@@ -157,7 +157,7 @@ drop table t1;
set LC_TIME_NAMES='en_US';
set names koi8r;
create table t1 (s1 char(1) character set utf8mb4);
-insert into t1 values (_koi8r'ÁÂ');
+insert ignore into t1 values (_koi8r'ÁÂ');
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
@@ -165,19 +165,19 @@ s1 hex(s1) char_length(s1) octet_length(s1)
Á D0B0 1 2
drop table t1;
create table t1 (s1 tinytext character set utf8mb4);
-insert into t1 select repeat('a',300);
+insert ignore into t1 select repeat('a',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ñ',300);
+insert ignore into t1 select repeat('Ñ',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('aÑ',300);
+insert ignore into t1 select repeat('aÑ',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ña',300);
+insert ignore into t1 select repeat('Ña',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('ÑÑ',300);
+insert ignore into t1 select repeat('ÑÑ',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
select hex(s1) from t1;
@@ -196,19 +196,19 @@ length(s1) char_length(s1)
254 127
drop table t1;
create table t1 (s1 text character set utf8mb4);
-insert into t1 select repeat('a',66000);
+insert ignore into t1 select repeat('a',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ñ',66000);
+insert ignore into t1 select repeat('Ñ',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('aÑ',66000);
+insert ignore into t1 select repeat('aÑ',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ña',66000);
+insert ignore into t1 select repeat('Ña',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('ÑÑ',66000);
+insert ignore into t1 select repeat('ÑÑ',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
select length(s1),char_length(s1) from t1;
@@ -220,7 +220,7 @@ length(s1) char_length(s1)
65534 32767
drop table t1;
create table t1 (s1 char(10) character set utf8mb4);
-insert into t1 values (0x41FF);
+insert ignore into t1 values (0x41FF);
Warnings:
Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
select hex(s1) from t1;
@@ -228,7 +228,7 @@ hex(s1)
413F
drop table t1;
create table t1 (s1 varchar(10) character set utf8mb4);
-insert into t1 values (0x41FF);
+insert ignore into t1 values (0x41FF);
Warnings:
Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
select hex(s1) from t1;
@@ -236,7 +236,7 @@ hex(s1)
413F
drop table t1;
create table t1 (s1 text character set utf8mb4);
-insert into t1 values (0x41FF);
+insert ignore into t1 values (0x41FF);
Warnings:
Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
select hex(s1) from t1;
@@ -901,8 +901,8 @@ create table t2 select concat(a,_utf8mb4'') as a, concat(b,_utf8mb4'')as b from
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL,
- `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL
+ `a` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL,
+ `b` varchar(15) CHARACTER SET utf8mb4 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2;
drop table t1;
@@ -1126,7 +1126,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL,
+ `a` varchar(1) CHARACTER SET utf8mb4 DEFAULT NULL,
`b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
@@ -1233,7 +1233,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL
+ `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84);
INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080);
@@ -1408,6 +1408,7 @@ ERR Имри.Ðфимим.Ðеимимримдмримрмрирор имримÑ
DROP TABLE t1,t2;
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;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1888,24 +1889,28 @@ insert into t1 (a) values ('abcdefghijklmnopqrstuvwxyz');
select * from t1;
a
abcdefghijklmnopqrstuvwxyz
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a varchar(20) character set utf8mb4 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
abcdefghijklmnopqrst
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a char(15) character set utf8mb4 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
abcdefghijklmno
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a char(10) character set utf8mb4 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
abcdefghij
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a varchar(5) character set utf8mb4 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1917,6 +1922,7 @@ 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;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1939,7 +1945,7 @@ char(53647 using utf8mb4)
Ñ
select char(0xff,0x8f using utf8mb4);
char(0xff,0x8f using utf8mb4)
-
+NULL
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF8F'
select convert(char(0xff,0x8f) using utf8mb4);
@@ -2153,7 +2159,7 @@ ERROR HY000: Invalid utf8mb4 character string: 'FF'
set sql_mode=default;
select hex(char(0xFF using utf8mb4));
hex(char(0xFF using utf8mb4))
-
+NULL
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF'
select hex(convert(0xFF using utf8mb4));
@@ -2320,19 +2326,19 @@ create table t1 (utf8mb4 char(1) character set utf8mb4);
Testing [F0][90..BF][80..BF][80..BF]
insert into t1 values (0xF0908080);
insert into t1 values (0xF0BFBFBF);
-insert into t1 values (0xF08F8080);
+insert ignore into t1 values (0xF08F8080);
Warnings:
Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column 'utf8mb4' at row 1
-select hex(utf8mb4) from t1;
+select hex(utf8mb4) from t1 order by binary utf8mb4;
hex(utf8mb4)
+3F
F0908080
F0BFBFBF
-3F
delete from t1;
Testing [F2..F3][80..BF][80..BF][80..BF]
insert into t1 values (0xF2808080);
insert into t1 values (0xF2BFBFBF);
-select hex(utf8mb4) from t1;
+select hex(utf8mb4) from t1 order by binary utf8mb4;
hex(utf8mb4)
F2808080
F2BFBFBF
@@ -2340,14 +2346,14 @@ delete from t1;
Testing [F4][80..8F][80..BF][80..BF]
insert into t1 values (0xF4808080);
insert into t1 values (0xF48F8080);
-insert into t1 values (0xF4908080);
+insert ignore into t1 values (0xF4908080);
Warnings:
Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column 'utf8mb4' at row 1
-select hex(utf8mb4) from t1;
+select hex(utf8mb4) from t1 order by binary utf8mb4;
hex(utf8mb4)
+3F
F4808080
F48F8080
-3F
drop table t1;
#
# Check strnxfrm() with odd length
@@ -2381,14 +2387,14 @@ PRIMARY KEY (clipid),
KEY tape(Tape(255))
) CHARACTER SET=utf8mb4;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
ALTER TABLE t1 ADD mos TINYINT DEFAULT 0 AFTER clipid;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`clipid` int(11) NOT NULL,
- `mos` tinyint(4) DEFAULT '0',
- `Tape` tinytext,
+ `mos` tinyint(4) DEFAULT 0,
+ `Tape` tinytext DEFAULT NULL,
PRIMARY KEY (`clipid`),
KEY `tape` (`Tape`(250))
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4
@@ -2418,7 +2424,7 @@ INSERT INTO t1 VALUES (119040, x'f09d8480'),
(917999, x'f3a087af');
INSERT INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480');
INSERT INTO t1 VALUES (65131, x'efb9abf09d849ef09d859ef09d859ef09d8480f09d859fefb9abefb9abf09d85a0efb9ab');
-INSERT INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480f09d85a0');
+INSERT IGNORE INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480f09d85a0');
Warnings:
Warning 1265 Data truncated for column 'utf8mb4_encoding' at row 1
SELECT u_decimal, hex(utf8mb4_encoding) FROM t1 ORDER BY utf8mb4_encoding COLLATE utf8mb4_general_ci, BINARY utf8mb4_encoding;
@@ -2434,7 +2440,7 @@ u_decimal hex(utf8mb4_encoding)
1114111 F48FBFBF
119070 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480
119070 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480
-INSERT INTO t1 VALUES (1114111, x'f5808080');
+INSERT IGNORE INTO t1 VALUES (1114111, x'f5808080');
Warnings:
Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column 'utf8mb4_encoding' at row 1
SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
@@ -2448,14 +2454,14 @@ utf8mb3_encoding VARCHAR(10) NOT NULL
) CHARACTER SET utf8mb3;
INSERT INTO t2 VALUES (42856, x'ea9da8');
INSERT INTO t2 VALUES (65131, x'efb9ab');
-INSERT INTO t2 VALUES (1114111, x'f48fbfbf');
+INSERT IGNORE INTO t2 VALUES (1114111, x'f48fbfbf');
Warnings:
Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column 'utf8mb3_encoding' at row 1
SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
table_name= 't2' AND column_name= 'utf8mb3_encoding';
character_maximum_length character_octet_length
10 30
-UPDATE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856;
+UPDATE IGNORE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856;
Warnings:
Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column 'utf8mb3_encoding' at row 1
UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856;
@@ -2515,6 +2521,7 @@ SELECT count(*) FROM t1, t2
WHERE t1.utf8mb4_encoding > t2.utf8mb3_encoding;
count(*)
33
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9D\x84\x80' for column 'utf8mb4_encoding' at row 1
@@ -2667,7 +2674,7 @@ Table Create Table
t3 CREATE TEMPORARY TABLE `t3` (
`utf8mb4` varchar(10) CHARACTER SET utf8mb4 NOT NULL,
`utf8mb3` varchar(10) CHARACTER SET utf8 NOT NULL,
- `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 NOT NULL
+ `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TEMPORARY TABLE t3;
SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3;
@@ -2700,6 +2707,7 @@ subject varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
p VARCHAR(15) CHARACTER SET utf8
) DEFAULT CHARSET=latin1;
ALTER TABLE t1 ADD INDEX (subject);
+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,
@@ -2817,6 +2825,7 @@ INSERT INTO t1 VALUES (REPEAT('😎',100));
SELECT OCTET_LENGTH(a) FROM t1;
OCTET_LENGTH(a)
400
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t1 MODIFY a TINYTEXT CHARACTER SET utf8mb4;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -2915,7 +2924,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL
+ `a` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -3159,7 +3168,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL
+ `a` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
@@ -3416,7 +3425,7 @@ CREATE TABLE t1 (
a VARCHAR(32) CHARACTER SET utf8mb4,
b VARCHAR(32) CHARACTER SET utf8
);
-INSERT INTO t1 SELECT 'a 😠b', 'a 😠b';
+INSERT IGNORE INTO t1 SELECT 'a 😠b', 'a 😠b';
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column 'a' at row 1
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column 'b' at row 1
@@ -3436,7 +3445,7 @@ CREATE TABLE t1 (
a VARCHAR(32) CHARACTER SET utf8mb4,
b VARCHAR(32) CHARACTER SET utf8
);
-INSERT INTO t1 SELECT 'a 😠b', 'a 😠b';
+INSERT IGNORE INTO t1 SELECT 'a 😠b', 'a 😠b';
Warnings:
Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column 'b' at row 1
SELECT * FROM t1;
@@ -3464,8 +3473,8 @@ COLUMN_JSON(COLUMN_CREATE('b',1));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `COLUMN_LIST(COLUMN_CREATE('a',1))` longtext CHARACTER SET utf8mb4,
- `COLUMN_JSON(COLUMN_CREATE('b',1))` longtext CHARACTER SET utf8mb4
+ `COLUMN_LIST(COLUMN_CREATE('a',1))` longtext CHARACTER SET utf8mb4 DEFAULT NULL,
+ `COLUMN_JSON(COLUMN_CREATE('b',1))` longtext CHARACTER SET utf8mb4 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
SET NAMES default;
@@ -3498,3 +3507,609 @@ DROP FUNCTION f1;
#
# End of 10.1 tests
#
+#
+# End of 10.2 tests
+#
+#
+# MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
+#
+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;
+Warnings:
+Warning 1366 Incorrect string value: '\xD0' for column 'a' at row 1
+Warning 1366 Incorrect string value: '\xE1\x80' for column 'a' at row 3
+Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 5
+Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 8
+SELECT HEX(a) FROM t1;
+HEX(a)
+3F
+78787831
+3F3F
+78787832
+3F3F3F
+78787833
+F09F988E
+3F3F3F
+DROP TABLE t1;
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf8mb4_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8mb4_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8mb4_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0041000000000000000000000000000000000000
+0041002000200000000000000000000000000000
+0020004100000000000000000000000000000000
+0020004100200000000000000000000000000000
+0041002000200020000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf8mb4_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf8mb4_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8mb4_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_general_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf8mb4_general_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8mb4_general_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_general_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8mb4_general_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0041000000000000000000000000000000000000
+0041002000200000000000000000000000000000
+0020004100000000000000000000000000000000
+0020004100200000000000000000000000000000
+0041002000200020000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf8mb4_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf8mb4_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf8mb4_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf8mb4_general_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_general_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_general_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8mb4_general_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_general_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_general_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf8mb4_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8mb4_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8mb4_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+000061000000000000000000000000000000000000000000000000000000
+000061000020000020000000000000000000000000000000000000000000
+000020000061000000000000000000000000000000000000000000000000
+000020000061000020000000000000000000000000000000000000000000
+000061000020000020000020000000000000000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf8mb4_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf8mb4_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8mb4_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_nopad_bin';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf8mb4_nopad_bin NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_nopad_bin
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8mb4_nopad_bin';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_nopad_bin';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8mb4_nopad_bin';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+000061000000000000000000000000000000000000000000000000000000
+000061000020000020000000000000000000000000000000000000000000
+000020000061000000000000000000000000000000000000000000000000
+000020000061000020000000000000000000000000000000000000000000
+000061000020000020000020000000000000000000000000000000000000
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf8mb4_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf8mb4_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf8mb4_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf8mb4_nopad_bin', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_bin';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_nopad_bin';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8mb4_nopad_bin';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_bin';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_nopad_bin';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+#
+# MDEV-10867 PREPARE..EXECUTE is not consistent about non-ASCII characters
+#
+SET NAMES utf8mb4;
+SELECT '😎' AS c;
+c
+😎
+SET @src='SELECT ''😎'' AS c';
+PREPARE stmt FROM @src;
+EXECUTE stmt;
+c
+😎
+EXECUTE IMMEDIATE @src;
+c
+😎
+PREPARE stmt FROM 'SELECT ''😎'' AS c';
+EXECUTE stmt;
+c
+😎
+EXECUTE IMMEDIATE 'SELECT ''😎'' AS c';
+c
+😎
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_utf8mb4_heap.result b/mysql-test/r/ctype_utf8mb4_heap.result
index 46b0cc3789f..d82ed89be9c 100644
--- a/mysql-test/r/ctype_utf8mb4_heap.result
+++ b/mysql-test/r/ctype_utf8mb4_heap.result
@@ -157,7 +157,7 @@ drop table t1;
set LC_TIME_NAMES='en_US';
set names koi8r;
create table t1 (s1 char(1) character set utf8mb4) engine heap;
-insert into t1 values (_koi8r'ÁÂ');
+insert ignore into t1 values (_koi8r'ÁÂ');
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
@@ -165,19 +165,19 @@ s1 hex(s1) char_length(s1) octet_length(s1)
Á D0B0 1 2
drop table t1;
create table t1 (s1 varchar(255) character set utf8mb4) engine heap;
-insert into t1 select repeat('a',300);
+insert ignore into t1 select repeat('a',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ñ',300);
+insert ignore into t1 select repeat('Ñ',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('aÑ',300);
+insert ignore into t1 select repeat('aÑ',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ña',300);
+insert ignore into t1 select repeat('Ña',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('ÑÑ',300);
+insert ignore into t1 select repeat('ÑÑ',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
select hex(s1) from t1;
@@ -196,19 +196,19 @@ length(s1) char_length(s1)
510 255
drop table t1;
create table t1 (s1 varchar(255) character set utf8mb4) engine heap;
-insert into t1 select repeat('a',66000);
+insert ignore into t1 select repeat('a',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ñ',66000);
+insert ignore into t1 select repeat('Ñ',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('aÑ',66000);
+insert ignore into t1 select repeat('aÑ',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ña',66000);
+insert ignore into t1 select repeat('Ña',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('ÑÑ',66000);
+insert ignore into t1 select repeat('ÑÑ',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
select length(s1),char_length(s1) from t1;
@@ -220,7 +220,7 @@ length(s1) char_length(s1)
510 255
drop table t1;
create table t1 (s1 char(10) character set utf8mb4) engine heap;
-insert into t1 values (0x41FF);
+insert ignore into t1 values (0x41FF);
Warnings:
Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
select hex(s1) from t1;
@@ -228,7 +228,7 @@ hex(s1)
413F
drop table t1;
create table t1 (s1 varchar(10) character set utf8mb4) engine heap;
-insert into t1 values (0x41FF);
+insert ignore into t1 values (0x41FF);
Warnings:
Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
select hex(s1) from t1;
@@ -840,8 +840,8 @@ create table t2 engine heap select concat(a,_utf8mb4'') as a, concat(b,_utf8mb4'
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL,
- `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL
+ `a` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL,
+ `b` varchar(15) CHARACTER SET utf8mb4 DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
drop table t2;
drop table t1;
@@ -1065,7 +1065,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL,
+ `a` varchar(1) CHARACTER SET utf8mb4 DEFAULT NULL,
`b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
@@ -1307,6 +1307,7 @@ ERR Имри.Ðфимим.Ðеимимримдмримрмрирор имримÑ
DROP TABLE t1,t2;
create table t1 (a char(20) character set utf8mb4) engine heap;
insert into t1 values ('123456'),('андрей');
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 modify a char(2) character set utf8mb4;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1720,24 +1721,28 @@ insert into t1 (a) values ('abcdefghijklmnopqrstuvwxyz');
select * from t1;
a
abcdefghijklmnopqrstuvwxyz
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a varchar(20) character set utf8mb4 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
abcdefghijklmnopqrst
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a char(15) character set utf8mb4 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
abcdefghijklmno
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a char(10) character set utf8mb4 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
abcdefghij
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a varchar(5) character set utf8mb4 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1749,6 +1754,7 @@ create table t1 (
a varchar(4000) not null
) default character set utf8mb4 engine heap;
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;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1771,7 +1777,7 @@ char(53647 using utf8mb4)
Ñ
select char(0xff,0x8f using utf8mb4);
char(0xff,0x8f using utf8mb4)
-
+NULL
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF8F'
select convert(char(0xff,0x8f) using utf8mb4);
@@ -1985,7 +1991,7 @@ ERROR HY000: Invalid utf8mb4 character string: 'FF'
set sql_mode=default;
select hex(char(0xFF using utf8mb4));
hex(char(0xFF using utf8mb4))
-
+NULL
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF'
select hex(convert(0xFF using utf8mb4));
@@ -2152,7 +2158,7 @@ create table t1 (utf8mb4 char(1) character set utf8mb4) engine heap;
Testing [F0][90..BF][80..BF][80..BF]
insert into t1 values (0xF0908080);
insert into t1 values (0xF0BFBFBF);
-insert into t1 values (0xF08F8080);
+insert ignore into t1 values (0xF08F8080);
Warnings:
Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column 'utf8mb4' at row 1
select hex(utf8mb4) from t1;
@@ -2172,7 +2178,7 @@ delete from t1;
Testing [F4][80..8F][80..BF][80..BF]
insert into t1 values (0xF4808080);
insert into t1 values (0xF48F8080);
-insert into t1 values (0xF4908080);
+insert ignore into t1 values (0xF4908080);
Warnings:
Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column 'utf8mb4' at row 1
select hex(utf8mb4) from t1;
@@ -2231,7 +2237,7 @@ INSERT INTO t1 VALUES (119040, x'f09d8480'),
(917999, x'f3a087af');
INSERT INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480');
INSERT INTO t1 VALUES (65131, x'efb9abf09d849ef09d859ef09d859ef09d8480f09d859fefb9abefb9abf09d85a0efb9ab');
-INSERT INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480f09d85a0');
+INSERT IGNORE INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480f09d85a0');
Warnings:
Warning 1265 Data truncated for column 'utf8mb4_encoding' at row 1
SELECT u_decimal, hex(utf8mb4_encoding) FROM t1 ORDER BY utf8mb4_encoding COLLATE utf8mb4_general_ci, BINARY utf8mb4_encoding;
@@ -2247,7 +2253,7 @@ u_decimal hex(utf8mb4_encoding)
120735 F09D9E9F
65131 EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9AB
917999 F3A087AF
-INSERT INTO t1 VALUES (1114111, x'f5808080');
+INSERT IGNORE INTO t1 VALUES (1114111, x'f5808080');
Warnings:
Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column 'utf8mb4_encoding' at row 1
SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
@@ -2261,14 +2267,14 @@ utf8mb3_encoding VARCHAR(10) NOT NULL
) CHARACTER SET utf8mb3 ENGINE heap;
INSERT INTO t2 VALUES (42856, x'ea9da8');
INSERT INTO t2 VALUES (65131, x'efb9ab');
-INSERT INTO t2 VALUES (1114111, x'f48fbfbf');
+INSERT IGNORE INTO t2 VALUES (1114111, x'f48fbfbf');
Warnings:
Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column 'utf8mb3_encoding' at row 1
SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
table_name= 't2' AND column_name= 'utf8mb3_encoding';
character_maximum_length character_octet_length
10 30
-UPDATE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856;
+UPDATE IGNORE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856;
Warnings:
Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column 'utf8mb3_encoding' at row 1
UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856;
@@ -2328,6 +2334,7 @@ SELECT count(*) FROM t1, t2
WHERE t1.utf8mb4_encoding > t2.utf8mb3_encoding;
count(*)
33
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
SHOW CREATE TABLE t1;
Table Create Table
@@ -2468,7 +2475,7 @@ Table Create Table
t3 CREATE TEMPORARY TABLE `t3` (
`utf8mb4` varchar(10) CHARACTER SET utf8mb4 NOT NULL,
`utf8mb3` varchar(10) CHARACTER SET utf8 NOT NULL,
- `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 NOT NULL
+ `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
DROP TEMPORARY TABLE t3;
SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3;
diff --git a/mysql-test/r/ctype_utf8mb4_innodb.result b/mysql-test/r/ctype_utf8mb4_innodb.result
index cfd9bf969ad..c444e872f98 100644
--- a/mysql-test/r/ctype_utf8mb4_innodb.result
+++ b/mysql-test/r/ctype_utf8mb4_innodb.result
@@ -157,7 +157,7 @@ drop table t1;
set LC_TIME_NAMES='en_US';
set names koi8r;
create table t1 (s1 char(1) character set utf8mb4) engine InnoDB;
-insert into t1 values (_koi8r'ÁÂ');
+insert ignore into t1 values (_koi8r'ÁÂ');
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
@@ -165,19 +165,19 @@ s1 hex(s1) char_length(s1) octet_length(s1)
Á D0B0 1 2
drop table t1;
create table t1 (s1 tinytext character set utf8mb4) engine InnoDB;
-insert into t1 select repeat('a',300);
+insert ignore into t1 select repeat('a',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ñ',300);
+insert ignore into t1 select repeat('Ñ',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('aÑ',300);
+insert ignore into t1 select repeat('aÑ',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ña',300);
+insert ignore into t1 select repeat('Ña',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('ÑÑ',300);
+insert ignore into t1 select repeat('ÑÑ',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
select hex(s1) from t1;
@@ -196,19 +196,19 @@ length(s1) char_length(s1)
255 255
drop table t1;
create table t1 (s1 text character set utf8mb4) engine InnoDB;
-insert into t1 select repeat('a',66000);
+insert ignore into t1 select repeat('a',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ñ',66000);
+insert ignore into t1 select repeat('Ñ',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('aÑ',66000);
+insert ignore into t1 select repeat('aÑ',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ña',66000);
+insert ignore into t1 select repeat('Ña',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('ÑÑ',66000);
+insert ignore into t1 select repeat('ÑÑ',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
select length(s1),char_length(s1) from t1;
@@ -220,7 +220,7 @@ length(s1) char_length(s1)
65535 65535
drop table t1;
create table t1 (s1 char(10) character set utf8mb4) engine InnoDB;
-insert into t1 values (0x41FF);
+insert ignore into t1 values (0x41FF);
Warnings:
Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
select hex(s1) from t1;
@@ -228,7 +228,7 @@ hex(s1)
413F
drop table t1;
create table t1 (s1 varchar(10) character set utf8mb4) engine InnoDB;
-insert into t1 values (0x41FF);
+insert ignore into t1 values (0x41FF);
Warnings:
Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
select hex(s1) from t1;
@@ -236,7 +236,7 @@ hex(s1)
413F
drop table t1;
create table t1 (s1 text character set utf8mb4) engine InnoDB;
-insert into t1 values (0x41FF);
+insert ignore into t1 values (0x41FF);
Warnings:
Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
select hex(s1) from t1;
@@ -901,8 +901,8 @@ create table t2 engine InnoDB select concat(a,_utf8mb4'') as a, concat(b,_utf8mb
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL,
- `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL
+ `a` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL,
+ `b` varchar(15) CHARACTER SET utf8mb4 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2;
drop table t1;
@@ -1126,7 +1126,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL,
+ `a` varchar(1) CHARACTER SET utf8mb4 DEFAULT NULL,
`b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
@@ -1368,6 +1368,7 @@ ERR Имри.Ðфимим.Ðеимимримдмримрмрирор имримÑ
DROP TABLE t1,t2;
create table t1 (a char(20) character set utf8mb4) engine InnoDB;
insert into t1 values ('123456'),('андрей');
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 modify a char(2) character set utf8mb4;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1848,24 +1849,28 @@ insert into t1 (a) values ('abcdefghijklmnopqrstuvwxyz');
select * from t1;
a
abcdefghijklmnopqrstuvwxyz
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a varchar(20) character set utf8mb4 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
abcdefghijklmnopqrst
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a char(15) character set utf8mb4 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
abcdefghijklmno
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a char(10) character set utf8mb4 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
abcdefghij
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a varchar(5) character set utf8mb4 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1877,6 +1882,7 @@ create table t1 (
a varchar(4000) not null
) default character set utf8mb4 engine InnoDB;
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;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1899,7 +1905,7 @@ char(53647 using utf8mb4)
Ñ
select char(0xff,0x8f using utf8mb4);
char(0xff,0x8f using utf8mb4)
-
+NULL
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF8F'
select convert(char(0xff,0x8f) using utf8mb4);
@@ -2113,7 +2119,7 @@ ERROR HY000: Invalid utf8mb4 character string: 'FF'
set sql_mode=default;
select hex(char(0xFF using utf8mb4));
hex(char(0xFF using utf8mb4))
-
+NULL
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF'
select hex(convert(0xFF using utf8mb4));
@@ -2280,7 +2286,7 @@ create table t1 (utf8mb4 char(1) character set utf8mb4) engine InnoDB;
Testing [F0][90..BF][80..BF][80..BF]
insert into t1 values (0xF0908080);
insert into t1 values (0xF0BFBFBF);
-insert into t1 values (0xF08F8080);
+insert ignore into t1 values (0xF08F8080);
Warnings:
Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column 'utf8mb4' at row 1
select hex(utf8mb4) from t1;
@@ -2300,7 +2306,7 @@ delete from t1;
Testing [F4][80..8F][80..BF][80..BF]
insert into t1 values (0xF4808080);
insert into t1 values (0xF48F8080);
-insert into t1 values (0xF4908080);
+insert ignore into t1 values (0xF4908080);
Warnings:
Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column 'utf8mb4' at row 1
select hex(utf8mb4) from t1;
@@ -2341,14 +2347,14 @@ PRIMARY KEY (clipid),
KEY tape(Tape(255))
) CHARACTER SET=utf8mb4 ENGINE InnoDB;
Warnings:
-Warning 1071 Specified key was too long; max key length is 767 bytes
+Note 1071 Specified key was too long; max key length is 767 bytes
ALTER TABLE t1 ADD mos TINYINT DEFAULT 0 AFTER clipid;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`clipid` int(11) NOT NULL,
- `mos` tinyint(4) DEFAULT '0',
- `Tape` tinytext,
+ `mos` tinyint(4) DEFAULT 0,
+ `Tape` tinytext DEFAULT NULL,
PRIMARY KEY (`clipid`),
KEY `tape` (`Tape`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
@@ -2378,7 +2384,7 @@ INSERT INTO t1 VALUES (119040, x'f09d8480'),
(917999, x'f3a087af');
INSERT INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480');
INSERT INTO t1 VALUES (65131, x'efb9abf09d849ef09d859ef09d859ef09d8480f09d859fefb9abefb9abf09d85a0efb9ab');
-INSERT INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480f09d85a0');
+INSERT IGNORE INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480f09d85a0');
Warnings:
Warning 1265 Data truncated for column 'utf8mb4_encoding' at row 1
SELECT u_decimal, hex(utf8mb4_encoding) FROM t1 ORDER BY utf8mb4_encoding COLLATE utf8mb4_general_ci, BINARY utf8mb4_encoding;
@@ -2394,7 +2400,7 @@ u_decimal hex(utf8mb4_encoding)
120735 F09D9E9F
65131 EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9AB
917999 F3A087AF
-INSERT INTO t1 VALUES (1114111, x'f5808080');
+INSERT IGNORE INTO t1 VALUES (1114111, x'f5808080');
Warnings:
Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column 'utf8mb4_encoding' at row 1
SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
@@ -2408,14 +2414,14 @@ utf8mb3_encoding VARCHAR(10) NOT NULL
) CHARACTER SET utf8mb3 ENGINE InnoDB;
INSERT INTO t2 VALUES (42856, x'ea9da8');
INSERT INTO t2 VALUES (65131, x'efb9ab');
-INSERT INTO t2 VALUES (1114111, x'f48fbfbf');
+INSERT IGNORE INTO t2 VALUES (1114111, x'f48fbfbf');
Warnings:
Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column 'utf8mb3_encoding' at row 1
SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
table_name= 't2' AND column_name= 'utf8mb3_encoding';
character_maximum_length character_octet_length
10 30
-UPDATE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856;
+UPDATE IGNORE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856;
Warnings:
Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column 'utf8mb3_encoding' at row 1
UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856;
@@ -2475,6 +2481,7 @@ SELECT count(*) FROM t1, t2
WHERE t1.utf8mb4_encoding > t2.utf8mb3_encoding;
count(*)
33
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
SHOW CREATE TABLE t1;
Table Create Table
@@ -2615,7 +2622,7 @@ Table Create Table
t3 CREATE TEMPORARY TABLE `t3` (
`utf8mb4` varchar(10) CHARACTER SET utf8mb4 NOT NULL,
`utf8mb3` varchar(10) CHARACTER SET utf8 NOT NULL,
- `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 NOT NULL
+ `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TEMPORARY TABLE t3;
SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3;
diff --git a/mysql-test/r/ctype_utf8mb4_myisam.result b/mysql-test/r/ctype_utf8mb4_myisam.result
index 53ae410046f..5176f92dc0f 100644
--- a/mysql-test/r/ctype_utf8mb4_myisam.result
+++ b/mysql-test/r/ctype_utf8mb4_myisam.result
@@ -157,7 +157,7 @@ drop table t1;
set LC_TIME_NAMES='en_US';
set names koi8r;
create table t1 (s1 char(1) character set utf8mb4) engine MyISAM;
-insert into t1 values (_koi8r'ÁÂ');
+insert ignore into t1 values (_koi8r'ÁÂ');
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
@@ -165,19 +165,19 @@ s1 hex(s1) char_length(s1) octet_length(s1)
Á D0B0 1 2
drop table t1;
create table t1 (s1 tinytext character set utf8mb4) engine MyISAM;
-insert into t1 select repeat('a',300);
+insert ignore into t1 select repeat('a',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ñ',300);
+insert ignore into t1 select repeat('Ñ',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('aÑ',300);
+insert ignore into t1 select repeat('aÑ',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ña',300);
+insert ignore into t1 select repeat('Ña',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('ÑÑ',300);
+insert ignore into t1 select repeat('ÑÑ',300);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
select hex(s1) from t1;
@@ -196,19 +196,19 @@ length(s1) char_length(s1)
255 255
drop table t1;
create table t1 (s1 text character set utf8mb4) engine MyISAM;
-insert into t1 select repeat('a',66000);
+insert ignore into t1 select repeat('a',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ñ',66000);
+insert ignore into t1 select repeat('Ñ',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('aÑ',66000);
+insert ignore into t1 select repeat('aÑ',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ña',66000);
+insert ignore into t1 select repeat('Ña',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('ÑÑ',66000);
+insert ignore into t1 select repeat('ÑÑ',66000);
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
select length(s1),char_length(s1) from t1;
@@ -220,7 +220,7 @@ length(s1) char_length(s1)
65535 65535
drop table t1;
create table t1 (s1 char(10) character set utf8mb4) engine MyISAM;
-insert into t1 values (0x41FF);
+insert ignore into t1 values (0x41FF);
Warnings:
Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
select hex(s1) from t1;
@@ -228,7 +228,7 @@ hex(s1)
413F
drop table t1;
create table t1 (s1 varchar(10) character set utf8mb4) engine MyISAM;
-insert into t1 values (0x41FF);
+insert ignore into t1 values (0x41FF);
Warnings:
Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
select hex(s1) from t1;
@@ -236,7 +236,7 @@ hex(s1)
413F
drop table t1;
create table t1 (s1 text character set utf8mb4) engine MyISAM;
-insert into t1 values (0x41FF);
+insert ignore into t1 values (0x41FF);
Warnings:
Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
select hex(s1) from t1;
@@ -901,8 +901,8 @@ create table t2 engine MyISAM select concat(a,_utf8mb4'') as a, concat(b,_utf8mb
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL,
- `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL
+ `a` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL,
+ `b` varchar(15) CHARACTER SET utf8mb4 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2;
drop table t1;
@@ -1126,7 +1126,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL,
+ `a` varchar(1) CHARACTER SET utf8mb4 DEFAULT NULL,
`b` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1);
@@ -1368,6 +1368,7 @@ ERR Имри.Ðфимим.Ðеимимримдмримрмрирор имримÑ
DROP TABLE t1,t2;
create table t1 (a char(20) character set utf8mb4) engine MyISAM;
insert into t1 values ('123456'),('андрей');
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 modify a char(2) character set utf8mb4;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1848,24 +1849,28 @@ insert into t1 (a) values ('abcdefghijklmnopqrstuvwxyz');
select * from t1;
a
abcdefghijklmnopqrstuvwxyz
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a varchar(20) character set utf8mb4 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
abcdefghijklmnopqrst
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a char(15) character set utf8mb4 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
abcdefghijklmno
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a char(10) character set utf8mb4 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
abcdefghij
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change a a varchar(5) character set utf8mb4 not null;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1877,6 +1882,7 @@ create table t1 (
a varchar(4000) not null
) default character set utf8mb4 engine MyISAM;
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;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -1899,7 +1905,7 @@ char(53647 using utf8mb4)
Ñ
select char(0xff,0x8f using utf8mb4);
char(0xff,0x8f using utf8mb4)
-
+NULL
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF8F'
select convert(char(0xff,0x8f) using utf8mb4);
@@ -2113,7 +2119,7 @@ ERROR HY000: Invalid utf8mb4 character string: 'FF'
set sql_mode=default;
select hex(char(0xFF using utf8mb4));
hex(char(0xFF using utf8mb4))
-
+NULL
Warnings:
Warning 1300 Invalid utf8mb4 character string: 'FF'
select hex(convert(0xFF using utf8mb4));
@@ -2280,7 +2286,7 @@ create table t1 (utf8mb4 char(1) character set utf8mb4) engine MyISAM;
Testing [F0][90..BF][80..BF][80..BF]
insert into t1 values (0xF0908080);
insert into t1 values (0xF0BFBFBF);
-insert into t1 values (0xF08F8080);
+insert ignore into t1 values (0xF08F8080);
Warnings:
Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column 'utf8mb4' at row 1
select hex(utf8mb4) from t1;
@@ -2300,7 +2306,7 @@ delete from t1;
Testing [F4][80..8F][80..BF][80..BF]
insert into t1 values (0xF4808080);
insert into t1 values (0xF48F8080);
-insert into t1 values (0xF4908080);
+insert ignore into t1 values (0xF4908080);
Warnings:
Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column 'utf8mb4' at row 1
select hex(utf8mb4) from t1;
@@ -2341,14 +2347,14 @@ PRIMARY KEY (clipid),
KEY tape(Tape(255))
) CHARACTER SET=utf8mb4 ENGINE MyISAM;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
ALTER TABLE t1 ADD mos TINYINT DEFAULT 0 AFTER clipid;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`clipid` int(11) NOT NULL,
- `mos` tinyint(4) DEFAULT '0',
- `Tape` tinytext,
+ `mos` tinyint(4) DEFAULT 0,
+ `Tape` tinytext DEFAULT NULL,
PRIMARY KEY (`clipid`),
KEY `tape` (`Tape`(250))
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4
@@ -2378,7 +2384,7 @@ INSERT INTO t1 VALUES (119040, x'f09d8480'),
(917999, x'f3a087af');
INSERT INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480');
INSERT INTO t1 VALUES (65131, x'efb9abf09d849ef09d859ef09d859ef09d8480f09d859fefb9abefb9abf09d85a0efb9ab');
-INSERT INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480f09d85a0');
+INSERT IGNORE INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480f09d85a0');
Warnings:
Warning 1265 Data truncated for column 'utf8mb4_encoding' at row 1
SELECT u_decimal, hex(utf8mb4_encoding) FROM t1 ORDER BY utf8mb4_encoding COLLATE utf8mb4_general_ci, BINARY utf8mb4_encoding;
@@ -2394,7 +2400,7 @@ u_decimal hex(utf8mb4_encoding)
120735 F09D9E9F
65131 EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9AB
917999 F3A087AF
-INSERT INTO t1 VALUES (1114111, x'f5808080');
+INSERT IGNORE INTO t1 VALUES (1114111, x'f5808080');
Warnings:
Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column 'utf8mb4_encoding' at row 1
SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
@@ -2408,14 +2414,14 @@ utf8mb3_encoding VARCHAR(10) NOT NULL
) CHARACTER SET utf8mb3 ENGINE MyISAM;
INSERT INTO t2 VALUES (42856, x'ea9da8');
INSERT INTO t2 VALUES (65131, x'efb9ab');
-INSERT INTO t2 VALUES (1114111, x'f48fbfbf');
+INSERT IGNORE INTO t2 VALUES (1114111, x'f48fbfbf');
Warnings:
Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column 'utf8mb3_encoding' at row 1
SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
table_name= 't2' AND column_name= 'utf8mb3_encoding';
character_maximum_length character_octet_length
10 30
-UPDATE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856;
+UPDATE IGNORE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856;
Warnings:
Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column 'utf8mb3_encoding' at row 1
UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856;
@@ -2475,6 +2481,7 @@ SELECT count(*) FROM t1, t2
WHERE t1.utf8mb4_encoding > t2.utf8mb3_encoding;
count(*)
33
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
SHOW CREATE TABLE t1;
Table Create Table
@@ -2615,7 +2622,7 @@ Table Create Table
t3 CREATE TEMPORARY TABLE `t3` (
`utf8mb4` varchar(10) CHARACTER SET utf8mb4 NOT NULL,
`utf8mb3` varchar(10) CHARACTER SET utf8 NOT NULL,
- `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 NOT NULL
+ `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TEMPORARY TABLE t3;
SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3;
diff --git a/mysql-test/r/ctype_utf8mb4_uca.result b/mysql-test/r/ctype_utf8mb4_uca.result
index 4792d746709..0712ca63abd 100644
--- a/mysql-test/r/ctype_utf8mb4_uca.result
+++ b/mysql-test/r/ctype_utf8mb4_uca.result
@@ -2752,7 +2752,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `s1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_myanmar_ci NOT NULL,
+ `s1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_myanmar_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 (s1) VALUES
@@ -5338,7 +5338,7 @@ CREATE TABLE t1 AS SELECT SPACE(3) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2 NOT NULL
+ `a` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (SPACE(0)),(SPACE(1)),(SPACE(2));
SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(8))) FROM t1;
@@ -5371,7 +5371,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2 NOT NULL
+ `a` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (_ucs2 0x3400);
INSERT INTO t1 VALUES (_ucs2 0xF001);
@@ -5384,7 +5384,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2 NOT NULL
+ `a` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('A'),('À'),('Ã'),('Â'),('Ã'),('Ä'),('Ã…');
SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a;
@@ -5443,7 +5443,7 @@ CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2 NOT NULL
+ `a` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('cota'),('cote'),('cotz');
INSERT INTO t1 VALUES ('coté'),('côte'),('côté'),('cotë'),('côtë');
@@ -6015,3 +6015,593 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9711 NO PAD Collatons
+#
+SET NAMES utf8mb4;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_unicode_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8mb4_unicode_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_unicode_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8mb4_unicode_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0E33020002000200020002000200020002000200
+0E33020902090200020002000200020002000200
+02090E3302000200020002000200020002000200
+02090E3302090200020002000200020002000200
+0E33020902090209020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_unicode_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_unicode_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8mb4_unicode_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_unicode_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_unicode_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8mb4_unicode_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_unicode_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8mb4_unicode_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+0E33020002000200020002000200020002000200
+0E33020902090200020002000200020002000200
+02090E3302000200020002000200020002000200
+02090E3302090200020002000200020002000200
+0E33020902090209020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_unicode_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_unicode_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8mb4_unicode_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_unicode_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_unicode_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET STORAGE_ENGINE=MyISAM;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_unicode_520_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf8mb4_unicode_520_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8mb4_unicode_520_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_unicode_520_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8mb4_unicode_520_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+120F020002000200020002000200020002000200
+120F020A020A0200020002000200020002000200
+020A120F02000200020002000200020002000200
+020A120F020A0200020002000200020002000200
+120F020A020A020A020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_unicode_520_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_unicode_520_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8mb4_unicode_520_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_unicode_520_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=HEAP;
+#
+# Start of ctype_pad.inc
+#
+#
+# Unique indexes
+#
+CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8mb4_unicode_520_nopad_ci';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) COLLATE utf8mb4_unicode_520_nopad_ci NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_nopad_ci
+INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM t1 ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a;
+HEX(a) a
+2061 a
+206120 a
+61202020 a
+616263 abc
+6162632020 abc
+SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC;
+HEX(a) a
+6162632020 abc
+616263 abc
+61202020 a
+206120 a
+2061 a
+#
+# UNION
+#
+CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8mb4_unicode_520_nopad_ci';
+INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a ');
+SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+6120 a
+61202020 a
+616263 abc
+61626320 abc
+6162632020 abc
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# DISTINCT, COUNT, MAX
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_unicode_520_nopad_ci';
+INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a ');
+SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td;
+HEX(a) a
+2061 a
+206120 a
+61 a
+612020 a
+61202020 a
+SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a;
+COUNT(DISTINCT a)
+5
+SELECT HEX(MAX(a)), MAX(a) FROM t1;
+HEX(MAX(a)) MAX(a)
+61202020 a
+#
+# GROUP BY
+#
+CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8mb4_unicode_520_nopad_ci';
+INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er ');
+SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td;
+HEX(a) cnt
+6161 1
+61612020 1
+6162 2
+DROP TABLE t2;
+#
+# Weights
+#
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+HEX(WEIGHT_STRING(a AS CHAR(10)))
+120F020002000200020002000200020002000200
+120F020A020A0200020002000200020002000200
+020A120F02000200020002000200020002000200
+020A120F020A0200020002000200020002000200
+120F020A020A020A020002000200020002000200
+DROP TABLE t1;
+#
+# IF, CASE, LEAST
+#
+SELECT IF('abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad');
+IF('abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ', 'pad', 'nopad')
+nopad
+SELECT CASE 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END;
+CASE WHEN 'abc' COLLATE 'utf8mb4_unicode_520_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END
+nopad
+SELECT HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc '));
+HEX(LEAST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc '))
+61626320
+SELECT HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc '));
+HEX(GREATEST('abc ' COLLATE 'utf8mb4_unicode_520_nopad_ci', 'abc '))
+6162632020
+#
+# Collation mix
+#
+CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8mb4_unicode_520_ci';
+INSERT INTO t1 VALUES ('a'),('a ');
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_unicode_520_nopad_ci';
+COUNT(*)
+1
+ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8mb4_unicode_520_nopad_ci';
+SELECT COUNT(*) FROM t1 WHERE a='a';
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_unicode_520_ci';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8mb4_unicode_520_nopad_ci';
+COUNT(*)
+1
+DROP TABLE t1;
+#
+# End of ctype_pad.inc
+#
+SET STORAGE_ENGINE=Default;
+SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci;
+#
+# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
+#
+CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
+ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci DEFAULT NULL,
+ `b` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('111', '111');
+INSERT INTO t1 VALUES ('222', '222');
+INSERT INTO t1 VALUES ('333', '333');
+INSERT INTO t1 VALUES ('444', '444');
+SELECT * FROM t1 WHERE a LIKE '111%';
+a b
+111 111
+SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
+a b
+111 111
+DROP TABLE t1;
+SET NAMES utf8mb4;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result
index 8439c40fbf9..16dbdf7969c 100644
--- a/mysql-test/r/date_formats.result
+++ b/mysql-test/r/date_formats.result
@@ -558,3 +558,18 @@ SET NAMES latin1;
#
# End of 5.1 tests
#
+select time_format('2001-01-01 02:02:02', '%d.%m.%Y');
+time_format('2001-01-01 02:02:02', '%d.%m.%Y')
+NULL
+select time_format('2001-01-01 02:02:02', '%d %T');
+time_format('2001-01-01 02:02:02', '%d %T')
+NULL
+select time_format('01 02:02:02', '%d %T');
+time_format('01 02:02:02', '%d %T')
+NULL
+select time_format('01 02:02:02', '%T');
+time_format('01 02:02:02', '%T')
+26:02:02
+select time_format('2001-01-01 02:02:02', '%T');
+time_format('2001-01-01 02:02:02', '%T')
+02:02:02
diff --git a/mysql-test/r/ddl_i18n_koi8r.result b/mysql-test/r/ddl_i18n_koi8r.result
index d81b6af0aeb..ba43c1c867f 100644
--- a/mysql-test/r/ddl_i18n_koi8r.result
+++ b/mysql-test/r/ddl_i18n_koi8r.result
@@ -61,8 +61,7 @@ SELECT * FROM v3|
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
-
----> connection: con2
+connect con2,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@@ -118,8 +117,7 @@ DROP DATABASE mysqltest1|
---> Restoring mysqltest1...
-
----> connection: con3
+connect con3,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@@ -167,8 +165,9 @@ utf8_general_ci
SELECT * FROM v3|
ÔÅÓÔ
ÔÅÓÔ
-
----> connection: default
+connection default;
+disconnect con2;
+disconnect con3;
use test|
DROP DATABASE mysqltest1|
@@ -477,8 +476,7 @@ utf8_general_ci utf8_general_ci
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
-
----> connection: con2
+connect con2,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@@ -879,8 +877,7 @@ DROP DATABASE mysqltest2|
---> Restoring mysqltest1...
---> Restoring mysqltest2...
-
----> connection: con3
+connect con3,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@@ -1121,8 +1118,9 @@ koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca cb
utf8_general_ci utf8_general_ci
-
----> connection: default
+connection default;
+disconnect con2;
+disconnect con3;
use test|
DROP DATABASE mysqltest1|
DROP DATABASE mysqltest2|
@@ -1200,7 +1198,7 @@ END|
SHOW CREATE TRIGGER trg1|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10);
@@ -1213,10 +1211,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'ÔÅËÓÔ';
SET @a1 = _koi8r 'ÔÅËÓÔ';
SET @a2 = _utf8 'текÑÑ‚';
-END koi8r koi8r_general_ci utf8_unicode_ci
+END koi8r koi8r_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER trg2|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
@@ -1229,10 +1227,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'ÔÅËÓÔ';
SET @b1 = _koi8r 'ÔÅËÓÔ';
SET @b2 = _utf8 'текÑÑ‚';
-END koi8r koi8r_general_ci utf8_unicode_ci
+END koi8r koi8r_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER mysqltest2.trg3|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10);
@@ -1245,10 +1243,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'ÔÅËÓÔ';
SET @a1 = _koi8r 'ÔÅËÓÔ';
SET @a2 = _utf8 'текÑÑ‚';
-END koi8r koi8r_general_ci utf8_unicode_ci
+END koi8r koi8r_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER mysqltest2.trg4|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
@@ -1261,7 +1259,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'ÔÅËÓÔ';
SET @b1 = _koi8r 'ÔÅËÓÔ';
SET @b2 = _utf8 'текÑÑ‚';
-END koi8r koi8r_general_ci utf8_unicode_ci
+END koi8r koi8r_general_ci utf8_unicode_ci #
SHOW TRIGGERS|
@@ -1277,7 +1275,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'ÔÅËÓÔ';
SET @a1 = 'ÔÅËÓÔ';
SET @a2 = 'ÔÅËÓÔ';
-END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci
+END BEFORE # root@localhost koi8r koi8r_general_ci utf8_unicode_ci
trg2 INSERT t1 BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
@@ -1289,7 +1287,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'ÔÅËÓÔ';
SET @b1 = 'ÔÅËÓÔ';
SET @b2 = 'ÔÅËÓÔ';
-END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci
+END AFTER # root@localhost koi8r koi8r_general_ci utf8_unicode_ci
use mysqltest2|
@@ -1306,7 +1304,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'ÔÅËÓÔ';
SET @a1 = 'ÔÅËÓÔ';
SET @a2 = 'ÔÅËÓÔ';
-END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci
+END BEFORE # root@localhost koi8r koi8r_general_ci utf8_unicode_ci
trg4 INSERT t1 BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
@@ -1318,13 +1316,13 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'ÔÅËÓÔ';
SET @b1 = 'ÔÅËÓÔ';
SET @b2 = 'ÔÅËÓÔ';
-END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci
+END AFTER # root@localhost koi8r koi8r_general_ci utf8_unicode_ci
use mysqltest1|
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest1 trg1 INSERT def mysqltest1 t1 0 NULL BEGIN
+def mysqltest1 trg1 INSERT def mysqltest1 t1 1 NULL BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10);
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ'));
@@ -1339,7 +1337,7 @@ END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest1 trg2 INSERT def mysqltest1 t1 0 NULL BEGIN
+def mysqltest1 trg2 INSERT def mysqltest1 t1 1 NULL BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ'));
@@ -1354,7 +1352,7 @@ END ROW AFTER NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci u
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest2 trg3 INSERT def mysqltest2 t1 0 NULL BEGIN
+def mysqltest2 trg3 INSERT def mysqltest2 t1 1 NULL BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10);
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ'));
@@ -1369,7 +1367,7 @@ END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest2 trg4 INSERT def mysqltest2 t1 0 NULL BEGIN
+def mysqltest2 trg4 INSERT def mysqltest2 t1 1 NULL BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ'));
@@ -1459,8 +1457,7 @@ 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|
-
----> connection: con2
+connect con2,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@@ -1473,7 +1470,7 @@ use mysqltest1|
SHOW CREATE TRIGGER trg1|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10);
@@ -1486,10 +1483,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'ÔÅËÓÔ';
SET @a1 = _koi8r 'ÔÅËÓÔ';
SET @a2 = _utf8 'текÑÑ‚';
-END koi8r koi8r_general_ci utf8_unicode_ci
+END koi8r koi8r_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER trg2|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
@@ -1502,10 +1499,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'ÔÅËÓÔ';
SET @b1 = _koi8r 'ÔÅËÓÔ';
SET @b2 = _utf8 'текÑÑ‚';
-END koi8r koi8r_general_ci utf8_unicode_ci
+END koi8r koi8r_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER mysqltest2.trg3|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10);
@@ -1518,10 +1515,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'ÔÅËÓÔ';
SET @a1 = _koi8r 'ÔÅËÓÔ';
SET @a2 = _utf8 'текÑÑ‚';
-END koi8r koi8r_general_ci utf8_unicode_ci
+END koi8r koi8r_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER mysqltest2.trg4|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
@@ -1534,7 +1531,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'ÔÅËÓÔ';
SET @b1 = _koi8r 'ÔÅËÓÔ';
SET @b2 = _utf8 'текÑÑ‚';
-END koi8r koi8r_general_ci utf8_unicode_ci
+END koi8r koi8r_general_ci utf8_unicode_ci #
SHOW TRIGGERS|
@@ -1550,7 +1547,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'ÔÅËÓÔ';
SET @a1 = 'ÔÅËÓÔ';
SET @a2 = 'ÔÅËÓÔ';
-END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci
+END BEFORE # root@localhost koi8r koi8r_general_ci utf8_unicode_ci
trg2 INSERT t1 BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
@@ -1562,7 +1559,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'ÔÅËÓÔ';
SET @b1 = 'ÔÅËÓÔ';
SET @b2 = 'ÔÅËÓÔ';
-END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci
+END AFTER # root@localhost koi8r koi8r_general_ci utf8_unicode_ci
use mysqltest2|
@@ -1579,7 +1576,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'ÔÅËÓÔ';
SET @a1 = 'ÔÅËÓÔ';
SET @a2 = 'ÔÅËÓÔ';
-END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci
+END BEFORE # root@localhost koi8r koi8r_general_ci utf8_unicode_ci
trg4 INSERT t1 BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
@@ -1591,13 +1588,13 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'ÔÅËÓÔ';
SET @b1 = 'ÔÅËÓÔ';
SET @b2 = 'ÔÅËÓÔ';
-END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci
+END AFTER # root@localhost koi8r koi8r_general_ci utf8_unicode_ci
use mysqltest1|
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest1 trg1 INSERT def mysqltest1 t1 0 NULL BEGIN
+def mysqltest1 trg1 INSERT def mysqltest1 t1 1 NULL BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10);
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ'));
@@ -1612,7 +1609,7 @@ END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest1 trg2 INSERT def mysqltest1 t1 0 NULL BEGIN
+def mysqltest1 trg2 INSERT def mysqltest1 t1 1 NULL BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ'));
@@ -1627,7 +1624,7 @@ END ROW AFTER NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci u
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest2 trg3 INSERT def mysqltest2 t1 0 NULL BEGIN
+def mysqltest2 trg3 INSERT def mysqltest2 t1 1 NULL BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10);
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ'));
@@ -1642,7 +1639,7 @@ END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest2 trg4 INSERT def mysqltest2 t1 0 NULL BEGIN
+def mysqltest2 trg4 INSERT def mysqltest2 t1 1 NULL BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ'));
@@ -1894,8 +1891,7 @@ 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|
-
----> connection: con3
+connect con3,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@@ -1908,7 +1904,7 @@ use mysqltest1|
SHOW CREATE TRIGGER trg1|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10);
@@ -1921,10 +1917,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'ÔÅËÓÔ';
SET @a1 = _koi8r 'ÔÅËÓÔ';
SET @a2 = _utf8 'текÑÑ‚';
-END koi8r koi8r_general_ci utf8_unicode_ci
+END koi8r koi8r_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER trg2|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
@@ -1937,10 +1933,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'ÔÅËÓÔ';
SET @b1 = _koi8r 'ÔÅËÓÔ';
SET @b2 = _utf8 'текÑÑ‚';
-END koi8r koi8r_general_ci utf8_unicode_ci
+END koi8r koi8r_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER mysqltest2.trg3|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10);
@@ -1953,10 +1949,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'ÔÅËÓÔ';
SET @a1 = _koi8r 'ÔÅËÓÔ';
SET @a2 = _utf8 'текÑÑ‚';
-END koi8r koi8r_general_ci utf8_unicode_ci
+END koi8r koi8r_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER mysqltest2.trg4|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
@@ -1969,7 +1965,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'ÔÅËÓÔ';
SET @b1 = _koi8r 'ÔÅËÓÔ';
SET @b2 = _utf8 'текÑÑ‚';
-END koi8r koi8r_general_ci utf8_unicode_ci
+END koi8r koi8r_general_ci utf8_unicode_ci #
SHOW TRIGGERS|
@@ -1985,7 +1981,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'ÔÅËÓÔ';
SET @a1 = 'ÔÅËÓÔ';
SET @a2 = 'ÔÅËÓÔ';
-END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci
+END BEFORE # root@localhost koi8r koi8r_general_ci utf8_unicode_ci
trg2 INSERT t1 BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
@@ -1997,7 +1993,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'ÔÅËÓÔ';
SET @b1 = 'ÔÅËÓÔ';
SET @b2 = 'ÔÅËÓÔ';
-END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci
+END AFTER # root@localhost koi8r koi8r_general_ci utf8_unicode_ci
use mysqltest2|
@@ -2014,7 +2010,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'ÔÅËÓÔ';
SET @a1 = 'ÔÅËÓÔ';
SET @a2 = 'ÔÅËÓÔ';
-END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci
+END BEFORE # root@localhost koi8r koi8r_general_ci utf8_unicode_ci
trg4 INSERT t1 BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
@@ -2026,13 +2022,13 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'ÔÅËÓÔ';
SET @b1 = 'ÔÅËÓÔ';
SET @b2 = 'ÔÅËÓÔ';
-END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci
+END AFTER # root@localhost koi8r koi8r_general_ci utf8_unicode_ci
use mysqltest1|
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest1 trg1 INSERT def mysqltest1 t1 0 NULL BEGIN
+def mysqltest1 trg1 INSERT def mysqltest1 t1 1 NULL BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10);
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ'));
@@ -2047,7 +2043,7 @@ END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest1 trg2 INSERT def mysqltest1 t1 0 NULL BEGIN
+def mysqltest1 trg2 INSERT def mysqltest1 t1 1 NULL BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ'));
@@ -2062,7 +2058,7 @@ END ROW AFTER NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci u
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest2 trg3 INSERT def mysqltest2 t1 0 NULL BEGIN
+def mysqltest2 trg3 INSERT def mysqltest2 t1 1 NULL BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10);
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ'));
@@ -2077,7 +2073,7 @@ END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest2 trg4 INSERT def mysqltest2 t1 0 NULL BEGIN
+def mysqltest2 trg4 INSERT def mysqltest2 t1 1 NULL BEGIN
DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1));
INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ'));
@@ -2159,8 +2155,9 @@ ca1 ca2 ca3 cb1 cb2 cb3
koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci
DELETE FROM mysqltest2.log|
-
----> connection: default
+connection default;
+disconnect con2;
+disconnect con3;
use test|
DROP DATABASE mysqltest1|
DROP DATABASE mysqltest2|
@@ -2348,8 +2345,7 @@ END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREAT
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
-
----> connection: con2
+connect con2,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@@ -2621,8 +2617,7 @@ DROP DATABASE mysqltest2|
---> Restoring mysqltest1...
---> Restoring mysqltest2...
-
----> connection: con3
+connect con3,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@@ -2829,12 +2824,11 @@ Table Create Table
t2 CREATE TABLE `t2` (
`col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs
-
----> connection: con2
-
----> connection: con3
-
----> connection: default
+connection con2;
+disconnect con2;
+connection con3;
+disconnect con3;
+connection default;
USE test;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
diff --git a/mysql-test/r/ddl_i18n_utf8.result b/mysql-test/r/ddl_i18n_utf8.result
index 5921a7f538d..47786196037 100644
--- a/mysql-test/r/ddl_i18n_utf8.result
+++ b/mysql-test/r/ddl_i18n_utf8.result
@@ -61,8 +61,7 @@ SELECT * FROM v3|
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
-
----> connection: con2
+connect con2,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@@ -118,8 +117,7 @@ DROP DATABASE mysqltest1|
---> Restoring mysqltest1...
-
----> connection: con3
+connect con3,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@@ -167,8 +165,9 @@ koi8r_general_ci
SELECT * FROM v3|
теÑÑ‚
теÑÑ‚
-
----> connection: default
+connection default;
+disconnect con2;
+disconnect con3;
use test|
DROP DATABASE mysqltest1|
@@ -477,8 +476,7 @@ utf8_general_ci utf8_general_ci
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
-
----> connection: con2
+connect con2,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@@ -879,8 +877,7 @@ DROP DATABASE mysqltest2|
---> Restoring mysqltest1...
---> Restoring mysqltest2...
-
----> connection: con3
+connect con3,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@@ -1121,8 +1118,9 @@ utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca cb
utf8_general_ci utf8_general_ci
-
----> connection: default
+connection default;
+disconnect con2;
+disconnect con3;
use test|
DROP DATABASE mysqltest1|
DROP DATABASE mysqltest2|
@@ -1200,7 +1198,7 @@ END|
SHOW CREATE TRIGGER trg1|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10);
@@ -1213,10 +1211,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текÑÑ‚';
SET @a2 = _utf8 'текÑÑ‚';
SET @a3 = _koi8r 'ÔÅËÓÔ';
-END utf8 utf8_general_ci utf8_unicode_ci
+END utf8 utf8_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER trg2|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
@@ -1229,10 +1227,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текÑÑ‚';
SET @b2 = _utf8 'текÑÑ‚';
SET @b3 = _koi8r 'ÔÅËÓÔ';
-END utf8 utf8_general_ci utf8_unicode_ci
+END utf8 utf8_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER mysqltest2.trg3|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10);
@@ -1245,10 +1243,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текÑÑ‚';
SET @a2 = _utf8 'текÑÑ‚';
SET @a3 = _koi8r 'ÔÅËÓÔ';
-END utf8 utf8_general_ci utf8_unicode_ci
+END utf8 utf8_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER mysqltest2.trg4|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
@@ -1261,7 +1259,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текÑÑ‚';
SET @b2 = _utf8 'текÑÑ‚';
SET @b3 = _koi8r 'ÔÅËÓÔ';
-END utf8 utf8_general_ci utf8_unicode_ci
+END utf8 utf8_general_ci utf8_unicode_ci #
SHOW TRIGGERS|
@@ -1277,7 +1275,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текÑÑ‚';
SET @a2 = 'текÑÑ‚';
SET @a3 = 'текÑÑ‚';
-END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci
+END BEFORE # root@localhost utf8 utf8_general_ci utf8_unicode_ci
trg2 INSERT t1 BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
@@ -1289,7 +1287,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текÑÑ‚';
SET @b2 = 'текÑÑ‚';
SET @b3 = 'текÑÑ‚';
-END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci
+END AFTER # root@localhost utf8 utf8_general_ci utf8_unicode_ci
use mysqltest2|
@@ -1306,7 +1304,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текÑÑ‚';
SET @a2 = 'текÑÑ‚';
SET @a3 = 'текÑÑ‚';
-END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci
+END BEFORE # root@localhost utf8 utf8_general_ci utf8_unicode_ci
trg4 INSERT t1 BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
@@ -1318,13 +1316,13 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текÑÑ‚';
SET @b2 = 'текÑÑ‚';
SET @b3 = 'текÑÑ‚';
-END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci
+END AFTER # root@localhost utf8 utf8_general_ci utf8_unicode_ci
use mysqltest1|
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest1 trg1 INSERT def mysqltest1 t1 0 NULL BEGIN
+def mysqltest1 trg1 INSERT def mysqltest1 t1 1 NULL BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текÑÑ‚'));
@@ -1339,7 +1337,7 @@ END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci ut
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest1 trg2 INSERT def mysqltest1 t1 0 NULL BEGIN
+def mysqltest1 trg2 INSERT def mysqltest1 t1 1 NULL BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текÑÑ‚'));
@@ -1354,7 +1352,7 @@ END ROW AFTER NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest2 trg3 INSERT def mysqltest2 t1 0 NULL BEGIN
+def mysqltest2 trg3 INSERT def mysqltest2 t1 1 NULL BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текÑÑ‚'));
@@ -1369,7 +1367,7 @@ END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci ut
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest2 trg4 INSERT def mysqltest2 t1 0 NULL BEGIN
+def mysqltest2 trg4 INSERT def mysqltest2 t1 1 NULL BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текÑÑ‚'));
@@ -1459,8 +1457,7 @@ 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|
-
----> connection: con2
+connect con2,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@@ -1473,7 +1470,7 @@ use mysqltest1|
SHOW CREATE TRIGGER trg1|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10);
@@ -1486,10 +1483,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текÑÑ‚';
SET @a2 = _utf8 'текÑÑ‚';
SET @a3 = _koi8r 'ÔÅËÓÔ';
-END utf8 utf8_general_ci utf8_unicode_ci
+END utf8 utf8_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER trg2|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
@@ -1502,10 +1499,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текÑÑ‚';
SET @b2 = _utf8 'текÑÑ‚';
SET @b3 = _koi8r 'ÔÅËÓÔ';
-END utf8 utf8_general_ci utf8_unicode_ci
+END utf8 utf8_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER mysqltest2.trg3|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10);
@@ -1518,10 +1515,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текÑÑ‚';
SET @a2 = _utf8 'текÑÑ‚';
SET @a3 = _koi8r 'ÔÅËÓÔ';
-END utf8 utf8_general_ci utf8_unicode_ci
+END utf8 utf8_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER mysqltest2.trg4|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
@@ -1534,7 +1531,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текÑÑ‚';
SET @b2 = _utf8 'текÑÑ‚';
SET @b3 = _koi8r 'ÔÅËÓÔ';
-END utf8 utf8_general_ci utf8_unicode_ci
+END utf8 utf8_general_ci utf8_unicode_ci #
SHOW TRIGGERS|
@@ -1550,7 +1547,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текÑÑ‚';
SET @a2 = 'текÑÑ‚';
SET @a3 = 'текÑÑ‚';
-END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci
+END BEFORE # root@localhost utf8 utf8_general_ci utf8_unicode_ci
trg2 INSERT t1 BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
@@ -1562,7 +1559,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текÑÑ‚';
SET @b2 = 'текÑÑ‚';
SET @b3 = 'текÑÑ‚';
-END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci
+END AFTER # root@localhost utf8 utf8_general_ci utf8_unicode_ci
use mysqltest2|
@@ -1579,7 +1576,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текÑÑ‚';
SET @a2 = 'текÑÑ‚';
SET @a3 = 'текÑÑ‚';
-END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci
+END BEFORE # root@localhost utf8 utf8_general_ci utf8_unicode_ci
trg4 INSERT t1 BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
@@ -1591,13 +1588,13 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текÑÑ‚';
SET @b2 = 'текÑÑ‚';
SET @b3 = 'текÑÑ‚';
-END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci
+END AFTER # root@localhost utf8 utf8_general_ci utf8_unicode_ci
use mysqltest1|
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest1 trg1 INSERT def mysqltest1 t1 0 NULL BEGIN
+def mysqltest1 trg1 INSERT def mysqltest1 t1 1 NULL BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текÑÑ‚'));
@@ -1612,7 +1609,7 @@ END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci ut
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest1 trg2 INSERT def mysqltest1 t1 0 NULL BEGIN
+def mysqltest1 trg2 INSERT def mysqltest1 t1 1 NULL BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текÑÑ‚'));
@@ -1627,7 +1624,7 @@ END ROW AFTER NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest2 trg3 INSERT def mysqltest2 t1 0 NULL BEGIN
+def mysqltest2 trg3 INSERT def mysqltest2 t1 1 NULL BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текÑÑ‚'));
@@ -1642,7 +1639,7 @@ END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci ut
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest2 trg4 INSERT def mysqltest2 t1 0 NULL BEGIN
+def mysqltest2 trg4 INSERT def mysqltest2 t1 1 NULL BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текÑÑ‚'));
@@ -1894,8 +1891,7 @@ 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|
-
----> connection: con3
+connect con3,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@@ -1908,7 +1904,7 @@ use mysqltest1|
SHOW CREATE TRIGGER trg1|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10);
@@ -1921,10 +1917,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текÑÑ‚';
SET @a2 = _utf8 'текÑÑ‚';
SET @a3 = _koi8r 'ÔÅËÓÔ';
-END utf8 utf8_general_ci utf8_unicode_ci
+END utf8 utf8_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER trg2|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
@@ -1937,10 +1933,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текÑÑ‚';
SET @b2 = _utf8 'текÑÑ‚';
SET @b3 = _koi8r 'ÔÅËÓÔ';
-END utf8 utf8_general_ci utf8_unicode_ci
+END utf8 utf8_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER mysqltest2.trg3|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10);
@@ -1953,10 +1949,10 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текÑÑ‚';
SET @a2 = _utf8 'текÑÑ‚';
SET @a3 = _koi8r 'ÔÅËÓÔ';
-END utf8 utf8_general_ci utf8_unicode_ci
+END utf8 utf8_general_ci utf8_unicode_ci #
SHOW CREATE TRIGGER mysqltest2.trg4|
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
@@ -1969,7 +1965,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текÑÑ‚';
SET @b2 = _utf8 'текÑÑ‚';
SET @b3 = _koi8r 'ÔÅËÓÔ';
-END utf8 utf8_general_ci utf8_unicode_ci
+END utf8 utf8_general_ci utf8_unicode_ci #
SHOW TRIGGERS|
@@ -1985,7 +1981,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текÑÑ‚';
SET @a2 = 'текÑÑ‚';
SET @a3 = 'текÑÑ‚';
-END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci
+END BEFORE # root@localhost utf8 utf8_general_ci utf8_unicode_ci
trg2 INSERT t1 BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
@@ -1997,7 +1993,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текÑÑ‚';
SET @b2 = 'текÑÑ‚';
SET @b3 = 'текÑÑ‚';
-END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci
+END AFTER # root@localhost utf8 utf8_general_ci utf8_unicode_ci
use mysqltest2|
@@ -2014,7 +2010,7 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текÑÑ‚';
SET @a2 = 'текÑÑ‚';
SET @a3 = 'текÑÑ‚';
-END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci
+END BEFORE # root@localhost utf8 utf8_general_ci utf8_unicode_ci
trg4 INSERT t1 BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
@@ -2026,13 +2022,13 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текÑÑ‚';
SET @b2 = 'текÑÑ‚';
SET @b3 = 'текÑÑ‚';
-END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci
+END AFTER # root@localhost utf8 utf8_general_ci utf8_unicode_ci
use mysqltest1|
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest1 trg1 INSERT def mysqltest1 t1 0 NULL BEGIN
+def mysqltest1 trg1 INSERT def mysqltest1 t1 1 NULL BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текÑÑ‚'));
@@ -2047,7 +2043,7 @@ END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci ut
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest1 trg2 INSERT def mysqltest1 t1 0 NULL BEGIN
+def mysqltest1 trg2 INSERT def mysqltest1 t1 1 NULL BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текÑÑ‚'));
@@ -2062,7 +2058,7 @@ END ROW AFTER NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest2 trg3 INSERT def mysqltest2 t1 0 NULL BEGIN
+def mysqltest2 trg3 INSERT def mysqltest2 t1 1 NULL BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текÑÑ‚'));
@@ -2077,7 +2073,7 @@ END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci ut
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'|
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest2 trg4 INSERT def mysqltest2 t1 0 NULL BEGIN
+def mysqltest2 trg4 INSERT def mysqltest2 t1 1 NULL BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текÑÑ‚'));
@@ -2159,8 +2155,9 @@ ca1 ca2 ca3 cb1 cb2 cb3
utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8_general_ci koi8r_general_ci
DELETE FROM mysqltest2.log|
-
----> connection: default
+connection default;
+disconnect con2;
+disconnect con3;
use test|
DROP DATABASE mysqltest1|
DROP DATABASE mysqltest2|
@@ -2348,8 +2345,7 @@ END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREAT
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
-
----> connection: con2
+connect con2,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@@ -2621,8 +2617,7 @@ DROP DATABASE mysqltest2|
---> Restoring mysqltest1...
---> Restoring mysqltest2...
-
----> connection: con3
+connect con3,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@@ -2829,12 +2824,11 @@ Table Create Table
t2 CREATE TABLE `t2` (
`col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs
-
----> connection: con2
-
----> connection: con3
-
----> connection: default
+connection con2;
+disconnect con2;
+connection con3;
+disconnect con3;
+connection default;
USE test;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
diff --git a/mysql-test/r/deadlock_innodb.result b/mysql-test/r/deadlock_innodb.result
index 7a4874d6aab..af78a6aa9d5 100644
--- a/mysql-test/r/deadlock_innodb.result
+++ b/mysql-test/r/deadlock_innodb.result
@@ -1,31 +1,31 @@
-# Establish connection con1 (user=root)
-# Establish connection con2 (user=root)
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
drop table if exists t1,t2;
-# Switch to connection con1
+connection con1;
create table t1 (id integer, x integer) engine = InnoDB;
insert into t1 values(0, 0);
set autocommit=0;
SELECT * from t1 where id = 0 FOR UPDATE;
id x
0 0
-# Switch to connection con2
+connection con2;
set autocommit=0;
update t1 set x=2 where id = 0;
-# Switch to connection con1
+connection con1;
update t1 set x=1 where id = 0;
select * from t1;
id x
0 1
commit;
-# Switch to connection con2
+connection con2;
commit;
-# Switch to connection con1
+connection con1;
select * from t1;
id x
0 2
commit;
drop table t1;
-# Switch to connection con1
+connection con1;
create table t1 (id integer, x integer) engine = InnoDB;
create table t2 (b integer, a integer) engine = InnoDB;
insert into t1 values(0, 0), (300, 300);
@@ -47,19 +47,19 @@ select * from t1;
id x
0 0
300 300
-# Switch to connection con2
+connection con2;
set autocommit=0;
update t1 set x=2 where id = 0;
-# Switch to connection con1
+connection con1;
update t1 set x=1 where id = 0;
select * from t1;
id x
0 1
300 300
commit;
-# Switch to connection con2
+connection con2;
commit;
-# Switch to connection con1
+connection con1;
select * from t1;
id x
0 2
@@ -71,7 +71,7 @@ create table t2 (b integer, a integer) engine = InnoDB;
insert into t1 values(0, 0), (300, 300);
insert into t2 values(0, 0), (1, 20), (2, 30);
commit;
-# Switch to connection con1
+connection con1;
select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
a b
0 0
@@ -87,7 +87,7 @@ select * from t1;
id x
0 0
300 300
-# Switch to connection con2
+connection con2;
update t2 set a=2 where b = 0;
select * from t2;
b a
@@ -95,22 +95,24 @@ b a
1 20
2 30
update t1 set x=2 where id = 0;
-# Switch to connection con1
+connection con1;
update t1 set x=1 where id = 0;
select * from t1;
id x
0 1
300 300
commit;
-# Switch to connection con2
+connection con2;
commit;
-# Switch to connection con1
+connection con1;
select * from t1;
id x
0 2
300 300
commit;
-# Switch to connection default + disconnect con1 and con2
+connection default;
+disconnect con1;
+disconnect con2;
drop table t1, t2;
End of 4.1 tests
set storage_engine=innodb;
diff --git a/mysql-test/r/debug_sync.result b/mysql-test/r/debug_sync.result
index 25fdf523200..bb9ae1a417d 100644
--- a/mysql-test/r/debug_sync.result
+++ b/mysql-test/r/debug_sync.result
@@ -234,44 +234,62 @@ Variable_name Value
debug_sync ON - current signal: ''
CREATE USER mysqltest_1@localhost;
GRANT SUPER ON *.* TO mysqltest_1@localhost;
-connection con1, mysqltest_1
+connect con1,localhost,mysqltest_1,,;
SET DEBUG_SYNC= 'RESET';
-connection default
+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;
-connection con1, mysqltest_2
+connect con1,localhost,mysqltest_2,,;
SET DEBUG_SYNC= 'RESET';
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
-connection default
+disconnect con1;
+connection default;
DROP USER mysqltest_2@localhost;
SET DEBUG_SYNC= 'RESET';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT);
-connection con1
+connect con1,localhost,root,,;
SET DEBUG_SYNC= 'before_lock_tables_takes_lock
SIGNAL opened WAIT_FOR flushed';
INSERT INTO t1 VALUES(1);
-connection default
+connection default;
SET DEBUG_SYNC= 'now WAIT_FOR opened';
SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed';
FLUSH TABLE t1;
-connection con1
-connection default
+connection con1;
+disconnect con1;
+connection default;
DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';
DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (c1 INT);
-LOCK TABLE t1 READ;
-connection con1
+CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1);
+SELECT GET_LOCK('mysqltest_lock', 100);
+GET_LOCK('mysqltest_lock', 100)
+1
+connect con1,localhost,root,,;
+# Sending:
+UPDATE t1 SET c1=GET_LOCK('mysqltest_lock', 100);;
+connect con2,localhost,root,,;
SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2';
INSERT INTO t1 VALUES (1);
-connection default
+connection default;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
-UNLOCK TABLES;
-connection con1
+SELECT RELEASE_LOCK('mysqltest_lock');
+RELEASE_LOCK('mysqltest_lock')
+1
+connection con1;
+# Reaping UPDATE
+SELECT RELEASE_LOCK('mysqltest_lock');
+RELEASE_LOCK('mysqltest_lock')
+1
+connection con2;
retrieve INSERT result.
-connection default
+disconnect con1;
+disconnect con2;
+connection default;
DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result
index 4057c18226e..8fa88066f7c 100644
--- a/mysql-test/r/default.result
+++ b/mysql-test/r/default.result
@@ -72,31 +72,31 @@ t2 CREATE TABLE `t2` (
`a` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
`b` varchar(1) COLLATE latin1_bin NOT NULL DEFAULT ' ',
`c` varchar(4) COLLATE latin1_bin NOT NULL DEFAULT '0000',
- `d` tinyblob,
- `e` tinyblob,
- `f` tinyblob,
- `g` tinyblob,
- `h` tinyblob,
- `i` tinyblob,
- `j` tinyblob,
- `k` tinyblob,
- `l` tinyblob,
- `m` tinyblob,
- `n` tinyblob,
- `o` tinyblob,
- `p` tinyblob,
+ `d` tinyblob DEFAULT NULL,
+ `e` tinyblob DEFAULT NULL,
+ `f` tinyblob DEFAULT NULL,
+ `g` tinyblob DEFAULT NULL,
+ `h` tinyblob DEFAULT NULL,
+ `i` tinyblob DEFAULT NULL,
+ `j` tinyblob DEFAULT NULL,
+ `k` tinyblob DEFAULT NULL,
+ `l` tinyblob DEFAULT NULL,
+ `m` tinyblob DEFAULT NULL,
+ `n` tinyblob DEFAULT NULL,
+ `o` tinyblob DEFAULT NULL,
+ `p` tinyblob DEFAULT NULL,
`q` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
`r` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
- `s` tinyblob,
+ `s` tinyblob DEFAULT NULL,
`t` varchar(4) COLLATE latin1_bin NOT NULL DEFAULT ' ',
`u` varchar(1) COLLATE latin1_bin NOT NULL DEFAULT ' ',
`v` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
`w` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
- `x` tinyblob,
+ `x` tinyblob DEFAULT NULL,
`y` varchar(5) COLLATE latin1_bin NOT NULL DEFAULT ' ',
`z` varchar(20) COLLATE latin1_bin NOT NULL DEFAULT ' ',
`a1` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
- `b1` tinyblob
+ `b1` tinyblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin
INSERT into t2 (b) values ('1');
SHOW WARNINGS;
@@ -107,11 +107,11 @@ 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 a1 b1
drop table t1;
drop table t2;
create table bug20691 (i int, d datetime NOT NULL, dn datetime not null default '0000-00-00 00:00:00');
-insert 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 values (1, DEFAULT, DEFAULT), (1, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (1, DEFAULT, DEFAULT);
Warnings:
Warning 1364 Field 'd' doesn't have a default value
Warning 1364 Field 'd' doesn't have a default value
-insert into bug20691 (i) values (2);
+insert ignore into bug20691 (i) values (2);
Warnings:
Warning 1364 Field 'd' doesn't have a default value
desc bug20691;
@@ -119,14 +119,14 @@ Field Type Null Key Default Extra
i int(11) YES NULL
d datetime NO NULL
dn datetime NO 0000-00-00 00:00:00
-insert 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 values (3, DEFAULT, DEFAULT), (3, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (3, DEFAULT, DEFAULT);
Warnings:
Warning 1364 Field 'd' doesn't have a default value
Warning 1364 Field 'd' doesn't have a default value
-insert into bug20691 (i) values (4);
+insert ignore into bug20691 (i) values (4);
Warnings:
Warning 1364 Field 'd' doesn't have a default value
-insert into bug20691 values (5, DEFAULT, DEFAULT), (5, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (5, DEFAULT, DEFAULT);
+insert ignore into bug20691 values (5, DEFAULT, DEFAULT), (5, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (5, DEFAULT, DEFAULT);
Warnings:
Warning 1364 Field 'd' doesn't have a default value
Warning 1364 Field 'd' doesn't have a default value
@@ -221,7 +221,7 @@ a
NULL
10
drop table t1, t2;
-End of 5.0 tests.
+# End of 5.0 tests
#
# Start of 10.0 tests
#
@@ -253,12 +253,15 @@ DROP TABLE t1;
#
# MDEV-10780 Server crashes in in create_tmp_table
#
+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;
DEFAULT (pk)
0
+disconnect con1;
+connection default;
DROP TABLE t1;
#
# End of 10.0 tests
@@ -277,3 +280,3112 @@ DROP TABLE IF EXISTS t1;
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30.123456');
+#
+# Check that CURRENT_TIMESTAMP works as before
+#
+CREATE or replace TABLE t1 (event_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+CREATE or replace TABLE t1 (event_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(2) ON UPDATE CURRENT_TIMESTAMP);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(2) ON UPDATE current_timestamp(6)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+CREATE or replace TABLE t1 (event_time TIMESTAMP(6) NOT NULL DEFAULT SYSDATE(2) ON UPDATE CURRENT_TIMESTAMP);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `event_time` timestamp(6) NOT NULL DEFAULT sysdate(2) ON UPDATE current_timestamp(6)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+#
+# Check default expressions
+#
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT 1,
+ `b` int(11) DEFAULT (`a` + 1),
+ `c` int(11) DEFAULT (`a` + `b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+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;
+a b c
+1 2 3
+2 3 5
+10 20 30
+100 200 400
+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;
+a b c
+1 2 3
+2 3 5
+10 20 30
+100 200 400
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` blob DEFAULT 1,
+ `c` blob DEFAULT 'hello',
+ `t` text DEFAULT concat(`a`,`b`,`c`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+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;
+a b c t
+2 1 hello 21hello
+10 test1 hello 10test1hello
+10 test2 test3 10test2test3
+10 test4 hello 10test4hello
+drop table t1;
+create or replace table t1 (a bigint default uuid_short());
+insert into t1 values();
+select a > 0 from t1;
+a > 0
+1
+drop table t1;
+create or replace table t1 (param_list int DEFAULT (1+1) NOT NULL);
+create or replace table t1 (param_list int DEFAULT 1+1 NOT NULL);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '+1 NOT NULL)' at line 1
+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;
+a b c d e
+-1 1 -1 2 2001-01-01 10:20:30
+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;
+a b c d e f g h
+-1 1 -1 2 2001-01-01 10:20:30 3 4 8
+10 10 10 10 0000-00-00 00:00:00 3 4 8
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT 1,
+ `c` int(11) DEFAULT -1,
+ `d` int(11) DEFAULT (1 + 1),
+ `e` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `f` int(11) DEFAULT (1 + 1 + 1),
+ `g` int(11) NOT NULL DEFAULT (1 + 1 + 1 + 1),
+ `h` int(11) DEFAULT (2 + 2 + 2 + 2)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create table t2 like t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT 1,
+ `c` int(11) DEFAULT -1,
+ `d` int(11) DEFAULT (1 + 1),
+ `e` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `f` int(11) DEFAULT (1 + 1 + 1),
+ `g` int(11) NOT NULL DEFAULT (1 + 1 + 1 + 1),
+ `h` int(11) DEFAULT (2 + 2 + 2 + 2)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t2 (a) values (100);
+select a,b,c,d,e,f,g,h from t2;
+a b c d e f g h
+100 1 -1 2 2001-01-01 10:20:30 3 4 8
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT (1 - -1),
+ `b` int(11) DEFAULT -1,
+ `c` int(11) DEFAULT 1,
+ `e` int(11) DEFAULT 1
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values();
+insert into t1 values();
+select * from t1;
+a b c e
+2 -1 1 1
+2 -1 1 1
+drop table t1;
+#
+# Create or replace can delete a table on error
+#
+create table t1 (a int);
+create or replace table t1 (a int default b, b int default a);
+ERROR 01000: Expression for field `a` is refering to uninitialized field `b`
+show create table t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+#
+# Refering to other columns
+#
+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));
+create or replace table t1 (a int default a);
+ERROR 01000: Expression for field `a` is refering to uninitialized field `a`
+create or replace table t1 (a int default b, b int default (1+1));
+create or replace table t1 (a int default 1, b int as (c), c int as (a+1));
+ERROR 01000: Expression for field `b` is refering to uninitialized field `c`
+CREATE TABLE t1 (a INT DEFAULT (DEFAULT(a)));
+ERROR 01000: Expression for field `a` is refering to uninitialized field `a`
+CREATE TABLE t1 (a INT DEFAULT(DEFAULT(b)), b INT DEFAULT(DEFAULT(a)));
+ERROR 01000: Expression for field `a` is refering to uninitialized field `b`
+CREATE TABLE t1 (a INT DEFAULT(DEFAULT(b)) NOT NULL, b INT DEFAULT(DEFAULT(a)) NOT NULL);
+ERROR 01000: Expression for field `a` is refering to uninitialized field `b`
+#
+# Allow defaults to refer to not default fields
+#
+create or replace table t1 (a int default b, b int not null);
+insert into t1 values();
+Warnings:
+Warning 1364 Field 'b' doesn't have a default value
+insert into t1 (a) values(1);
+Warnings:
+Warning 1364 Field 'b' doesn't have a default value
+insert into t1 (b) values(2);
+insert into t1 (a,b) values(3,4);
+select * from t1;
+a b
+0 0
+1 0
+2 2
+3 4
+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;
+#
+# Error handling
+#
+create or replace table t1 (a bigint default xxx());
+ERROR HY000: Function or expression '`xxx`()' cannot be used in the DEFAULT clause of `a`
+create or replace table t1 (a bigint default (select (1)));
+ERROR HY000: Function or expression 'select ...' cannot be used in the DEFAULT clause of `a`
+create or replace table t1 (a bigint default (1,2,3));
+ERROR 21000: Operand should contain 1 column(s)
+create or replace table t1 (a bigint default ((1,2,3)));
+ERROR 21000: Operand should contain 1 column(s)
+CREATE TABLE t1 (a INT, b INT, c INT DEFAULT a DIV b);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DIV b)' at line 1
+CREATE TABLE t1 (a INT, b INT DEFAULT -a);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'a)' at line 1
+#
+# Invalid DEFAULT expressions
+#
+CREATE TABLE t1 (a INT DEFAULT ((SELECT 1)));
+ERROR HY000: Function or expression 'select ...' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT (EXISTS (SELECT 1)));
+ERROR HY000: Function or expression 'select ...' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT (1=ANY (SELECT 1)));
+ERROR HY000: Function or expression 'select ...' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT ROW(1,1));
+ERROR 21000: Operand should contain 1 column(s)
+CREATE TABLE t1 (a INT DEFAULT (1,1));
+ERROR 21000: Operand should contain 1 column(s)
+CREATE TABLE t1 (a INT DEFAULT ((1,1)));
+ERROR 21000: Operand should contain 1 column(s)
+CREATE TABLE t1 (a INT DEFAULT ?);
+Got one of the listed errors
+CREATE TABLE t1 (a INT DEFAULT(?));
+Got one of the listed errors
+CREATE TABLE t1 (a INT DEFAULT (b), b INT DEFAULT(a));
+ERROR 01000: Expression for field `a` is refering to uninitialized field `b`
+CREATE TABLE t1 (a INT DEFAULT(NAME_CONST('xxx', 'yyy'));
+ERROR HY000: Function or expression 'name_const()' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT COUNT(*));
+ERROR HY000: Function or expression 'count()' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT COUNT(1));
+ERROR HY000: Function or expression 'count()' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT AVG(1));
+ERROR HY000: Function or expression 'avg()' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT MIN(1));
+ERROR HY000: Function or expression 'min()' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT GROUP_CONCAT(1));
+ERROR HY000: Function or expression 'group_concat()' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT ROW_NUMBER() OVER ());
+ERROR HY000: Function or expression 'row_number()' cannot be used in the DEFAULT clause of `a`
+CREATE FUNCTION f1() RETURNS INT RETURN 1;
+CREATE TABLE t1 (a INT DEFAULT f1());
+ERROR HY000: Function or expression '`f1`()' cannot be used in the DEFAULT clause of `a`
+DROP FUNCTION f1;
+CREATE PROCEDURE p1(par INT) CREATE TABLE t1 (a INT DEFAULT par);
+ERROR HY000: Function or expression 'par' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT par);
+ERROR 42S22: Unknown column 'par' in 'DEFAULT'
+CREATE PROCEDURE p1() CREATE TABLE t1 (a INT DEFAULT par);
+CALL p1;
+ERROR 42S22: Unknown column 'par' in 'DEFAULT'
+DROP PROCEDURE p1;
+CREATE TABLE t1 (a INT DEFAULT VALUES(a));
+ERROR HY000: Function or expression 'values()' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT);
+CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW CREATE TABLE t2 (a INT DEFAULT NEW.a);
+ERROR HY000: Function or expression 'NEW.a' cannot be used in the DEFAULT clause of `a`
+CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW CREATE TEMPORARY TABLE t2 (a INT DEFAULT NEW.a);
+ERROR HY000: Function or expression 'NEW.a' cannot be used in the DEFAULT clause of `a`
+DROP TABLE t1;
+#
+# Prepared statements
+#
+PREPARE stmt FROM 'CREATE TABLE t1 (a INT DEFAULT(?))';
+set @a=1;
+execute stmt using @a;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT 1
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @a=-1;
+execute stmt using @a;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT -1
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT 1,
+ `b` int(11) DEFAULT 2
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+DEALLOCATE PREPARE stmt;
+prepare stmt from 'create table t1 (a int default(?+?))';
+set @a=1;
+execute stmt using @a,@a;
+deallocate prepare stmt;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT (1 + 1)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+#
+# Parenthesized Item_basic_constant
+#
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i01` int(11) DEFAULT 1,
+ `i02` int(11) DEFAULT 14649,
+ `i03` int(11) DEFAULT 1,
+ `i04` int(11) DEFAULT 1,
+ `i05` int(11) DEFAULT NULL,
+ `f01` double DEFAULT 3.141592653589793,
+ `s01` varchar(10) DEFAULT 'test',
+ `s02` varchar(10) DEFAULT 'test',
+ `s03` varchar(10) DEFAULT '@',
+ `s04` varchar(10) DEFAULT '@',
+ `s05` varchar(10) DEFAULT '@',
+ `d01` time DEFAULT '10:20:30',
+ `d02` date DEFAULT '2001-01-01',
+ `d03` datetime DEFAULT '2001-01-01 10:20:30'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ();
+SELECT * FROM t1;
+i01 1
+i02 14649
+i03 1
+i04 1
+i05 NULL
+f01 3.141592653589793
+s01 test
+s02 test
+s03 @
+s04 @
+s05 @
+d01 10:20:30
+d02 2001-01-01
+d03 2001-01-01 10:20:30
+DROP TABLE t1;
+#
+# COALESCE(Item_basic_constant)
+#
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i01` int(11) DEFAULT coalesce(1),
+ `i02` int(11) DEFAULT coalesce(0x3939),
+ `i03` int(11) DEFAULT coalesce(1.0),
+ `i04` int(11) DEFAULT coalesce(1e0),
+ `i05` int(11) 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(0x40),
+ `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')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ();
+SELECT * FROM t1;
+i01 1
+i02 99
+i03 1
+i04 1
+i05 NULL
+f01 3.141592653589793
+s01 test
+s02 test
+s03 @
+s04 @
+s05 @
+d01 10:20:30
+d02 2001-01-01
+d03 2001-01-01 10:20:30
+DROP TABLE t1;
+#
+# TINYINT: out of range
+#
+CREATE TABLE t1 (a TINYINT DEFAULT 300 NOT NULL);
+ERROR 42000: Invalid default value for 'a'
+CREATE TABLE t1 (a TINYINT DEFAULT 128 NOT NULL);
+ERROR 42000: Invalid default value for 'a'
+CREATE TABLE t1 (a TINYINT DEFAULT -500 NOT NULL);
+ERROR 42000: Invalid default value for 'a'
+#
+# INT: simple numeric expressions
+#
+CREATE TABLE t1 (a INT DEFAULT 1 NOT NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT 1
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT DEFAULT COALESCE(1) NOT NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT coalesce(1)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
+#
+# INT: simple string expressions
+#
+CREATE TABLE t1 (a INT DEFAULT '1' NOT NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT 1
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT DEFAULT CONCAT('1') NOT NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT concat('1')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT DEFAULT COALESCE('1') NOT NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT coalesce('1')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
+#
+# INT: string expressions with garbage
+#
+CREATE TABLE t1 (a INT DEFAULT 'x');
+ERROR 42000: Invalid default value for 'a'
+CREATE TABLE t1 (a INT DEFAULT CONCAT('x'));
+ERROR 42000: Invalid default value for 'a'
+CREATE TABLE t1 (a INT DEFAULT COALESCE('x'));
+ERROR 42000: Invalid default value for 'a'
+CREATE TABLE t1 (a INT DEFAULT (((((COALESCE('x')))))));
+ERROR 42000: Invalid default value for 'a'
+#
+# INT: string expressions with numbers + garbage
+#
+CREATE TABLE t1 (a INT DEFAULT '1x');
+ERROR 42000: Invalid default value for 'a'
+CREATE TABLE t1 (a INT DEFAULT COALESCE('1x'));
+ERROR 42000: Invalid default value for 'a'
+CREATE TABLE t1 (a INT DEFAULT CONCAT('1x'));
+ERROR 42000: Invalid default value for 'a'
+#
+# INT: string expressions with numbers + trailing space
+#
+CREATE TABLE t1 (a INT DEFAULT '1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT 1
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT DEFAULT CONCAT('1 '));
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT concat('1 ')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT DEFAULT COALESCE('1 '));
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT coalesce('1 ')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
+#
+# INT: a HEX value
+#
+CREATE TABLE t1 (a INT DEFAULT 0x61 NOT NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL DEFAULT 97
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+SELECT * FROM t1;
+a
+97
+DROP TABLE t1;
+#
+# VARCHAR: good defaults
+#
+CREATE TABLE t1 (a VARCHAR(30) DEFAULT 'xxx' NOT NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(30) NOT NULL DEFAULT 'xxx'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+SELECT * FROM t1;
+a
+xxx
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(2) DEFAULT 0x41 NOT NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(2) NOT NULL DEFAULT 'A'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(2) DEFAULT CONCAT(0x41) NOT NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(2) NOT NULL DEFAULT concat(0x41)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+SELECT * FROM t1;
+a
+A
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(2) DEFAULT COALESCE(0x41) NOT NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(2) NOT NULL DEFAULT coalesce(0x41)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+SELECT * FROM t1;
+a
+A
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(2) DEFAULT CONCAT(_utf8 0x41) NOT NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(2) NOT NULL DEFAULT concat(_utf8'A')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+SELECT * FROM t1;
+a
+A
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(2) DEFAULT CONCAT(_utf8 X'41') NOT NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(2) NOT NULL DEFAULT concat(_utf8'A')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT);
+SELECT * FROM t1;
+a
+A
+DROP TABLE t1;
+#
+# VARCHAR: Too long default
+#
+CREATE TABLE t1 (a VARCHAR(2) DEFAULT 'xxx' NOT NULL);
+ERROR 42000: Invalid default value for 'a'
+CREATE TABLE t1 (a VARCHAR(2) DEFAULT CONCAT('xxx') NOT NULL);
+ERROR 42000: Invalid default value for 'a'
+#
+# VARCHAR: Too long default with non-important data
+#
+CREATE TABLE t1 (a VARCHAR(2) DEFAULT 'xx ' NOT NULL);
+ERROR 42000: Invalid default value for 'a'
+CREATE TABLE t1 (a VARCHAR(2) DEFAULT CONCAT('xx ') NOT NULL);
+ERROR 42000: Invalid default value for 'a'
+#
+# VARCHAR: conversion failures
+#
+CREATE TABLE t1 (a VARCHAR(2) CHARACTER SET latin1 DEFAULT _utf8 X'D18F' NOT NULL);
+ERROR 42000: Invalid default value for 'a'
+CREATE TABLE t1 (a VARCHAR(2) CHARACTER SET latin1 DEFAULT CONCAT(_utf8 X'D18F') NOT NULL);
+ERROR 42000: Invalid default value for 'a'
+CREATE TABLE t1 (a VARCHAR(2) CHARACTER SET latin1 DEFAULT CONCAT(_utf8 0xD18F) NOT NULL);
+ERROR 42000: Invalid default value for 'a'
+#
+# Field as a default value
+#
+CREATE TABLE t1 (a INT, b INT DEFAULT (a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT `a`
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+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;
+a b
+1 1
+NULL NULL
+1 1
+NULL 1
+DROP TABLE t1;
+#
+# Function DEFAULT(field)
+#
+CREATE TABLE t1 (a INT DEFAULT(DEFAULT(b)), b INT DEFAULT 1);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT default(`b`),
+ `b` int(11) DEFAULT 1
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT, DEFAULT);
+SELECT * FROM t1;
+a b
+1 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT DEFAULT 1, b INT DEFAULT(DEFAULT(a)));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT 1,
+ `b` int(11) DEFAULT default(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT, DEFAULT);
+SELECT * FROM t1;
+a b
+1 1
+DROP TABLE t1;
+#
+# SQL Standard <datetime value function> as a <default option>
+#
+CREATE TABLE t1 (a DATETIME DEFAULT CURRENT_TIMESTAMP);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` datetime DEFAULT current_timestamp()
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME DEFAULT CURRENT_TIME);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` time DEFAULT curtime()
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE DEFAULT CURRENT_DATE);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT curdate()
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+#
+# DECIMAL + CURRENT_TIMESTAMP, no truncation
+#
+CREATE TABLE t1 (a DECIMAL(30,6) DEFAULT CURRENT_TIMESTAMP(6));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` decimal(30,6) DEFAULT current_timestamp(6)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ();
+SELECT * FROM t1;
+a
+20010101102030.123456
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(30,6) DEFAULT COALESCE(CURRENT_TIMESTAMP(6)));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` decimal(30,6) DEFAULT coalesce(current_timestamp(6))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES();
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+INSERT IGNORE INTO t1 VALUES();
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+SET sql_mode = 'STRICT_ALL_TABLES';
+INSERT INTO t1 VALUES();
+ERROR 01000: Data truncated for column 'a' at row 1
+SET sql_mode = DEFAULT;
+DROP TABLE t1;
+#
+# DECIMAL + CURRENT_TIME, no truncation
+#
+CREATE TABLE t1 (a DECIMAL(30,6) DEFAULT COALESCE(CURRENT_TIME(6)));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` decimal(30,6) DEFAULT coalesce(curtime(6))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT IGNORE INTO t1 VALUES();
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
+#
+# DECIMAL + CURRENT_DATE, no truncation
+#
+CREATE TABLE t1 (a DECIMAL(30,6) DEFAULT COALESCE(CURRENT_DATE));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` decimal(30,6) DEFAULT coalesce(curdate())
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT IGNORE INTO t1 VALUES();
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
+#
+# COALESCE for SQL Standard <datetime value function>
+#
+CREATE TABLE t1 (a TIMESTAMP DEFAULT COALESCE(CURRENT_TIMESTAMP));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp NOT NULL DEFAULT coalesce(current_timestamp())
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE DEFAULT COALESCE(CURRENT_DATE));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT coalesce(curdate())
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME DEFAULT COALESCE(CURRENT_TIME));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` time DEFAULT coalesce(curtime())
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (
+a TIMESTAMP DEFAULT CURRENT_TIMESTAMP(6),
+b TIMESTAMP DEFAULT COALESCE(CURRENT_TIMESTAMP(6))
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp NOT NULL DEFAULT current_timestamp(),
+ `b` timestamp NOT NULL DEFAULT coalesce(current_timestamp(6))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ();
+SELECT CURRENT_TIMESTAMP(6);
+CURRENT_TIMESTAMP(6)
+2001-01-01 10:20:30.123456
+SELECT * FROM t1;
+a b
+2001-01-01 10:20:30 2001-01-01 10:20:30
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` decimal(30,0) DEFAULT current_timestamp(6),
+ `b` decimal(30,0) DEFAULT coalesce(current_timestamp(6))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT IGNORE INTO t1 VALUES ();
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'b' at row 1
+SELECT * FROM t1;
+a b
+20010101102030 2001
+DROP TABLE t1;
+#
+# Check DEFAULT() function
+#
+CREATE TABLE `t1` (`a` int(11) DEFAULT (3+3),`b` int(11) DEFAULT '1000');
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT (3 + 3),
+ `b` int(11) DEFAULT 1000
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values (1,1),(2,2);
+insert into t1 values (default,default);
+select * from t1;
+a b
+1 1
+2 2
+6 1000
+select default(a),b from t1;
+default(a) b
+6 1
+6 2
+6 1000
+select a,default(b) from t1;
+a default(b)
+1 1000
+2 1000
+6 1000
+drop table t1;
+#
+# Real functions
+#
+CREATE TABLE t1 (a DECIMAL(10,1), b DOUBLE DEFAULT CAST(a AS DOUBLE));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` decimal(10,1) DEFAULT NULL,
+ `b` double DEFAULT (cast(`a` as double))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (10.1, DEFAULT);
+SELECT * FROM t1;
+a b
+10.1 10.1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` double DEFAULT NULL,
+ `b` double DEFAULT exp(`a`),
+ `c` double DEFAULT log(`b`),
+ `d` double DEFAULT log(4,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (2, DEFAULT, DEFAULT, DEFAULT);
+SELECT * FROM t1;
+a b c d
+2 7.38905609893065 2 1.4426950408889634
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b DOUBLE DEFAULT LOG2(a), c DOUBLE DEFAULT LOG10(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` double DEFAULT log2(`a`),
+ `c` double DEFAULT log10(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (4, DEFAULT, DEFAULT);
+INSERT INTO t1 VALUES (100, DEFAULT, DEFAULT);
+SELECT * FROM t1;
+a b c
+4 2 0.6020599913279624
+100 6.643856189774725 2
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE, b DOUBLE DEFAULT SQRT(a), c DOUBLE DEFAULT POW(a,3));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` double DEFAULT NULL,
+ `b` double DEFAULT sqrt(`a`),
+ `c` double DEFAULT pow(`a`,3)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (4, DEFAULT, DEFAULT);
+SELECT * FROM t1;
+a b c
+4 2 64
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` double DEFAULT NULL,
+ `b` double DEFAULT acos(`a`),
+ `c` double DEFAULT asin(`a`),
+ `d` double DEFAULT atan(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1, DEFAULT, DEFAULT, DEFAULT);
+SELECT a, b/PI(), c/PI(), d/PI() FROM t1;
+a b/PI() c/PI() d/PI()
+1 0 0.5 0.25
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` double DEFAULT NULL,
+ `b` double DEFAULT cos(`a`),
+ `c` double DEFAULT sin(`a`),
+ `d` double DEFAULT tan(`a`),
+ `e` double DEFAULT cot(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+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;
+ROUND(a,3) ROUND(b,3) ROUND(c,3) ROUND(d,3) ROUND(e,3)
+1.047 0.500 0.866 1.732 0.577
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE DEFAULT RAND());
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` double DEFAULT rand()
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` double DEFAULT NULL,
+ `b` double DEFAULT degrees(`a`),
+ `c` double DEFAULT radians(`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (PI(), DEFAULT, DEFAULT);
+SELECT * FROM t1;
+a b c
+3.141592653589793 180 3.141592653589793
+DROP TABLE t1;
+#
+# INT result functions
+#
+CREATE TABLE t1 (a INT, b INT DEFAULT INTERVAL(a, 10, 20, 30, 40));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT interval(`a`,10,20,30,40)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (34);
+SELECT * FROM t1;
+a b
+34 3
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, c INT DEFAULT (a DIV b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT (`a` DIV `b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a, b) VALUES (13, 3);
+SELECT * FROM t1;
+a b c
+13 3 4
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT DEFAULT SIGN(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT sign(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (-10),(0), (10);
+SELECT * FROM t1;
+a b
+-10 -1
+0 0
+10 1
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(30), b INT DEFAULT FIELD(a, 'Hej', 'ej', 'Heja', 'hej', 'foo'));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(30) DEFAULT NULL,
+ `b` int(11) DEFAULT field(`a`,'Hej','ej','Heja','hej','foo')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('ej');
+SELECT * FROM t1;
+a b
+ej 2
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(30) DEFAULT NULL,
+ `b` int(11) DEFAULT find_in_set(`a`,'Hej,ej,Heja,hej,foo')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('ej');
+SELECT * FROM t1;
+a b
+ej 2
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(30), b INT DEFAULT ASCII(a), c INT DEFAULT ORD(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(30) DEFAULT NULL,
+ `b` int(11) DEFAULT ascii(`a`),
+ `c` int(11) DEFAULT ord(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('a');
+SELECT * FROM t1;
+a b c
+a 97 97
+DROP TABLE t1;
+CREATE TABLE t1 (a TEXT DEFAULT UUID_SHORT());
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text DEFAULT uuid_short()
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ();
+SELECT a>0 FROM t1;
+a>0
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT DEFAULT BENCHMARK(1,1));
+ERROR HY000: Function or expression 'benchmark()' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT GET_LOCK('a',1));
+ERROR HY000: Function or expression 'get_lock()' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT RELEASE_LOCK('a'));
+ERROR HY000: Function or expression 'release_lock()' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT IS_USED_LOCK('a'));
+ERROR HY000: Function or expression 'is_used_lock()' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT IS_FREE_LOCK('a'));
+ERROR HY000: Function or expression 'is_free_lock()' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT SLEEP(1));
+ERROR HY000: Function or expression 'sleep()' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT ROW_COUNT());
+ERROR HY000: Function or expression 'row_count()' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT FOUND_ROWS());
+ERROR HY000: Function or expression 'found_rows()' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT MASTER_POS_WAIT('test',100));
+ERROR HY000: Function or expression 'master_pos_wait()' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a INT DEFAULT MASTER_GTID_WAIT('test'));
+ERROR HY000: Function or expression 'master_gtid_wait()' cannot be used in the DEFAULT clause of `a`
+CREATE TABLE t1 (a VARCHAR(30), b DOUBLE DEFAULT MATCH (a) AGAINST('bbbb' IN BOOLEAN MODE));
+ERROR HY000: Function or expression 'match ... against()' cannot be used in the DEFAULT clause of `b`
+#
+# Temporal functions
+#
+# Item_temporal_hybrid_func
+CREATE TABLE t1 (a DATE, b INT, c DATE DEFAULT DATE_ADD(a, INTERVAL b DAY));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` date DEFAULT (`a` + interval `b` day)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('2001-01-01', 30, DEFAULT);
+SELECT * FROM t1;
+a b c
+2001-01-01 30 2001-01-31
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b TIME, c DATETIME DEFAULT ADDTIME(a, b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL,
+ `b` time DEFAULT NULL,
+ `c` datetime DEFAULT addtime(`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('2001-01-01', '10:20:30', DEFAULT);
+SELECT * FROM t1;
+a b c
+2001-01-01 10:20:30 2001-01-01 10:20:30
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(32), b VARCHAR(32), c DATE DEFAULT STR_TO_DATE(a,b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(32) DEFAULT NULL,
+ `b` varchar(32) DEFAULT NULL,
+ `c` date DEFAULT str_to_date(`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('01,5,2013','%d,%m,%Y', DEFAULT);
+SELECT * FROM t1;
+a b c
+01,5,2013 %d,%m,%Y 2013-05-01
+DROP TABLE t1;
+# 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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT curdate(),
+ `b` date DEFAULT utc_date()
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ();
+SELECT * FROM t1;
+a b
+2001-01-01 2001-01-02
+DROP TABLE t1;
+SET time_zone=DEFAULT, timestamp= DEFAULT;
+CREATE TABLE t1 (a INT, b DATE DEFAULT FROM_DAYS(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` date DEFAULT from_days(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (730669, DEFAULT);
+SELECT * FROM t1;
+a b
+730669 2000-07-03
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b DATE DEFAULT LAST_DAY(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL,
+ `b` date DEFAULT last_day(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('2003-02-05', DEFAULT);
+SELECT * FROM t1;
+a b
+2003-02-05 2003-02-28
+DROP TABLE t1;
+CREATE TABLE t1 (yy INT, yd INT, d DATE DEFAULT MAKEDATE(yy, yd));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `yy` int(11) DEFAULT NULL,
+ `yd` int(11) DEFAULT NULL,
+ `d` date DEFAULT makedate(`yy`,`yd`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (2011,32,DEFAULT);
+SELECT * FROM t1;
+yy yd d
+2011 32 2011-02-01
+DROP TABLE t1;
+# 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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` time DEFAULT curtime(),
+ `b` time DEFAULT utc_time()
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ();
+SELECT * FROM t1;
+a b
+23:59:59 09:59:59
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` time DEFAULT sec_to_time(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (2378, DEFAULT);
+SELECT * FROM t1;
+a b
+2378 00:39:38
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME, b DATETIME, c TIME DEFAULT TIMEDIFF(a,b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` datetime DEFAULT NULL,
+ `b` datetime DEFAULT NULL,
+ `c` time DEFAULT timediff(`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('2000:01:01 00:00:00', '2000:01:02 10:20:30', DEFAULT);
+SELECT * FROM t1;
+a b c
+2000-01-01 00:00:00 2000-01-02 10:20:30 -34:20:30
+DROP TABLE t1;
+CREATE TABLE t1 (hh INT, mm INT, ss INT, t TIME DEFAULT MAKETIME(hh,mm,ss));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `hh` int(11) DEFAULT NULL,
+ `mm` int(11) DEFAULT NULL,
+ `ss` int(11) DEFAULT NULL,
+ `t` time DEFAULT maketime(`hh`,`mm`,`ss`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (10,20,30,DEFAULT);
+SELECT * FROM t1;
+hh mm ss t
+10 20 30 10:20:30
+DROP TABLE t1;
+# 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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp NOT NULL DEFAULT current_timestamp(),
+ `b` timestamp NOT NULL DEFAULT utc_timestamp()
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ();
+SELECT * FROM t1;
+a b
+2001-01-01 23:59:59 2001-01-02 09:59:59
+DROP TABLE t1;
+SET time_zone=DEFAULT, timestamp= DEFAULT;
+CREATE TABLE t1 (a TIMESTAMP(6) DEFAULT SYSDATE(6), s INT, b TIMESTAMP(6) DEFAULT SYSDATE(6));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp(6) NOT NULL DEFAULT sysdate(6),
+ `s` int(11) DEFAULT NULL,
+ `b` timestamp(6) NOT NULL DEFAULT sysdate(6)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (DEFAULT(a), SLEEP(0.1), DEFAULT(b));
+SELECT b>a FROM t1;
+b>a
+1
+DROP TABLE t1;
+SET time_zone='+00:00';
+CREATE TABLE t1 (a INT, b TIMESTAMP DEFAULT FROM_UNIXTIME(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` timestamp NOT NULL DEFAULT from_unixtime(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1447430881, DEFAULT);
+SELECT * FROM t1;
+a b
+1447430881 2015-11-13 16:08:01
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `b` timestamp NOT NULL DEFAULT convert_tz(`a`,'-10:00','+10:00')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('2001-01-01 10:20:30', DEFAULT);
+SELECT * FROM t1;
+a b
+2001-01-01 10:20:30 2001-01-02 06:20:30
+DROP TABLE t1;
+# Item_temporal_typecast
+CREATE TABLE t1 (a INT, b DATE DEFAULT CAST(a AS DATE));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` date DEFAULT cast(`a` as date)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (20010203, DEFAULT);
+SELECT * FROM t1;
+a b
+20010203 2001-02-03
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b TIME DEFAULT CAST(a AS TIME));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` time DEFAULT cast(`a` as time)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (102030, DEFAULT);
+SELECT * FROM t1;
+a b
+102030 10:20:30
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT, b DATETIME DEFAULT CAST(a AS DATETIME));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) DEFAULT NULL,
+ `b` datetime DEFAULT cast(`a` as datetime)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (20010203102030, DEFAULT);
+SELECT * FROM t1;
+a b
+20010203102030 2001-02-03 10:20:30
+DROP TABLE t1;
+#
+# Functions with temporal input
+#
+CREATE TABLE t1 (a INT, b INT, c INT DEFAULT PERIOD_ADD(a,b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT period_add(`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES (200801, 2);
+SELECT * FROM t1;
+a b c
+200801 2 200803
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, c INT DEFAULT PERIOD_DIFF(a,b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT period_diff(`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES (200802, 200703);
+SELECT * FROM t1;
+a b c
+200802 200703 11
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT DEFAULT TO_DAYS(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT to_days(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (950501);
+SELECT * FROM t1;
+a b
+950501 728779
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b INT DEFAULT TO_DAYS(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL,
+ `b` int(11) DEFAULT to_days(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('2007-10-07');
+SELECT * FROM t1;
+a b
+2007-10-07 733321
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b BIGINT DEFAULT TO_SECONDS(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` bigint(20) DEFAULT to_seconds(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (950501);
+SELECT * FROM t1;
+a b
+950501 62966505600
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b BIGINT DEFAULT TO_SECONDS(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL,
+ `b` bigint(20) DEFAULT to_seconds(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('2009-11-29');
+SELECT * FROM t1;
+a b
+2009-11-29 63426672000
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME, b BIGINT DEFAULT TO_SECONDS(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` datetime DEFAULT NULL,
+ `b` bigint(20) DEFAULT to_seconds(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('2009-11-29 13:43:32');
+SELECT * FROM t1;
+a b
+2009-11-29 13:43:32 63426721412
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b BIGINT DEFAULT DAYOFMONTH(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL,
+ `b` bigint(20) DEFAULT dayofmonth(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('2007-02-03');
+SELECT * FROM t1;
+a b
+2007-02-03 3
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b BIGINT DEFAULT DAYOFWEEK(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL,
+ `b` bigint(20) DEFAULT dayofweek(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('2007-02-03');
+SELECT * FROM t1;
+a b
+2007-02-03 7
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b BIGINT DEFAULT DAYOFYEAR(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL,
+ `b` bigint(20) DEFAULT dayofyear(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('2007-02-03');
+SELECT * FROM t1;
+a b
+2007-02-03 34
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME, b INT DEFAULT HOUR(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` time DEFAULT NULL,
+ `b` int(11) DEFAULT hour(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('10:05:03');
+SELECT * FROM t1;
+a b
+10:05:03 10
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME, b INT DEFAULT MINUTE(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` time DEFAULT NULL,
+ `b` int(11) DEFAULT minute(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('10:05:03');
+SELECT * FROM t1;
+a b
+10:05:03 5
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME, b INT DEFAULT SECOND(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` time DEFAULT NULL,
+ `b` int(11) DEFAULT second(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('10:05:03');
+SELECT * FROM t1;
+a b
+10:05:03 3
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME(6), b INT DEFAULT MICROSECOND(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` datetime(6) DEFAULT NULL,
+ `b` int(11) DEFAULT microsecond(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('2009-12-31 23:59:59.000010');
+SELECT * FROM t1;
+a b
+2009-12-31 23:59:59.000010 10
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b INT DEFAULT YEAR(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL,
+ `b` int(11) DEFAULT year(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('1987-01-01');
+SELECT * FROM t1;
+a b
+1987-01-01 1987
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b INT DEFAULT MONTH(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL,
+ `b` int(11) DEFAULT month(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('1987-01-01');
+SELECT * FROM t1;
+a b
+1987-01-01 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b INT DEFAULT WEEK(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL,
+ `b` int(11) DEFAULT week(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('1987-02-01');
+SELECT * FROM t1;
+a b
+1987-02-01 5
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b INT DEFAULT YEARWEEK(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL,
+ `b` int(11) DEFAULT yearweek(`a`,0)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('2000-01-01');
+SELECT * FROM t1;
+a b
+2000-01-01 199952
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b INT DEFAULT QUARTER(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL,
+ `b` int(11) DEFAULT quarter(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('2008-04-01');
+SELECT * FROM t1;
+a b
+2008-04-01 2
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b INT DEFAULT EXTRACT(YEAR FROM a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL,
+ `b` int(11) DEFAULT extract(year from `a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('2009-07-02');
+SELECT * FROM t1;
+a b
+2009-07-02 2009
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME, b INT DEFAULT EXTRACT(YEAR_MONTH FROM a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` datetime DEFAULT NULL,
+ `b` int(11) DEFAULT extract(year_month from `a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('2009-07-02 01:02:03');
+SELECT * FROM t1;
+a b
+2009-07-02 01:02:03 200907
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME, b INT DEFAULT EXTRACT(DAY_MINUTE FROM a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` datetime DEFAULT NULL,
+ `b` int(11) DEFAULT extract(day_minute from `a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('2009-07-02 01:02:03');
+SELECT * FROM t1;
+a b
+2009-07-02 01:02:03 20102
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME(6), b INT DEFAULT EXTRACT(MICROSECOND FROM a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` datetime(6) DEFAULT NULL,
+ `b` int(11) DEFAULT extract(microsecond from `a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('2009-07-02 01:02:03.000123');
+SELECT * FROM t1;
+a b
+2009-07-02 01:02:03.000123 123
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b DATE, c INT DEFAULT TIMESTAMPDIFF(MONTH,a,b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL,
+ `b` date DEFAULT NULL,
+ `c` int(11) DEFAULT timestampdiff(MONTH,`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES ('2003-02-01','2003-05-01');
+SELECT * FROM t1;
+a b c
+2003-02-01 2003-05-01 3
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b DATE, c INT DEFAULT TIMESTAMPDIFF(YEAR,a,b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL,
+ `b` date DEFAULT NULL,
+ `c` int(11) DEFAULT timestampdiff(YEAR,`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES ('2002-05-01','2001-01-01');
+SELECT * FROM t1;
+a b c
+2002-05-01 2001-01-01 -1
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b DATETIME, c INT DEFAULT TIMESTAMPDIFF(MINUTE,a,b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL,
+ `b` datetime DEFAULT NULL,
+ `c` int(11) DEFAULT timestampdiff(MINUTE,`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES ('2003-02-01','2003-05-01 12:05:55');
+SELECT * FROM t1;
+a b c
+2003-02-01 2003-05-01 12:05:55 128885
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 ( col INT DEFAULT ( 1 LIKE ( NOW() BETWEEN '2000-01-01' AND '2012-12-12' ) ) );
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `col` int(11) DEFAULT (1 like (current_timestamp() between '2000-01-01' and '2012-12-12'))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SET timestamp = UNIX_TIMESTAMP( '2004-04-04' );
+INSERT INTO t1 VALUES( DEFAULT );
+SET timestamp = DEFAULT;
+INSERT INTO t1 VALUES( DEFAULT );
+SELECT * FROM t1;
+col
+1
+0
+DROP TABLE t1;
+#
+# Hybrid type functions
+#
+CREATE TABLE t1 (a INT, b INT, c INT DEFAULT COALESCE(a,b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT coalesce(`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (NULL, 1, DEFAULT);
+SELECT * FROM t1;
+a b c
+NULL 1 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, c INT DEFAULT IFNULL(a,b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT ifnull(`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (NULL, 2, DEFAULT);
+INSERT INTO t1 VALUES (1, 2, DEFAULT);
+SELECT * FROM t1;
+a b c
+NULL 2 2
+1 2 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, c INT DEFAULT NULLIF(a,b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT nullif(`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1, 1, DEFAULT);
+INSERT INTO t1 VALUES (1, 2, DEFAULT);
+SELECT * FROM t1;
+a b c
+1 1 NULL
+1 2 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, c INT DEFAULT IF(a,b,2));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT if(`a`,`b`,2)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (0, 1, DEFAULT);
+INSERT INTO t1 VALUES (1, 1, DEFAULT);
+SELECT * FROM t1;
+a b c
+0 1 2
+1 1 1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT (case when `a` then `b` else 2 end)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (0, 1, DEFAULT);
+INSERT INTO t1 VALUES (1, 1, DEFAULT);
+SELECT * FROM t1;
+a b c
+0 1 2
+1 1 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT DEFAULT (-a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT (-`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT (-`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (10, DEFAULT);
+SELECT * FROM t1;
+a b
+10 -10
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT DEFAULT ABS(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT abs(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (-10, DEFAULT);
+SELECT * FROM t1;
+a b
+-10 10
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` double DEFAULT NULL,
+ `b` int(11) DEFAULT ceiling(`a`),
+ `c` int(11) DEFAULT floor(`a`),
+ `d` int(11) DEFAULT round(`a`,0)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1.5, DEFAULT, DEFAULT, DEFAULT);
+INSERT INTO t1 VALUES (-1.5, DEFAULT, DEFAULT, DEFAULT);
+SELECT * FROM t1;
+a b c d
+1.5 2 1 2
+-1.5 -1 -2 -2
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, c INT DEFAULT (a+b), d INT DEFAULT (a-b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT (`a` + `b`),
+ `d` int(11) DEFAULT (`a` - `b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (2, 1, DEFAULT, DEFAULT);
+SELECT * FROM t1;
+a b c d
+2 1 3 1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT (`a` * `b`),
+ `d` int(11) DEFAULT (`a` / `b`),
+ `e` int(11) DEFAULT (`a` % `b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT (`a` * `b`),
+ `d` int(11) DEFAULT (`a` / `b`),
+ `e` int(11) DEFAULT (`a` % `b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (7, 3, DEFAULT, DEFAULT, DEFAULT);
+SELECT * FROM t1;
+a b c d e
+7 3 21 2 1
+DROP TABLE t1;
+SET time_zone='+00:00';
+CREATE TABLE t1 (a DATETIME, b INT DEFAULT UNIX_TIMESTAMP(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` datetime DEFAULT NULL,
+ `b` int(11) DEFAULT unix_timestamp(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('2001-01-01 10:20:30', DEFAULT);
+SELECT * FROM t1;
+a b
+2001-01-01 10:20:30 978344430
+DROP TABLE t1;
+SET time_zone=DEFAULT;
+CREATE TABLE t1 (a TIME, b INT DEFAULT TIME_TO_SEC(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` time DEFAULT NULL,
+ `b` int(11) DEFAULT time_to_sec(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('22:23:00', DEFAULT);
+SELECT * FROM t1;
+a b
+22:23:00 80580
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT least(`a`,`b`),
+ `d` int(11) DEFAULT greatest(`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (0, 1, DEFAULT, DEFAULT);
+INSERT INTO t1 VALUES (1, 1, DEFAULT, DEFAULT);
+SELECT * FROM t1;
+a b c d
+0 1 0 1
+1 1 1 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, c INT DEFAULT LAST_VALUE(a,b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT last_value(`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1, 2, DEFAULT);
+SELECT * FROM t1;
+a b c
+1 2 2
+DROP TABLE t1;
+#
+# CAST
+#
+CREATE TABLE t1 (a VARCHAR(30), b DECIMAL(10,6) DEFAULT CAST(a AS DECIMAL(10,1)));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(30) DEFAULT NULL,
+ `b` decimal(10,6) DEFAULT (cast(`a` as decimal(10,1)))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('123.456');
+SELECT * FROM t1;
+a b
+123.456 123.500000
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` decimal(10,3) DEFAULT NULL,
+ `b` varchar(10) DEFAULT (cast(`a` as char(10) charset latin1)),
+ `c` varchar(10) DEFAULT (cast(`a` as char(4) charset latin1))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT IGNORE INTO t1 (a) VALUES (123.456);
+Warnings:
+Warning 1292 Truncated incorrect CHAR(4) value: '123.456'
+SELECT * FROM t1;
+a b c
+123.456 123.456 123.
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT UNSIGNED DEFAULT CAST(a AS UNSIGNED));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(10) unsigned DEFAULT (cast(`a` as unsigned))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT IGNORE INTO t1 (a) VALUES (-1);
+Warnings:
+Note 1105 Cast to unsigned converted negative integer to it's positive complement
+Warning 1264 Out of range value for column 'b' at row 1
+SELECT * FROM t1;
+a b
+-1 4294967295
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT UNSIGNED, b BIGINT SIGNED DEFAULT CAST(a AS SIGNED));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned DEFAULT NULL,
+ `b` bigint(20) DEFAULT (cast(`a` as signed))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (0xFFFFFFFFFFFFFFFF);
+SELECT * FROM t1;
+a b
+18446744073709551615 -1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT `a`,
+ `c` varchar(10) CHARACTER SET utf8 DEFAULT convert(`a` using utf8),
+ `d` varbinary(10) DEFAULT (cast(`a` as char charset binary))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('a');
+SELECT * FROM t1;
+a b c d
+a a a a
+DROP TABLE t1;
+#
+# Bit functions
+#
+CREATE TABLE t1 (a INT, b INT DEFAULT BIT_COUNT(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT bit_count(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (7);
+SELECT * FROM t1;
+a b
+7 3
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, c INT DEFAULT (a|b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT (`a` | `b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES (1,2);
+SELECT * FROM t1;
+a b c
+1 2 3
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, c INT DEFAULT (a&b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT (`a` & `b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES (5,4);
+SELECT * FROM t1;
+a b c
+5 4 4
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, c INT DEFAULT (a^b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT (`a` ^ `b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES (11,3);
+SELECT * FROM t1;
+a b c
+11 3 8
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, c INT DEFAULT (a&~b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT (`a` & ~`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES (5,1);
+SELECT * FROM t1;
+a b c
+5 1 4
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, c INT DEFAULT (a<<b), d INT DEFAULT (a>>b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT (`a` << `b`),
+ `d` int(11) DEFAULT (`a` >> `b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES (5,1);
+SELECT * FROM t1;
+a b c d
+5 1 10 2
+DROP TABLE t1;
+#
+# String functions
+#
+CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(20) DEFAULT REVERSE(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(20) DEFAULT reverse(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('abcd');
+SELECT * FROM t1;
+a b
+abcd dcba
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(10) DEFAULT ucase(`a`),
+ `c` varchar(10) DEFAULT lcase(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('ABcd');
+SELECT * FROM t1;
+a b c
+ABcd ABCD abcd
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(10) DEFAULT left(`a`,1),
+ `c` varchar(10) DEFAULT right(`a`,1),
+ `d` varchar(10) DEFAULT substr(`a`,2,2)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('abcd');
+SELECT * FROM t1;
+a b c d
+abcd a d bc
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(20), b VARCHAR(20) DEFAULT SUBSTRING_INDEX(a,'.',2));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(20) DEFAULT NULL,
+ `b` varchar(20) DEFAULT substring_index(`a`,'.',2)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('www.mariadb.org');
+SELECT * FROM t1;
+a b
+www.mariadb.org www.mariadb
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10), c VARCHAR(20) DEFAULT CONCAT(a,b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(10) DEFAULT NULL,
+ `c` varchar(20) DEFAULT concat(`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES ('a','b');
+SELECT * FROM t1;
+a b c
+a b ab
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10), c VARCHAR(20) DEFAULT CONCAT_WS(',',a,b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(10) DEFAULT NULL,
+ `c` varchar(20) DEFAULT concat_ws(',',`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES ('a','b');
+SELECT * FROM t1;
+a b c
+a b a,b
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10) DEFAULT REPLACE(a,'a','A'));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(10) DEFAULT replace(`a`,'a','A')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('abc');
+SELECT * FROM t1;
+a b
+abc Abc
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10) DEFAULT REGEXP_REPLACE(a,'[0-9]','.'));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(10) DEFAULT regexp_replace(`a`,'[0-9]','.')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('a1b2c');
+SELECT * FROM t1;
+a b
+a1b2c a.b.c
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10) DEFAULT REGEXP_SUBSTR(a,'[0-9]+'));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(10) DEFAULT regexp_substr(`a`,'[0-9]+')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('ab12cd');
+SELECT * FROM t1;
+a b
+ab12cd 12
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(20), b VARCHAR(20) DEFAULT SOUNDEX(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(20) DEFAULT NULL,
+ `b` varchar(20) DEFAULT soundex(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('tester');
+SELECT * FROM t1;
+a b
+tester T236
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(20), b VARCHAR(20) DEFAULT QUOTE(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(20) DEFAULT NULL,
+ `b` varchar(20) DEFAULT quote(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('a\'b');
+SELECT * FROM t1;
+a b
+a'b 'a\'b'
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(10) DEFAULT lpad(`a`,10,'.'),
+ `c` varchar(10) DEFAULT rpad(`a`,10,'.')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('ab');
+SELECT * FROM t1;
+a b c
+ab ........ab ab........
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(10) DEFAULT ltrim(`a`),
+ `c` varchar(10) DEFAULT rtrim(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (' ab ');
+SELECT a, HEX(b), HEX(c) FROM t1;
+a HEX(b) HEX(c)
+ ab 616220 206162
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10) DEFAULT TRIM(BOTH 'a' FROM a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(10) DEFAULT trim(both 'a' from `a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('abba');
+SELECT a, b FROM t1;
+a b
+abba bb
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b VARCHAR(10) DEFAULT SPACE(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(10) DEFAULT space(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (3);
+SELECT a, HEX(b) FROM t1;
+a HEX(b)
+3 202020
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b VARCHAR(10), c VARCHAR(10) DEFAULT REPEAT(b,a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(10) DEFAULT NULL,
+ `c` varchar(10) DEFAULT repeat(`b`,`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES (3,'x');
+SELECT a, b, c FROM t1;
+a b c
+3 x xxx
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `str` varchar(10) DEFAULT NULL,
+ `pos` int(11) DEFAULT NULL,
+ `len` int(11) DEFAULT NULL,
+ `newstr` varchar(10) DEFAULT NULL,
+ `result` varchar(10) DEFAULT insert(`str`,`pos`,`len`,`newstr`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (str,pos,len,newstr) VALUES ('Quadratic', 3, 4, 'What');
+SELECT * FROM t1;
+str pos len newstr result
+Quadratic 3 4 What QuWhattic
+DROP TABLE t1;
+CREATE TABLE t1 (n INT, res VARCHAR(10) DEFAULT ELT(n,'ej', 'Heja', 'hej', 'foo'));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `n` int(11) DEFAULT NULL,
+ `res` varchar(10) DEFAULT elt(`n`,'ej','Heja','hej','foo')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (n) VALUES (1);
+SELECT * FROM t1;
+n res
+1 ej
+DROP TABLE t1;
+CREATE TABLE t1 (bits INT, res VARCHAR(10) DEFAULT MAKE_SET(bits,'a','b','c','d'));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `bits` int(11) DEFAULT NULL,
+ `res` varchar(10) DEFAULT make_set(`bits`,'a','b','c','d')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (bits) VALUES (1|4);
+SELECT * FROM t1;
+bits res
+5 a,c
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b VARCHAR(10) DEFAULT CHAR(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(10) DEFAULT char(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (77);
+SELECT * FROM t1;
+a b
+77 M
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b VARCHAR(10) DEFAULT CONV(a,10,16));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(10) DEFAULT conv(`a`,10,16)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (64);
+SELECT * FROM t1;
+a b
+64 40
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, c VARCHAR(30) DEFAULT FORMAT(a,b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` varchar(30) DEFAULT format(`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES (10000,3);
+SELECT * FROM t1;
+a b c
+10000 3 10,000.000
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `l` varchar(10) DEFAULT NULL,
+ `c` varchar(30) DEFAULT format(`a`,`b`,`l`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b,l) VALUES (10000,2,'no_NO'),(10000,2,'ru_RU'),(10000,2,'ar_BH');
+SELECT * FROM t1;
+a b l c
+10000 2 no_NO 10.000,00
+10000 2 ru_RU 10 000,00
+10000 2 ar_BH 10,000.00
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(20) DEFAULT GET_FORMAT(DATE,a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(20) DEFAULT get_format(DATE, `a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('EUR'),('USA'),('JIS'),('ISO'),('INTERNAL');
+SELECT * FROM t1;
+a b
+EUR %d.%m.%Y
+USA %m.%d.%Y
+JIS %Y-%m-%d
+ISO %Y-%m-%d
+INTERNAL %Y%m%d
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `bits` int(11) DEFAULT NULL,
+ `v_on` varchar(10) DEFAULT NULL,
+ `v_off` varchar(10) DEFAULT NULL,
+ `v_separator` varchar(10) DEFAULT NULL,
+ `number_of_bits` int(11) DEFAULT NULL,
+ `x` varchar(30) DEFAULT export_set(`bits`,`v_on`,`v_off`,`v_separator`,`number_of_bits`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT IGNORE INTO t1 VALUES (0x50006,'Y','N','',64,DEFAULT);
+Warnings:
+Warning 1265 Data truncated for column 'x' at row 1
+SELECT * FROM t1;
+bits v_on v_off v_separator number_of_bits x
+327686 Y N 64 NYYNNNNNNNNNNNNNYNYNNNNNNNNNNN
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(30), b BLOB DEFAULT LOAD_FILE(a));
+ERROR HY000: Function or expression 'load_file()' cannot be used in the DEFAULT clause of `b`
+#
+# Predicates
+#
+CREATE TABLE t1 (a INT, b INT DEFAULT (NOT a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT (`a` = 0)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (NULL),(0),(1);
+SELECT * FROM t1;
+a b
+NULL NULL
+0 1
+1 0
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, x INT DEFAULT (a XOR b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `x` int(11) DEFAULT (`a` xor `b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES (0,0),(0,1),(1,0),(1,1);
+SELECT * FROM t1;
+a b x
+0 0 0
+0 1 1
+1 0 1
+1 1 0
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT (`a` is true),
+ `c` int(11) DEFAULT (`a` is not true)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (NULL),(0),(1);
+SELECT * FROM t1;
+a b c
+NULL 0 1
+0 0 1
+1 1 0
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT (`a` is false),
+ `c` int(11) DEFAULT (`a` is not false)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (NULL),(0),(1);
+SELECT * FROM t1;
+a b c
+NULL 0 1
+0 1 0
+1 0 1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT (`a` is null),
+ `c` int(11) DEFAULT (`a` is not null)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (NULL),(0),(1);
+SELECT * FROM t1;
+a b c
+NULL 1 0
+0 0 1
+1 0 1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT (`a` is null),
+ `c` int(11) DEFAULT (`a` is not null)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (NULL),(0),(1);
+SELECT * FROM t1;
+a b c
+NULL 1 0
+0 0 1
+1 0 1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `eq` int(11) DEFAULT (`a` = 0),
+ `equal` int(11) DEFAULT (`a` <=> 0),
+ `ne` int(11) DEFAULT (`a` <> 0),
+ `lt` int(11) DEFAULT (`a` < 0),
+ `le` int(11) DEFAULT (`a` <= 0),
+ `gt` int(11) DEFAULT (`a` > 0),
+ `ge` int(11) DEFAULT (`a` >= 0)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (NULL),(-1),(0),(1);
+SELECT * FROM t1;
+a eq equal ne lt le gt ge
+NULL NULL 0 NULL NULL NULL NULL NULL
+-1 0 0 1 1 1 0 0
+0 1 1 0 0 1 0 1
+1 0 0 1 0 0 1 1
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT (a LIKE 'a%'));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` int(11) DEFAULT (`a` like 'a%')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb');
+SELECT * FROM t1;
+a b
+AAA 1
+aaa 1
+bbb 0
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT (a RLIKE 'a$'));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` int(11) DEFAULT (`a` regexp 'a$')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb');
+SELECT * FROM t1;
+a b
+AAA 1
+aaa 1
+bbb 0
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT (a IN ('aaa','bbb')));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` int(11) DEFAULT (`a` in ('aaa','bbb'))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc');
+SELECT * FROM t1;
+a b
+AAA 1
+aaa 1
+bbb 1
+ccc 0
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT (a NOT IN ('aaa','bbb')));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` int(11) DEFAULT (`a` not in ('aaa','bbb'))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc');
+SELECT * FROM t1;
+a b
+AAA 0
+aaa 0
+bbb 0
+ccc 1
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT (a BETWEEN 'aaa' AND 'bbb'));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` int(11) DEFAULT (`a` between 'aaa' and 'bbb')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc');
+SELECT * FROM t1;
+a b
+AAA 1
+aaa 1
+bbb 1
+ccc 0
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT (a NOT BETWEEN 'aaa' AND 'bbb'));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` int(11) DEFAULT (`a` not between 'aaa' and 'bbb')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc');
+SELECT * FROM t1;
+a b
+AAA 0
+aaa 0
+bbb 0
+ccc 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TEXT DEFAULT UUID());
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text DEFAULT uuid()
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ();
+SELECT LENGTH(a)>0 FROM t1;
+LENGTH(a)>0
+1
+DROP TABLE t1;
+#
+# Numeric result functions with string input
+#
+CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT STRCMP(a,'b'));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` int(11) DEFAULT strcmp(`a`,'b')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('A'),('a'),('B'),('b'),('C'),('c');
+SELECT * FROM t1;
+a b
+A -1
+a -1
+B 0
+b 0
+C 1
+c 1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` int(11) DEFAULT length(`a`),
+ `c` int(11) DEFAULT char_length(`a`),
+ `d` int(11) DEFAULT bit_length(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('a'),('aa'),('aaa');
+SELECT * FROM t1;
+a b c d
+a 1 1 8
+aa 2 2 16
+aaa 3 3 24
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT LOCATE('a',a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` int(11) DEFAULT locate('a',`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('xa'),('xxa'),('xxxa');
+SELECT * FROM t1;
+a b
+xa 2
+xxa 3
+xxxa 4
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT REGEXP_INSTR(a, 'a'));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` int(11) DEFAULT regexp_instr(`a`,'a')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('xa'),('xxa'),('xxxa');
+SELECT * FROM t1;
+a b
+xa 2
+xxa 3
+xxxa 4
+DROP TABLE t1;
+#
+# INT result metadata functions
+#
+CREATE TABLE t1
+(
+id SERIAL PRIMARY KEY,
+b INT DEFAULT LAST_INSERT_ID()
+);
+ERROR HY000: Function or expression 'last_insert_id()' cannot be used in the DEFAULT clause of `b`
+CREATE TABLE t1 (a INT DEFAULT CONNECTION_ID());
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT connection_id()
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES();
+SELECT a>0 FROM t1;
+a>0
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT COERCIBILITY(a), c INT DEFAULT COERCIBILITY(b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` int(11) DEFAULT coercibility(`a`),
+ `c` int(11) DEFAULT coercibility(`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('test');
+SELECT * FROM t1;
+a b c
+test 2 5
+DROP TABLE t1;
+#
+# String result metadata functions
+#
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(20) DEFAULT charset(`a`),
+ `c` varchar(20) DEFAULT collation(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('test');
+SELECT * FROM t1;
+a b c
+test latin1 latin1_swedish_ci
+DROP TABLE t1;
+#
+# Hash, compression, encode/decode
+#
+CREATE TABLE t1 (a VARCHAR(10), b BIGINT DEFAULT CRC32(a), c TEXT DEFAULT MD5(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` bigint(20) DEFAULT crc32(`a`),
+ `c` text DEFAULT md5(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('a');
+SELECT * FROM t1;
+a b c
+a 3904355907 0cc175b9c0f1b6a831c399e269772661
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` text DEFAULT to_base64(`a`),
+ `c` text DEFAULT from_base64(`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('aaaabbbb');
+SELECT * FROM t1;
+a b c
+aaaabbbb YWFhYWJiYmI= aaaabbbb
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10), b TEXT DEFAULT HEX(a), c TEXT DEFAULT UNHEX(b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` text DEFAULT hex(`a`),
+ `c` text DEFAULT unhex(`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('aaaabbbb');
+SELECT * FROM t1;
+a b c
+aaaabbbb 6161616162626262 aaaabbbb
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` text DEFAULT encode(`a`,'test'),
+ `c` text DEFAULT decode(`b`,'test')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('aaaabbbb');
+SELECT a, HEX(b), c FROM t1;
+a HEX(b) c
+aaaabbbb 059AEEE33E4AF848 aaaabbbb
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(30), b TEXT DEFAULT PASSWORD(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(30) DEFAULT NULL,
+ `b` text DEFAULT password(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('notagoodpwd');
+SELECT * FROM t1;
+a b
+notagoodpwd *3A70EE9FC6594F88CE9E959CD51C5A1C002DC937
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(30) DEFAULT NULL,
+ `b` blob DEFAULT aes_encrypt(`a`,'passwd'),
+ `c` text DEFAULT aes_decrypt(`b`,'passwd')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('test');
+SELECT c FROM t1;
+c
+test
+DROP TABLE t1;
+#
+# Collations
+#
+CREATE TABLE t1 (a VARCHAR(20) CHARACTER SET latin1 DEFAULT CONCAT('ö')) CHARACTER SET koi8r COLLATE koi8r_bin;
+ERROR 22007: Encountered illegal value 'ö' when converting to koi8r
+CREATE OR REPLACE TABLE t1 (a char(2) default concat('A') COLLATE utf8mb4_unicode_ci);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT concat('A')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+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;
+a b c
+1 2 1
+1 2 NULL
+drop table t1;
+create table t1 (a int default 1, b int default (1+1), c int);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT 1,
+ `b` int(11) DEFAULT (1 + 1),
+ `c` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t1 alter a set default (2+3), alter b set default 4,
+alter c set default (-a);
+alter table t1 alter a set default 1+2;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '+2' at line 1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT (2 + 3),
+ `b` int(11) DEFAULT 4,
+ `c` int(11) DEFAULT (-`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+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;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT 5 CHECK (`a` > 10),
+ `b` int(11) DEFAULT (5 + 5),
+ `c` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `max(a)` int(11) DEFAULT NULL,
+ `max(b)` int(11) DEFAULT NULL,
+ `max(c)` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2, t3;
+# 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);
+insert into t1 values (ignore, ignore);
+ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
+select * from t1 order by a;
+a b
+0 3
+1 3
+2 3
+3 3
+4 6
+6 7
+delete from t1 where a < 4;
+# actually insert default instead of ignoring
+# (but REPLACE is non standard operator)
+replace into t1 values (4, ignore);
+select * from t1 order by a;
+a b
+4 3
+6 7
+drop table t1;
+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;
+a b c
+NULL 20 x
+NULL 25 x
+drop table t1;
+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;
+a
+0
+1
+3
+truncate table t1;
+INSERT INTO t1 SELECT a FROM t2 ON DUPLICATE KEY UPDATE a=IGNORE;
+SELECT * FROM t1 order by a;
+a
+0
+1
+3
+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;
+execute insstmt using ignore, ignore;
+ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
+select * from t1 order by a;
+a b
+0 3
+1 3
+2 3
+3 3
+4 6
+6 7
+delete from t1 where a < 4;
+execute repstmt using 4, ignore;
+select * from t1 order by a;
+a b
+4 3
+6 7
+drop table t1;
+#
+# DEVAULT & PS adoption
+#
+CREATE TABLE t1 (a INT DEFAULT 10, b INT DEFAULT NULL);
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?,?)' USING IGNORE, IGNORE;
+SELECT * FROM t1;
+a b
+10 NULL
+UPDATE t1 SET a=20, b=30;
+SELECT * FROM t1;
+a b
+20 30
+EXECUTE IMMEDIATE 'UPDATE t1 SET a=?,b=?' USING IGNORE, IGNORE;
+SELECT * FROM t1;
+a b
+20 30
+DROP TABLE t1;
+CREATE TABLE t1 (a INT DEFAULT 10);
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?+1)' USING IGNORE;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (CONCAT(?,?))' USING IGNORE, 'test';
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+DROP TABLE t1;
+CREATE TABLE t1 (a INT DEFAULT 10);
+INSERT INTO t1 VALUES (20);
+EXECUTE IMMEDIATE 'UPDATE t1 SET a=?+1' USING IGNORE;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'UPDATE t1 SET a=CONCAT(?,?)' USING IGNORE, 'test';
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+DROP TABLE t1;
+EXECUTE IMMEDIATE 'SELECT CAST(? AS SIGNED)' USING IGNORE;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT CAST(? AS DOUBLE)' USING IGNORE;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT CAST(? AS CHAR)' USING IGNORE;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT CAST(? AS DECIMAL(10,1))' USING IGNORE;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT CAST(? AS TIME)' USING IGNORE;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT CAST(? AS DATE)' USING IGNORE;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT CAST(? AS DATETIME)' USING IGNORE;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT ?+1' USING IGNORE;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT CONCAT(?,?)' USING IGNORE,'test';
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT 1 LIMIT ?' USING IGNORE;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+CREATE TABLE t1 (a INT DEFAULT 10);
+INSERT INTO t1 VALUES (1),(2),(3);
+EXECUTE IMMEDIATE 'SELECT * FROM t1 LIMIT ?' USING IGNORE;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+DROP TABLE t1;
+# The output of this query in 'Note' is a syntactically incorrect query.
+# But as it's never logged, it's ok. It should be human readable only.
+EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT ?' USING IGNORE;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select ignore AS `?`
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING DEFAULT,DEFAULT;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+DROP TABLE t1;
+#
+# MDEV-11134 Assertion `fixed' failed in Item::const_charset_converter(THD*, CHARSET_INFO*, bool, const char*)
+#
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(8) DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SET @a='A';
+EXECUTE stmt USING @a;
+EXECUTE stmt USING @a;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(8) DEFAULT 'A'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SET @a=_utf8 0xC380;
+EXECUTE stmt USING @a;
+EXECUTE stmt USING @a;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(8) DEFAULT 'À'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SET @a=_utf8 0xD18F;
+EXECUTE stmt USING @a;
+ERROR 42000: Invalid default value for 'c'
+EXECUTE stmt USING @a;
+ERROR 42000: Invalid default value for 'c'
+DEALLOCATE PREPARE stmt;
+set sql_mode=ansi_quotes;
+create table t1 (a int, b int default (a+1));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE "t1" (
+ "a" int(11) DEFAULT NULL,
+ "b" int(11) DEFAULT ("a" + 1)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert t1 (a) values (10);
+set sql_mode='';
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT (`a` + 1)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert t1 (a) values (20);
+flush tables;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT (`a` + 1)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert t1 (a) values (30);
+select * from t1;
+a b
+10 11
+20 21
+30 31
+drop table t1;
+set sql_mode=default;
+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;
+a b t
+5 5 1 column is omitted
+5 5 2 column gets DEFAULT, keyword
+4 5 3 column gets DEFAULT(a), expression
+4 5 4 also expression DEFAULT(0)+0
+4 5 5 the value of the DEFAULT(a), that is b
+drop table t1;
+create table t1 (col1 int default(-(default(col1))));
+ERROR 01000: Expression for field `col1` is refering to uninitialized field `col1`
+create table t1 (col int default (yearweek((exp(710)))));
+ERROR 22003: DOUBLE value is out of range in 'exp(710)'
+#
+# MDEV-13707 Server in ORACLE mode crashes on ALTER with wrong DEFAULT clause
+#
+CREATE OR REPLACE TABLE t1(i int);
+ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`;
+ERROR 42S22: Unknown column 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' in 'DEFAULT'
+DROP TABLE t1;
+# end of 10.2 test
diff --git a/mysql-test/r/default_debug.result b/mysql-test/r/default_debug.result
new file mode 100644
index 00000000000..3f5b0b7896c
--- /dev/null
+++ b/mysql-test/r/default_debug.result
@@ -0,0 +1,21 @@
+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;
+a b default(b)
+1 10 2
+2 20 3
+3 30 4
+set debug_sync='after_Item_default_value_calculate WAIT_FOR go';
+select a,b,default(b) from t1;
+connection default;
+set debug_sync='ha_write_row_start SIGNAL go';
+insert t1 values (100,default(b));
+connection con1;
+a b default(b)
+1 10 2
+2 20 3
+3 30 4
+connection default;
+drop table t1;
+set debug_sync='RESET';
diff --git a/mysql-test/r/default_session.result b/mysql-test/r/default_session.result
new file mode 100644
index 00000000000..6c0bcad0cb3
--- /dev/null
+++ b/mysql-test/r/default_session.result
@@ -0,0 +1,94 @@
+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;
+default(n) default(u) default(cu) default(cr) default(d)
+NULL root@localhost root@localhost NULL test
+select * from mysqltest1.v4 limit 1;
+default(n) default(u) default(cu) default(cr) default(d)
+NULL root@localhost foo@localhost NULL test
+select * from v5 limit 1;
+default(n) default(u) default(cu) default(cr) default(d)
+NULL root@localhost @ bar test
+select * from v6 limit 1;
+default(n) default(u) default(cu) default(cr) default(d)
+NULL root@localhost @ bar test
+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;
+default(n) default(u) default(cu) default(cr) default(d)
+NULL conn@localhost @localhost bar mysqltest1
+select * from v4 limit 1;
+default(n) default(u) default(cu) default(cr) default(d)
+NULL conn@localhost foo@localhost NULL mysqltest1
+select * from test.v5 limit 1;
+default(n) default(u) default(cu) default(cr) default(d)
+NULL conn@localhost @ bar mysqltest1
+select * from test.v6 limit 1;
+default(n) default(u) default(cu) default(cr) default(d)
+NULL conn@localhost @ bar mysqltest1
+connection default;
+disconnect conn;
+select * from t1;
+n u cu cr d
+t1 root@localhost root@localhost NULL test
+v1 root@localhost foo@localhost NULL test
+v2 root@localhost @ bar test
+v3 root@localhost @ bar test
+t1 conn@localhost @localhost bar mysqltest1
+v1 conn@localhost foo@localhost NULL mysqltest1
+v2 conn@localhost @ bar mysqltest1
+v3 conn@localhost @ bar mysqltest1
+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;
+a mn dn df
+2010-12-02 December Thursday Thu, Dec
+2010-12-02 Dezember Donnerstag Do, Dez
+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;
+a
+STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI
+drop table t1;
diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result
index 8cc5645eeda..d54fa40f2da 100644
--- a/mysql-test/r/delayed.result
+++ b/mysql-test/r/delayed.result
@@ -297,16 +297,21 @@ drop table if exists t1;
create table t1 (a int, b int);
insert into t1 values (1,1);
lock table t1 read;
-connection: update
+connect update,localhost,root,,;
+connection update;
insert delayed into t1 values (2,2);;
-connection: select
+connection default;
+connect select,localhost,root,,;
select * from t1;
a b
1 1
-connection: default
+connection default;
select * from t1;
a b
1 1
+connection default;
+disconnect update;
+disconnect select;
unlock tables;
select * from t1;
a b
@@ -359,70 +364,70 @@ CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
CREATE TABLE t3 (a INT);
# Test 1: Using LOCK TABLE
-# Connection con1
+connect con1, localhost, root;
LOCK TABLE t1 WRITE;
-# Connection default
+connection default;
LOCK TABLE t2 WRITE;
# Sending:
INSERT DELAYED INTO t1 VALUES (1);
-# Connection con1
+connection con1;
# Wait until INSERT DELAYED is blocked on table 't1'.
INSERT DELAYED INTO t2 VALUES (1);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
UNLOCK TABLES;
-# Connection default
+connection default;
# Reaping: INSERT DELAYED INTO t1 VALUES (1)
UNLOCK TABLES;
# Test 2: Using ALTER TABLE
START TRANSACTION;
SELECT * FROM t1 WHERE a=0;
a
-# Connection con1
+connection con1;
# Sending:
ALTER TABLE t1 MODIFY a INT UNSIGNED;;
-# Connection default
+connection default;
# Wait until ALTER TABLE is blocked on table 't1'.
INSERT DELAYED INTO t1 VALUES (3);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT;
-# Connection con1
+connection con1;
# Reaping: ALTER TABLE t1 COMMENT 'test'
# Test 3: Using RENAME TABLE
-# Connection default
+connection default;
START TRANSACTION;
INSERT INTO t2 VALUES (1);
-# Connection con1
+connection con1;
# Sending:
RENAME TABLE t1 to t5, t2 to t4;
-# Connection default
+connection default;
# Wait until RENAME TABLE is blocked on table 't1'.
INSERT DELAYED INTO t1 VALUES (4);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT;
-# Connection con1
+connection con1;
# Reaping: RENAME TABLE t1 to t5, t2 to t4
-# Connection default
+connection default;
# Reverting the renames
RENAME TABLE t5 to t1, t4 to t2;
# Test 4: Two INSERT DELAYED on the same table
START TRANSACTION;
INSERT INTO t2 VALUES (1);
-# Connection con2
+connect con2, localhost, root;
LOCK TABLE t1 WRITE, t2 WRITE;
-# Connection con1
+connection con1;
# Wait until LOCK TABLE is blocked on table 't2'.
INSERT DELAYED INTO t1 VALUES (5);
-# Connection default
+connection default;
# Wait until INSERT DELAYED is blocked on table 't1'.
INSERT DELAYED INTO t1 VALUES (6);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT;
-# Connection con2
+connection con2;
# Reaping: LOCK TABLE t1 WRITE, t2 WRITE
UNLOCK TABLES;
-# Connection con1
+connection con1;
# Reaping: INSERT DELAYED INTO t1 VALUES (5)
-# Connection default
+connection default;
# Test 5: LOCK TABLES + INSERT DELAYED in one connection.
# This test has triggered some asserts in metadata locking
# subsystem at some point in time..
@@ -434,13 +439,17 @@ LOCK TABLE t1 WRITE;
INSERT DELAYED INTO t2 VALUES (8);
UNLOCK TABLES;
SET AUTOCOMMIT= 1;
-# Connection con2
-# Connection con1
-# Connection default
+connection con2;
+disconnect con2;
+connection con1;
+disconnect con1;
+connection default;
DROP TABLE t1, t2, t3;
#
# Test for bug #56251 "Deadlock with INSERT DELAYED and MERGE tables".
#
+connect con1,localhost,root,,;
+connection default;
drop table if exists t1, t2, tm;
create table t1(a int);
create table t2(a int);
@@ -448,10 +457,10 @@ create table tm(a int) engine=merge union=(t1, t2);
begin;
select * from t1;
a
-# Connection 'con1'.
+connection con1;
# Sending:
alter table t1 comment 'test';
-# Connection 'default'.
+connection default;
# Wait until ALTER TABLE blocks and starts waiting
# for connection 'default'. It should wait with a
# pending SNW lock on 't1'.
@@ -462,9 +471,10 @@ insert delayed into tm values (1);
ERROR HY000: DELAYED option not supported for table 'tm'
# Unblock ALTER TABLE.
commit;
-# Connection 'con1'.
+connection con1;
# Reaping ALTER TABLE:
-# Connection 'default'.
+disconnect con1;
+connection default;
drop tables tm, t1, t2;
#
# MDEV-9621 INSERT DELAYED fails on insert for tables with many columns
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result
index 67d41de4af4..ed3683d52f9 100644
--- a/mysql-test/r/delete.result
+++ b/mysql-test/r/delete.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("Sort aborted.*");
drop table if exists t1,t2,t3,t11,t12;
CREATE TABLE t1 (a tinyint(3), b tinyint(5));
INSERT INTO t1 VALUES (1,1);
@@ -488,7 +489,7 @@ BEGIN
INSERT INTO t1 SELECT * FROM t1 AS A;
END |
DELETE IGNORE FROM t1;
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
DROP TABLE t1;
#
# Bug #53450: Crash/assertion
diff --git a/mysql-test/r/delete_returning_grant.result b/mysql-test/r/delete_returning_grant.result
index bdd171940ba..b41d48a7112 100644
--- a/mysql-test/r/delete_returning_grant.result
+++ b/mysql-test/r/delete_returning_grant.result
@@ -4,10 +4,14 @@ 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;
+connect root,localhost,root,,test;
+connection root;
CREATE DATABASE mysqltest;
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;
DELETE FROM mysqltest.t1 WHERE a=2 RETURNING b;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'a' in table 't1'
DELETE FROM mysqltest.t1 RETURNING b;
@@ -22,6 +26,7 @@ DDDD
EEEEE
GGGGGGG
bb
+connection root;
SELECT * FROM mysqltest.t1;
a b
INSERT INTO mysqltest.t1 SELECT * FROM t1;
@@ -41,15 +46,19 @@ a b
1 a
7 ggggggg
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;
a b
INSERT INTO mysqltest.t1 SELECT * FROM t1;
DELETE FROM mysqltest.v1 RETURNING a;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'a' in table 'v1'
+connection root;
GRANT SELECT ON mysqltest.* TO mysqltest_1@localhost;
+connection user1;
DELETE FROM mysqltest.v1 RETURNING a;
a
7
@@ -65,7 +74,9 @@ a
SELECT * FROM mysqltest.t1;
a b
INSERT INTO mysqltest.t1 SELECT * FROM t1;
+connection root;
DROP DATABASE mysqltest;
+disconnect user1;
DROP USER mysqltest_1@localhost;
DROP VIEW v1;
DROP TABLE t1;
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index 687497ceb7e..dd04cc798e6 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -206,6 +206,8 @@ x
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';
select 2 as a from (select * from t1) b;
ERROR 3D000: No database selected
@@ -385,6 +387,9 @@ ID DATA FID
select t2.* from (select * from t1) as A inner join t2 on A.ID = t2.FID;
ID DATA FID
drop table t1, t2;
+connection con1;
+disconnect con1;
+connection default;
drop user mysqltest_1;
# End of 4.1 tests
SELECT 0 FROM
@@ -549,7 +554,7 @@ EXPLAIN SELECT * FROM (SELECT * FROM t1) AS table1,
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
1 PRIMARY <derived3> ref key0 key0 5 const 0
-3 DERIVED t2 ALL NULL NULL NULL NULL 2 Using temporary
+3 DERIVED t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary
Warnings:
Note 1249 Select 4 was reduced during optimization
DROP TABLE t1, t2;
@@ -627,7 +632,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DERIVED t1 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1276 Field or reference 'sq.f2' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 6 AS `f1` from <materialize> (select `test`.`t2`.`f3` from `test`.`t2` having (`test`.`t2`.`f3` >= 8)) semi join (`test`.`t2`) where ((`test`.`t2`.`f3` = 6) and (`<subquery4>`.`f3` = 9))
+Note 1003 select 6 AS `f1` from <materialize> (select `test`.`t2`.`f3` from `test`.`t2` having `test`.`t2`.`f3` >= 8) semi join (`test`.`t2`) where `test`.`t2`.`f3` = 6 and `<subquery4>`.`f3` = 9
DROP TABLE t2,t1;
#
# MDEV-9462: Out of memory using explain on 2 empty tables
@@ -1123,3 +1128,37 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# MDEV-10554: Assertion `!derived->first_select()->
+# exclude_from_table_unique_test || derived->outer_select()->
+# exclude_from_table_unique_test'
+# failed in TABLE_LIST::set_check_merged()
+#
+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;
+f
+EXECUTE stmt;
+f
+drop view v1;
+drop table t1;
+#
+# MDEV-11363: Assertion `!derived->first_sel ect()->first_inner_unit() ||
+# derived->first_select()->first_inner_unit()->first_select()->
+# exclude_from_table_unique_test' failed in
+# TABLE_LIST::set_check_materialized()
+#
+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;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result
new file mode 100644
index 00000000000..8e74e093a4a
--- /dev/null
+++ b/mysql-test/r/derived_cond_pushdown.result
@@ -0,0 +1,9047 @@
+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);
+Warnings:
+Note 1265 Data truncated for column 'd' at row 5
+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);
+# conjunctive subformula : pushing into HAVING
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.max_c>214) and (t2.a>v1.a);
+a b max_c avg_c a b c d
+1 21 500 234.6000 2 3 207 207
+1 21 500 234.6000 7 13 312 406
+1 21 500 234.6000 8 64 248 107
+1 21 500 234.6000 6 20 315 279
+1 21 500 234.6000 8 80 800 314
+1 21 500 234.6000 3 12 231 190
+1 21 500 234.6000 6 23 303 909
+6 20 315 279.3333 7 13 312 406
+6 20 315 279.3333 8 64 248 107
+6 20 315 279.3333 8 80 800 314
+select * from v1,t2 where (v1.max_c>214) and (t2.a>v1.a);
+a b max_c avg_c a b c d
+1 21 500 234.6000 2 3 207 207
+1 21 500 234.6000 7 13 312 406
+1 21 500 234.6000 8 64 248 107
+1 21 500 234.6000 6 20 315 279
+1 21 500 234.6000 8 80 800 314
+1 21 500 234.6000 3 12 231 190
+1 21 500 234.6000 6 23 303 909
+6 20 315 279.3333 7 13 312 406
+6 20 315 279.3333 8 64 248 107
+6 20 315 279.3333 8 80 800 314
+explain select * from v1,t2 where (v1.max_c>214) and (t2.a>v1.a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+explain format=json select * from v1,t2 where (v1.max_c>214) and (t2.a>v1.a);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 214"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "t2.a > v1.a",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 214",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b max_c avg_c a b c d
+1 21 500 234.6000 1 21 909 12
+8 33 404 213.6667 8 64 248 107
+6 20 315 279.3333 6 20 315 279
+1 21 500 234.6000 1 19 203 107
+8 33 404 213.6667 8 80 800 314
+6 20 315 279.3333 6 23 303 909
+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);
+a b max_c avg_c a b c d
+1 21 500 234.6000 1 21 909 12
+8 33 404 213.6667 8 64 248 107
+6 20 315 279.3333 6 20 315 279
+1 21 500 234.6000 1 19 203 107
+8 33 404 213.6667 8 80 800 314
+6 20 315 279.3333 6 23 303 909
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 300",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# extracted or formula : pushing into HAVING
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where
+((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a<v1.a));
+a b max_c avg_c a b c d
+1 21 500 234.6000 2 3 207 207
+1 21 500 234.6000 7 13 312 406
+1 21 500 234.6000 8 64 248 107
+1 21 500 234.6000 6 20 315 279
+1 21 500 234.6000 8 80 800 314
+1 21 500 234.6000 3 12 231 190
+1 21 500 234.6000 6 23 303 909
+5 27 132 132.0000 2 3 207 207
+5 27 132 132.0000 1 21 909 12
+5 27 132 132.0000 1 19 203 107
+5 27 132 132.0000 3 12 231 190
+select * from v1,t2 where
+((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a<v1.a));
+a b max_c avg_c a b c d
+1 21 500 234.6000 2 3 207 207
+1 21 500 234.6000 7 13 312 406
+1 21 500 234.6000 8 64 248 107
+1 21 500 234.6000 6 20 315 279
+1 21 500 234.6000 8 80 800 314
+1 21 500 234.6000 3 12 231 190
+1 21 500 234.6000 6 23 303 909
+5 27 132 132.0000 2 3 207 207
+5 27 132 132.0000 1 21 909 12
+5 27 132 132.0000 1 19 203 107
+5 27 132 132.0000 3 12 231 190
+explain select * from v1,t2 where
+((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a<v1.a));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+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));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 400 or v1.max_c < 135"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (max_c > 400 or max_c < 135)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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));
+a b max_c avg_c a b c d
+1 19 107 107.0000 1 21 909 12
+1 19 107 107.0000 1 19 203 107
+1 21 500 234.6000 1 21 909 12
+6 20 315 279.3333 6 20 315 279
+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));
+a b max_c avg_c a b c d
+1 19 107 107.0000 1 21 909 12
+1 19 107 107.0000 1 19 203 107
+1 21 500 234.6000 1 21 909 12
+6 20 315 279.3333 6 20 315 279
+explain 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));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+explain format=json 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));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 300 or v1.max_c < 135"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.b = t2.b and v1.max_c > 300 and v1.avg_c > t2.d or v1.a = t2.a and v1.max_c < 135 and v1.max_c < t2.c",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (max_c > 300 or max_c < 135)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# conjunctive subformula : pushing into WHERE
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a>6) and (t2.b>v1.b);
+a b max_c avg_c a b c d
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 8 80 800 314
+select * from v1,t2 where (v1.a>6) and (t2.b>v1.b);
+a b max_c avg_c a b c d
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 8 80 800 314
+explain select * from v1,t2 where (v1.a>6) and (t2.b>v1.b);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v1,t2 where (v1.a>6) and (t2.b>v1.b);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a > 6"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "t2.b > v1.b",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 6"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v2,t2 where (v2.b>25) and (t2.a<v2.a);
+a b max_c avg_c a b c d
+8 33 404 213.6667 2 3 207 207
+8 33 404 213.6667 1 21 909 12
+8 33 404 213.6667 7 13 312 406
+8 33 404 213.6667 6 20 315 279
+8 33 404 213.6667 1 19 203 107
+8 33 404 213.6667 3 12 231 190
+8 33 404 213.6667 6 23 303 909
+select * from v2,t2 where (v2.b>25) and (t2.a<v2.a);
+a b max_c avg_c a b c d
+8 33 404 213.6667 2 3 207 207
+8 33 404 213.6667 1 21 909 12
+8 33 404 213.6667 7 13 312 406
+8 33 404 213.6667 6 20 315 279
+8 33 404 213.6667 1 19 203 107
+8 33 404 213.6667 3 12 231 190
+8 33 404 213.6667 6 23 303 909
+explain select * from v2,t2 where (v2.b>25) and (t2.a<v2.a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v2,t2 where (v2.b>25) and (t2.a<v2.a);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v2.b > 25"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "t2.a < v2.a",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and t1.b > 25"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# extracted or formula : pushing into WHERE
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where
+((v1.a>7) and (t2.c<v1.max_c)) or ((v1.a<2) and (t2.b<v1.b));
+a b max_c avg_c a b c d
+1 19 107 107.0000 2 3 207 207
+1 19 107 107.0000 7 13 312 406
+1 19 107 107.0000 3 12 231 190
+1 21 500 234.6000 2 3 207 207
+1 21 500 234.6000 7 13 312 406
+1 21 500 234.6000 6 20 315 279
+1 21 500 234.6000 1 19 203 107
+1 21 500 234.6000 3 12 231 190
+8 33 404 213.6667 2 3 207 207
+8 33 404 213.6667 7 13 312 406
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 6 20 315 279
+8 33 404 213.6667 1 19 203 107
+8 33 404 213.6667 3 12 231 190
+8 33 404 213.6667 6 23 303 909
+select * from v1,t2 where
+((v1.a>7) and (t2.c<v1.max_c)) or ((v1.a<2) and (t2.b<v1.b));
+a b max_c avg_c a b c d
+1 19 107 107.0000 2 3 207 207
+1 19 107 107.0000 7 13 312 406
+1 19 107 107.0000 3 12 231 190
+1 21 500 234.6000 2 3 207 207
+1 21 500 234.6000 7 13 312 406
+1 21 500 234.6000 6 20 315 279
+1 21 500 234.6000 1 19 203 107
+1 21 500 234.6000 3 12 231 190
+8 33 404 213.6667 2 3 207 207
+8 33 404 213.6667 7 13 312 406
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 6 20 315 279
+8 33 404 213.6667 1 19 203 107
+8 33 404 213.6667 3 12 231 190
+8 33 404 213.6667 6 23 303 909
+explain select * from v1,t2 where
+((v1.a>7) and (t2.c<v1.max_c)) or ((v1.a<2) and (t2.b<v1.b));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v1,t2 where
+((v1.a>7) and (t2.c<v1.max_c)) or ((v1.a<2) and (t2.b<v1.b));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a > 7 or v1.a < 2"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.a > 7 and t2.c < v1.max_c or v1.a < 2 and t2.b < v1.b",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 7 or t1.a < 2"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v2,t2 where
+((v2.a>7) and (t2.c<v2.max_c)) or ((v2.a>5) and (t2.b<v2.b));
+a b max_c avg_c a b c d
+6 20 315 279.3333 2 3 207 207
+6 20 315 279.3333 7 13 312 406
+6 20 315 279.3333 1 19 203 107
+6 20 315 279.3333 3 12 231 190
+8 33 404 213.6667 2 3 207 207
+8 33 404 213.6667 1 21 909 12
+8 33 404 213.6667 7 13 312 406
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 6 20 315 279
+8 33 404 213.6667 1 19 203 107
+8 33 404 213.6667 3 12 231 190
+8 33 404 213.6667 6 23 303 909
+select * from v2,t2 where
+((v2.a>7) and (t2.c<v2.max_c)) or ((v2.a>5) and (t2.b<v2.b));
+a b max_c avg_c a b c d
+6 20 315 279.3333 2 3 207 207
+6 20 315 279.3333 7 13 312 406
+6 20 315 279.3333 1 19 203 107
+6 20 315 279.3333 3 12 231 190
+8 33 404 213.6667 2 3 207 207
+8 33 404 213.6667 1 21 909 12
+8 33 404 213.6667 7 13 312 406
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 6 20 315 279
+8 33 404 213.6667 1 19 203 107
+8 33 404 213.6667 3 12 231 190
+8 33 404 213.6667 6 23 303 909
+explain select * from v2,t2 where
+((v2.a>7) and (t2.c<v2.max_c)) or ((v2.a>5) and (t2.b<v2.b));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v2,t2 where
+((v2.a>7) and (t2.c<v2.max_c)) or ((v2.a>5) and (t2.b<v2.b));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v2.a > 7 or v2.a > 5"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v2.a > 7 and t2.c < v2.max_c or v2.a > 5 and t2.b < v2.b",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and (t1.a > 7 or t1.a > 5)"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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));
+a b max_c avg_c a b c d
+1 19 107 107.0000 8 64 248 107
+1 19 107 107.0000 1 19 203 107
+5 16 207 207.0000 2 3 207 207
+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));
+a b max_c avg_c a b c d
+1 19 107 107.0000 8 64 248 107
+1 19 107 107.0000 1 19 203 107
+5 16 207 207.0000 2 3 207 207
+explain 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));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json 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));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a > 4 or v1.a < 2"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "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",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 4 or t1.a < 2"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# conjunctive subformulas : pushing into HAVING and WHERE
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a<2) and (v1.max_c>400) and (t2.b>v1.b);
+a b max_c avg_c a b c d
+1 21 500 234.6000 8 64 248 107
+1 21 500 234.6000 8 80 800 314
+1 21 500 234.6000 6 23 303 909
+select * from v1,t2 where (v1.a<2) and (v1.max_c>400) and (t2.b>v1.b);
+a b max_c avg_c a b c d
+1 21 500 234.6000 8 64 248 107
+1 21 500 234.6000 8 80 800 314
+1 21 500 234.6000 6 23 303 909
+explain select * from v1,t2 where (v1.a<2) and (v1.max_c>400) and (t2.b>v1.b);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v1,t2 where (v1.a<2) and (v1.max_c>400) and (t2.b>v1.b);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 2 and v1.max_c > 400"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "t2.b > v1.b",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 400",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 2"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a avg_a b c a b c
+1 0.50000000 12.5 18.9 1 22.4 14.3333
+1 0.50000000 12.5 18.9 1 12.5 18.9
+4 1.00000000 33.4 14.3333 4 33.4 14.3333
+4 1.00000000 14.3333 13.65 4 33.4 14.3333
+5 1.25000000 17.89 7.22 5 22.4 13.65
+6 1.50000000 33.4 14.3 6 33.4 14.3333
+10 2.62500000 33.4 13.65 10 31.4 13.65
+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);
+a avg_a b c a b c
+1 0.50000000 12.5 18.9 1 22.4 14.3333
+1 0.50000000 12.5 18.9 1 12.5 18.9
+4 1.00000000 33.4 14.3333 4 33.4 14.3333
+4 1.00000000 14.3333 13.65 4 33.4 14.3333
+5 1.25000000 17.89 7.22 5 22.4 13.65
+6 1.50000000 33.4 14.3 6 33.4 14.3333
+10 2.62500000 33.4 13.65 10 31.4 13.65
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t.a 2 Using where
+2 DERIVED t1_double ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v.avg_a > 0.45 and v.b > 10",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "avg_a < 22.333 and avg_a > 0.45",
+ "filesort": {
+ "sort_key": "t1_double.b, t1_double.c",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1_double",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t1_double.b > 12.2 and t1_double.b > 10"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_decimal as v,t2_decimal as t where
+(v.a=t.a) and (v.avg_c>15) and (v.b>1);
+a b avg_c a b c
+3.0 3.0 16.0000 3.0 3.0 16
+select * from v_decimal as v,t2_decimal as t where
+(v.a=t.a) and (v.avg_c>15) and (v.b>1);
+a b avg_c a b c
+3.0 3.0 16.0000 3.0 3.0 16
+explain select * from v_decimal as v,t2_decimal as t where
+(v.a=t.a) and (v.avg_c>15) and (v.b>1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 3 test.t.a 2 Using where
+2 DERIVED t1_decimal ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort
+explain format=json select * from v_decimal as v,t2_decimal as t where
+(v.a=t.a) and (v.avg_c>15) and (v.b>1);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "3",
+ "used_key_parts": ["a"],
+ "ref": ["test.t.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v.avg_c > 15 and v.b > 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "avg_c > 12 and avg_c > 15",
+ "filesort": {
+ "sort_key": "t1_decimal.a, t1_decimal.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1_decimal",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t1_decimal.b > 1"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# extracted or formula : pushing into HAVING and WHERE
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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));
+a b max_c avg_c a b c d
+1 19 107 107.0000 2 3 207 207
+1 19 107 107.0000 7 13 312 406
+1 19 107 107.0000 3 12 231 190
+8 33 404 213.6667 2 3 207 207
+8 33 404 213.6667 7 13 312 406
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 6 20 315 279
+8 33 404 213.6667 1 19 203 107
+8 33 404 213.6667 3 12 231 190
+8 33 404 213.6667 6 23 303 909
+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));
+a b max_c avg_c a b c d
+1 19 107 107.0000 2 3 207 207
+1 19 107 107.0000 7 13 312 406
+1 19 107 107.0000 3 12 231 190
+8 33 404 213.6667 2 3 207 207
+8 33 404 213.6667 7 13 312 406
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 6 20 315 279
+8 33 404 213.6667 1 19 203 107
+8 33 404 213.6667 3 12 231 190
+8 33 404 213.6667 6 23 303 909
+explain 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));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json 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));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a > 7 and v1.max_c > 300 or v1.a < 4 and v1.max_c < 500"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "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",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (t1.a > 7 and max_c > 300 or t1.a < 4 and max_c < 500)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 7 or t1.a < 4"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where ((v1.a<2) and (v1.max_c>120)) or (v1.a>7);
+a b max_c avg_c a b c d
+1 21 500 234.6000 2 3 207 207
+1 21 500 234.6000 1 21 909 12
+1 21 500 234.6000 7 13 312 406
+1 21 500 234.6000 8 64 248 107
+1 21 500 234.6000 6 20 315 279
+1 21 500 234.6000 1 19 203 107
+1 21 500 234.6000 8 80 800 314
+1 21 500 234.6000 3 12 231 190
+1 21 500 234.6000 6 23 303 909
+8 33 404 213.6667 2 3 207 207
+8 33 404 213.6667 1 21 909 12
+8 33 404 213.6667 7 13 312 406
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 6 20 315 279
+8 33 404 213.6667 1 19 203 107
+8 33 404 213.6667 8 80 800 314
+8 33 404 213.6667 3 12 231 190
+8 33 404 213.6667 6 23 303 909
+select * from v1,t2 where ((v1.a<2) and (v1.max_c>120)) or (v1.a>7);
+a b max_c avg_c a b c d
+1 21 500 234.6000 2 3 207 207
+1 21 500 234.6000 1 21 909 12
+1 21 500 234.6000 7 13 312 406
+1 21 500 234.6000 8 64 248 107
+1 21 500 234.6000 6 20 315 279
+1 21 500 234.6000 1 19 203 107
+1 21 500 234.6000 8 80 800 314
+1 21 500 234.6000 3 12 231 190
+1 21 500 234.6000 6 23 303 909
+8 33 404 213.6667 2 3 207 207
+8 33 404 213.6667 1 21 909 12
+8 33 404 213.6667 7 13 312 406
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 6 20 315 279
+8 33 404 213.6667 1 19 203 107
+8 33 404 213.6667 8 80 800 314
+8 33 404 213.6667 3 12 231 190
+8 33 404 213.6667 6 23 303 909
+explain select * from v1,t2 where ((v1.a<2) and (v1.max_c>120)) or (v1.a>7);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v1,t2 where ((v1.a<2) and (v1.max_c>120)) or (v1.a>7);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (t1.a < 2 and max_c > 120 or t1.a > 7)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 2 or t1.a > 7"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# extracted or formulas : pushing into WHERE and HAVING
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where
+((v1.a<2) and (v1.max_c>120) and (v1.b=t2.b)) or (v1.a>7);
+a b max_c avg_c a b c d
+1 21 500 234.6000 1 21 909 12
+8 33 404 213.6667 2 3 207 207
+8 33 404 213.6667 1 21 909 12
+8 33 404 213.6667 7 13 312 406
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 6 20 315 279
+8 33 404 213.6667 1 19 203 107
+8 33 404 213.6667 8 80 800 314
+8 33 404 213.6667 3 12 231 190
+8 33 404 213.6667 6 23 303 909
+select * from v1,t2 where
+((v1.a<2) and (v1.max_c>120) and (v1.b=t2.b)) or (v1.a>7);
+a b max_c avg_c a b c d
+1 21 500 234.6000 1 21 909 12
+8 33 404 213.6667 2 3 207 207
+8 33 404 213.6667 1 21 909 12
+8 33 404 213.6667 7 13 312 406
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 6 20 315 279
+8 33 404 213.6667 1 19 203 107
+8 33 404 213.6667 8 80 800 314
+8 33 404 213.6667 3 12 231 190
+8 33 404 213.6667 6 23 303 909
+explain select * from v1,t2 where
+((v1.a<2) and (v1.max_c>120) and (v1.b=t2.b)) or (v1.a>7);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v1,t2 where
+((v1.a<2) and (v1.max_c>120) and (v1.b=t2.b)) or (v1.a>7);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.b = t2.b and v1.a < 2 and v1.max_c > 120 or v1.a > 7",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (t1.a < 2 and max_c > 120 or t1.a > 7)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 2 or t1.a > 7"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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));
+a b max_c avg_c a b c d
+1 19 107 107.0000 8 64 248 107
+1 19 107 107.0000 1 19 203 107
+5 16 207 207.0000 2 3 207 207
+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));
+a b max_c avg_c a b c d
+1 19 107 107.0000 8 64 248 107
+1 19 107 107.0000 1 19 203 107
+5 16 207 207.0000 2 3 207 207
+explain 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));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json 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));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 2 and v1.max_c < 200 or v1.a > 4"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.a < 2 and v1.max_c < 200 and t2.c > v1.max_c and v1.max_c = t2.d or v1.max_c = t2.c and v1.a > 4 and t2.c < 500 and t2.b < v1.b",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (t1.a < 2 and max_c < 200 or t1.a > 4 and max_c < 500)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 2 or t1.a > 4"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# 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;
+a b max_c avg_c a b c d
+1 21 500 234.6000 2 3 207 207
+1 21 500 234.6000 7 13 312 406
+1 21 500 234.6000 8 64 248 107
+1 21 500 234.6000 6 20 315 279
+1 21 500 234.6000 8 80 800 314
+1 21 500 234.6000 3 12 231 190
+1 21 500 234.6000 6 23 303 909
+5 27 132 132.0000 2 3 207 207
+5 27 132 132.0000 1 21 909 12
+5 27 132 132.0000 1 19 203 107
+5 27 132 132.0000 3 12 231 190
+execute stmt;
+a b max_c avg_c a b c d
+1 21 500 234.6000 2 3 207 207
+1 21 500 234.6000 7 13 312 406
+1 21 500 234.6000 8 64 248 107
+1 21 500 234.6000 6 20 315 279
+1 21 500 234.6000 8 80 800 314
+1 21 500 234.6000 3 12 231 190
+1 21 500 234.6000 6 23 303 909
+5 27 132 132.0000 2 3 207 207
+5 27 132 132.0000 1 21 909 12
+5 27 132 132.0000 1 19 203 107
+5 27 132 132.0000 3 12 231 190
+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;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 400 or v1.max_c < 135"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (max_c > 400 or max_c < 135)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+execute stmt;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 400 or v1.max_c < 135"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (max_c > 400 or max_c < 135)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+deallocate prepare stmt;
+# conjunctive subformula : pushing into WHERE
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (t2.a=v1.a) and (v1.b=t2.b) and (v1.a=1);
+a b max_c avg_c a b c d
+1 21 500 234.6000 1 21 909 12
+1 19 107 107.0000 1 19 203 107
+select * from v1,t2 where (t2.a=v1.a) and (v1.b=t2.b) and (v1.a=1);
+a b max_c avg_c a b c d
+1 21 500 234.6000 1 21 909 12
+1 19 107 107.0000 1 19 203 107
+explain select * from v1,t2 where (t2.a=v1.a) and (v1.b=t2.b) and (v1.a=1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.b 2 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v1,t2 where (t2.a=v1.a) and (v1.b=t2.b) and (v1.a=1);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 1 and t2.b is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t2.b"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.a = 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=5) and (v1.max_c=t2.d);
+a b max_c avg_c a b c d
+5 16 207 207.0000 2 3 207 207
+select * from v1,t2 where (v1.a=5) and (v1.max_c=t2.d);
+a b max_c avg_c a b c d
+5 16 207 207.0000 2 3 207 207
+explain select * from v1,t2 where (v1.a=5) and (v1.max_c=t2.d);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.d 2 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v1,t2 where (v1.a=5) and (v1.max_c=t2.d);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.d is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["max_c"],
+ "ref": ["test.t2.d"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.a = 5 and v1.max_c = t2.d",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 5"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# conjunctive subformula : pushing into WHERE using equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (t2.a<5) and (v1.a=t2.a);
+a b max_c avg_c a b c d
+1 21 500 234.6000 1 21 909 12
+1 19 107 107.0000 1 21 909 12
+1 21 500 234.6000 1 19 203 107
+1 19 107 107.0000 1 19 203 107
+select * from v1,t2 where (t2.a<5) and (v1.a=t2.a);
+a b max_c avg_c a b c d
+1 21 500 234.6000 1 21 909 12
+1 19 107 107.0000 1 21 909 12
+1 21 500 234.6000 1 19 203 107
+1 19 107 107.0000 1 19 203 107
+explain select * from v1,t2 where (t2.a<5) and (v1.a=t2.a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v1,t2 where (t2.a<5) and (v1.a=t2.a);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a < 5 and t2.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 5"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a);
+a b max_c avg_c a b c d
+select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a);
+a b max_c avg_c a b c d
+explain select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 10 test.t2.a,test.t2.a 2
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null and t2.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "10",
+ "used_key_parts": ["a", "b"],
+ "ref": ["test.t2.a", "test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b = t1.a"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# conjunctive subformula : pushing into HAVING using equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (t2.c>150) and (v1.max_c=t2.c);
+a b max_c avg_c a b c d
+5 16 207 207.0000 2 3 207 207
+6 20 315 279.3333 6 20 315 279
+select * from v1,t2 where (t2.c>150) and (v1.max_c=t2.c);
+a b max_c avg_c a b c d
+5 16 207 207.0000 2 3 207 207
+6 20 315 279.3333 6 20 315 279
+explain select * from v1,t2 where (t2.c>150) and (v1.max_c=t2.c);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+explain format=json select * from v1,t2 where (t2.c>150) and (v1.max_c=t2.c);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.c > 150 and t2.c is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["max_c"],
+ "ref": ["test.t2.c"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 150",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# extracted and formula : pushing into WHERE
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a) and (v1.a=3);
+a b max_c avg_c a b c d
+select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a) and (v1.a=3);
+a b max_c avg_c a b c d
+explain select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a) and (v1.a=3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where
+explain format=json select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a) and (v1.a=3);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 3"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a = 3 and v1.b = 3"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 3 and t1.b = 3"
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=1) and (v1.b=21) and (t2.a=2);
+a b max_c avg_c a b c d
+1 21 500 234.6000 2 3 207 207
+select * from v1,t2 where (v1.a=1) and (v1.b=21) and (t2.a=2);
+a b max_c avg_c a b c d
+1 21 500 234.6000 2 3 207 207
+explain select * from v1,t2 where (v1.a=1) and (v1.b=21) and (t2.a=2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where
+explain format=json select * from v1,t2 where (v1.a=1) and (v1.b=21) and (t2.a=2);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 2"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a = 1 and v1.b = 21"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.b = 21"
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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));
+a b max_c a b c
+c Harry 4 d Harry 1
+c Harry 4 b Harry 4
+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));
+a b max_c a b c
+c Harry 4 d Harry 1
+c Harry 4 b Harry 4
+explain 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));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 12 Using where
+1 PRIMARY t ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1_char ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort
+explain format=json 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));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "v.a = 'c' and v.b < 'Hermes'",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 9",
+ "filesort": {
+ "sort_key": "t1_char.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1_char",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t1_char.a = 'c' and t1_char.b < 'Hermes'"
+ }
+ }
+ }
+ }
+ }
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "t.b = v.b or v.max_c > 20"
+ }
+ }
+}
+# extracted and formula : pushing into WHERE using equalities
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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));
+a b avg_c a b c
+1.0 1.0 16.3333 2.0 1.0 13
+3.0 3.0 16.0000 3.0 3.0 16
+3.0 3.0 16.0000 1.0 3.0 22
+3.0 3.0 16.0000 1.0 3.0 14
+1.0 1.0 16.3333 2.0 1.0 43
+3.0 3.0 16.0000 2.0 3.0 11
+3.0 3.0 16.0000 2.0 3.0 16
+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));
+a b avg_c a b c
+1.0 1.0 16.3333 2.0 1.0 13
+3.0 3.0 16.0000 3.0 3.0 16
+3.0 3.0 16.0000 1.0 3.0 22
+3.0 3.0 16.0000 1.0 3.0 14
+1.0 1.0 16.3333 2.0 1.0 43
+3.0 3.0 16.0000 2.0 3.0 11
+3.0 3.0 16.0000 2.0 3.0 16
+explain 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));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 6 test.t.b,test.t.b 2
+2 DERIVED t1_decimal ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort
+explain format=json 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));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "(t.b > 1 or t.b = 1) and t.b is not null and t.b is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "6",
+ "used_key_parts": ["a", "b"],
+ "ref": ["test.t.b", "test.t.b"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "avg_c > 12",
+ "filesort": {
+ "sort_key": "t1_decimal.a, t1_decimal.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1_decimal",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t1_decimal.b = t1_decimal.a and (t1_decimal.a > 1 or t1_decimal.a = 1)"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# extracted or formula : pushing into HAVING using equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2
+where ((t2.a<4) and (v1.a=t2.a)) or ((t2.c>150) and (v1.max_c=t2.c));
+a b max_c avg_c a b c d
+1 19 107 107.0000 1 21 909 12
+1 19 107 107.0000 1 19 203 107
+1 21 500 234.6000 1 21 909 12
+1 21 500 234.6000 1 19 203 107
+5 16 207 207.0000 2 3 207 207
+6 20 315 279.3333 6 20 315 279
+select * from v1,t2
+where ((t2.a<4) and (v1.a=t2.a)) or ((t2.c>150) and (v1.max_c=t2.c));
+a b max_c avg_c a b c d
+1 19 107 107.0000 1 21 909 12
+1 19 107 107.0000 1 19 203 107
+1 21 500 234.6000 1 21 909 12
+1 21 500 234.6000 1 19 203 107
+5 16 207 207.0000 2 3 207 207
+6 20 315 279.3333 6 20 315 279
+explain select * from v1,t2
+where ((t2.a<4) and (v1.a=t2.a)) or ((t2.c>150) and (v1.max_c=t2.c));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+explain format=json select * from v1,t2
+where ((t2.a<4) and (v1.a=t2.a)) or ((t2.c>150) and (v1.max_c=t2.c));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a < 4 or t2.c > 150"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.a = t2.a and t2.a < 4 or v1.max_c = t2.c and t2.c > 150",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (t1.a < 4 or max_c > 150)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# conjunctive subformulas : pushing into WHERE and HAVING using equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2
+where ((t2.a>5) and (v1.a=t2.a)) and ((t2.c>250) and (v1.max_c=t2.c));
+a b max_c avg_c a b c d
+6 20 315 279.3333 6 20 315 279
+select * from v1,t2
+where ((t2.a>5) and (v1.a=t2.a)) and ((t2.c>250) and (v1.max_c=t2.c));
+a b max_c avg_c a b c d
+6 20 315 279.3333 6 20 315 279
+explain select * from v1,t2
+where ((t2.a>5) and (v1.a=t2.a)) and ((t2.c>250) and (v1.max_c=t2.c));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 10 test.t2.a,test.t2.c 2
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v1,t2
+where ((t2.a>5) and (v1.a=t2.a)) and ((t2.c>250) and (v1.max_c=t2.c));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a > 5 and t2.c > 250 and t2.a is not null and t2.c is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "10",
+ "used_key_parts": ["a", "max_c"],
+ "ref": ["test.t2.a", "test.t2.c"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 250",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# conjunctive subformulas : pushing into WHERE and HAVING
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b max_c avg_c a b c d
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 8 80 800 314
+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);
+a b max_c avg_c a b c d
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 8 80 800 314
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 8"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a = 8 and v1.max_c = 404"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c = 404",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 8"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# conjunctive subformulas : pushing into WHERE and HAVING
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where
+(v1.a>3) and (v1.max_c>200) and (t2.b<v1.b) and (t2.d=v1.max_c);
+a b max_c avg_c a b c d
+5 16 207 207.0000 2 3 207 207
+select * from v1,t2 where
+(v1.a>3) and (v1.max_c>200) and (t2.b<v1.b) and (t2.d=v1.max_c);
+a b max_c avg_c a b c d
+5 16 207 207.0000 2 3 207 207
+explain select * from v1,t2 where
+(v1.a>3) and (v1.max_c>200) and (t2.b<v1.b) and (t2.d=v1.max_c);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.d 2 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v1,t2 where
+(v1.a>3) and (v1.max_c>200) and (t2.b<v1.b) and (t2.d=v1.max_c);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.d is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["max_c"],
+ "ref": ["test.t2.d"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.a > 3 and v1.max_c > 200 and t2.b < v1.b and t2.d = v1.max_c",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 3"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# conjunctive subformula : pushing into WHERE
+# extracted or formula : pushing into HAVING using equalities
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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));
+a avg_a b c a b c
+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));
+a avg_a b c a b c
+explain 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));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 18 test.t.c,test.t.c 2 Using where
+2 DERIVED t1_double ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort
+explain format=json 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));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t.c is not null and t.c is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "18",
+ "used_key_parts": ["b", "c"],
+ "ref": ["test.t.c", "test.t.c"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t.c > 10 or v.a = 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "avg_a < 22.333 and (t1_double.b > 10 or t1_double.a = 1)",
+ "filesort": {
+ "sort_key": "t1_double.b, t1_double.c",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1_double",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t1_double.c = t1_double.b and t1_double.b > 12.2"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# conjunctive subformula : pushing into WHERE
+# extracted or formula : pushing into HAVING using equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a avg_a b c a b c
+1 0.50000000 12.5 18.9 1 12.5 18.9
+1 0.50000000 12.5 18.9 2 22.4 18.9
+1 0.50000000 12.5 18.9 7 17.89 18.9
+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);
+a avg_a b c a b c
+1 0.50000000 12.5 18.9 1 12.5 18.9
+1 0.50000000 12.5 18.9 2 22.4 18.9
+1 0.50000000 12.5 18.9 7 17.89 18.9
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 9 test.t.c 2 Using where
+2 DERIVED t1_double ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t.c > 18 and t.c is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "9",
+ "used_key_parts": ["c"],
+ "ref": ["test.t.c"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v.a > 0.2 or v.b < 17 or t.c > 17",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "avg_a < 22.333 and (t1_double.a > 0.2 or t1_double.b < 17 or t1_double.c > 17)",
+ "filesort": {
+ "sort_key": "t1_double.b, t1_double.c",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1_double",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t1_double.b > 12.2 and t1_double.c > 18"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# extracted or formula : pushing into WHERE
+# conjunctive subformula : pushing into HAVING
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b avg_c a b c
+2.0 1.0 13.0000 2.0 1.0 13
+2.0 3.0 13.0000 2.0 1.0 13
+2.0 1.0 13.0000 2.0 2.0 11
+2.0 3.0 13.0000 2.0 2.0 11
+2.0 1.0 13.0000 3.0 3.0 16
+2.0 3.0 13.0000 3.0 3.0 16
+2.0 1.0 13.0000 1.0 3.0 22
+2.0 3.0 13.0000 1.0 3.0 22
+2.0 1.0 13.0000 1.0 3.0 14
+2.0 3.0 13.0000 1.0 3.0 14
+2.0 1.0 13.0000 2.0 2.0 15
+2.0 3.0 13.0000 2.0 2.0 15
+2.0 1.0 13.0000 2.0 1.0 43
+2.0 3.0 13.0000 2.0 1.0 43
+2.0 1.0 13.0000 2.0 3.0 11
+2.0 3.0 13.0000 2.0 3.0 11
+2.0 1.0 13.0000 2.0 3.0 16
+2.0 3.0 13.0000 2.0 3.0 16
+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);
+a b avg_c a b c
+2.0 1.0 13.0000 2.0 1.0 13
+2.0 3.0 13.0000 2.0 1.0 13
+2.0 1.0 13.0000 2.0 2.0 11
+2.0 3.0 13.0000 2.0 2.0 11
+2.0 1.0 13.0000 3.0 3.0 16
+2.0 3.0 13.0000 3.0 3.0 16
+2.0 1.0 13.0000 1.0 3.0 22
+2.0 3.0 13.0000 1.0 3.0 22
+2.0 1.0 13.0000 1.0 3.0 14
+2.0 3.0 13.0000 1.0 3.0 14
+2.0 1.0 13.0000 2.0 2.0 15
+2.0 3.0 13.0000 2.0 2.0 15
+2.0 1.0 13.0000 2.0 1.0 43
+2.0 3.0 13.0000 2.0 1.0 43
+2.0 1.0 13.0000 2.0 3.0 11
+2.0 3.0 13.0000 2.0 3.0 11
+2.0 1.0 13.0000 2.0 3.0 16
+2.0 3.0 13.0000 2.0 3.0 16
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY t ALL NULL NULL NULL NULL 9 Using join buffer (flat, BNL join)
+2 DERIVED t1_decimal ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "(v.a > 4 or v.a = 2 or v.b > 3) and v.avg_c = 13",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "avg_c > 12 and avg_c = 13",
+ "filesort": {
+ "sort_key": "t1_decimal.a, t1_decimal.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1_decimal",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t1_decimal.a > 4 or t1_decimal.a = 2 or t1_decimal.b > 3"
+ }
+ }
+ }
+ }
+ }
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL"
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b max_c avg_c a b c d
+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);
+a b max_c avg_c a b c d
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 10 test.t2.a,test.t2.a 2 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null and t2.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "10",
+ "used_key_parts": ["a", "b"],
+ "ref": ["test.t2.a", "test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 300",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b = t1.a and t1.a > 5"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# nothing to push
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (t2.a<2) and (t2.c>900);
+a b max_c avg_c a b c d
+1 19 107 107.0000 1 21 909 12
+1 21 500 234.6000 1 21 909 12
+5 16 207 207.0000 1 21 909 12
+5 27 132 132.0000 1 21 909 12
+6 20 315 279.3333 1 21 909 12
+8 33 404 213.6667 1 21 909 12
+select * from v1,t2 where (t2.a<2) and (t2.c>900);
+a b max_c avg_c a b c d
+1 19 107 107.0000 1 21 909 12
+1 21 500 234.6000 1 21 909 12
+5 16 207 207.0000 1 21 909 12
+5 27 132 132.0000 1 21 909 12
+6 20 315 279.3333 1 21 909 12
+8 33 404 213.6667 1 21 909 12
+explain select * from v1,t2 where (t2.a<2) and (t2.c>900);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+explain format=json select * from v1,t2 where (t2.a<2) and (t2.c>900);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a < 2 and t2.c > 900"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.b=t2.b);
+a b max_c avg_c a b c d
+1 21 500 234.6000 1 21 909 12
+6 20 315 279.3333 6 20 315 279
+1 19 107 107.0000 1 19 203 107
+select * from v1,t2 where (v1.a=t2.a) and (v1.b=t2.b);
+a b max_c avg_c a b c d
+1 21 500 234.6000 1 21 909 12
+6 20 315 279.3333 6 20 315 279
+1 19 107 107.0000 1 19 203 107
+explain select * from v1,t2 where (v1.a=t2.a) and (v1.b=t2.b);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 10 test.t2.a,test.t2.b 2
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.b=t2.b);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null and t2.b is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "10",
+ "used_key_parts": ["a", "b"],
+ "ref": ["test.t2.a", "test.t2.b"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where
+(t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6));
+a b max_c avg_c a b c d
+1 19 107 107.0000 1 21 909 12
+1 19 107 107.0000 1 19 203 107
+1 21 500 234.6000 1 21 909 12
+1 21 500 234.6000 1 19 203 107
+6 20 315 279.3333 6 20 315 279
+6 20 315 279.3333 6 23 303 909
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 8 80 800 314
+select * from v1,t2 where
+(t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6));
+a b max_c avg_c a b c d
+1 19 107 107.0000 1 21 909 12
+1 19 107 107.0000 1 19 203 107
+1 21 500 234.6000 1 21 909 12
+1 21 500 234.6000 1 19 203 107
+6 20 315 279.3333 6 20 315 279
+6 20 315 279.3333 6 23 303 909
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 8 80 800 314
+explain select * from v1,t2 where
+(t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+explain format=json select * from v1,t2 where
+(t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.a = t2.a or v1.b = t2.b and (v1.a = 1 or v1.a = 6)",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=1) or (v1.b=21) or (t2.a=2);
+a b max_c avg_c a b c d
+1 19 107 107.0000 2 3 207 207
+1 19 107 107.0000 1 21 909 12
+1 19 107 107.0000 7 13 312 406
+1 19 107 107.0000 8 64 248 107
+1 19 107 107.0000 6 20 315 279
+1 19 107 107.0000 1 19 203 107
+1 19 107 107.0000 8 80 800 314
+1 19 107 107.0000 3 12 231 190
+1 19 107 107.0000 6 23 303 909
+1 21 500 234.6000 2 3 207 207
+1 21 500 234.6000 1 21 909 12
+1 21 500 234.6000 7 13 312 406
+1 21 500 234.6000 8 64 248 107
+1 21 500 234.6000 6 20 315 279
+1 21 500 234.6000 1 19 203 107
+1 21 500 234.6000 8 80 800 314
+1 21 500 234.6000 3 12 231 190
+1 21 500 234.6000 6 23 303 909
+5 16 207 207.0000 2 3 207 207
+5 27 132 132.0000 2 3 207 207
+6 20 315 279.3333 2 3 207 207
+8 33 404 213.6667 2 3 207 207
+select * from v1,t2 where (v1.a=1) or (v1.b=21) or (t2.a=2);
+a b max_c avg_c a b c d
+1 19 107 107.0000 2 3 207 207
+1 19 107 107.0000 1 21 909 12
+1 19 107 107.0000 7 13 312 406
+1 19 107 107.0000 8 64 248 107
+1 19 107 107.0000 6 20 315 279
+1 19 107 107.0000 1 19 203 107
+1 19 107 107.0000 8 80 800 314
+1 19 107 107.0000 3 12 231 190
+1 19 107 107.0000 6 23 303 909
+1 21 500 234.6000 2 3 207 207
+1 21 500 234.6000 1 21 909 12
+1 21 500 234.6000 7 13 312 406
+1 21 500 234.6000 8 64 248 107
+1 21 500 234.6000 6 20 315 279
+1 21 500 234.6000 1 19 203 107
+1 21 500 234.6000 8 80 800 314
+1 21 500 234.6000 3 12 231 190
+1 21 500 234.6000 6 23 303 909
+5 16 207 207.0000 2 3 207 207
+5 27 132 132.0000 2 3 207 207
+6 20 315 279.3333 2 3 207 207
+8 33 404 213.6667 2 3 207 207
+explain select * from v1,t2 where (v1.a=1) or (v1.b=21) or (t2.a=2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+explain format=json select * from v1,t2 where (v1.a=1) or (v1.b=21) or (t2.a=2);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.a = 1 or v1.b = 21 or t2.a = 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where
+(t2.a<2) and (t2.c>900) and ((v1.a<t2.a) or (t2.a<11));
+a b max_c avg_c a b c d
+1 19 107 107.0000 1 21 909 12
+1 21 500 234.6000 1 21 909 12
+5 16 207 207.0000 1 21 909 12
+5 27 132 132.0000 1 21 909 12
+6 20 315 279.3333 1 21 909 12
+8 33 404 213.6667 1 21 909 12
+select * from v1,t2 where
+(t2.a<2) and (t2.c>900) and ((v1.a<t2.a) or (t2.a<11));
+a b max_c avg_c a b c d
+1 19 107 107.0000 1 21 909 12
+1 21 500 234.6000 1 21 909 12
+5 16 207 207.0000 1 21 909 12
+5 27 132 132.0000 1 21 909 12
+6 20 315 279.3333 1 21 909 12
+8 33 404 213.6667 1 21 909 12
+explain select * from v1,t2 where
+(t2.a<2) and (t2.c>900) and ((v1.a<t2.a) or (t2.a<11));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+explain format=json select * from v1,t2 where
+(t2.a<2) and (t2.c>900) and ((v1.a<t2.a) or (t2.a<11));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a < 2 and t2.c > 900"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.a < t2.a or t2.a < 11",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# using several derived tables : nothing to push
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where
+(v1.a=v2.a) and (v1.a=t2.a) and (v2.b<50);
+a b max_c avg_c a b max_c avg_c a b c d
+8 33 404 213.6667 8 33 404 213.6667 8 64 248 107
+6 20 315 279.3333 6 20 315 279.3333 6 20 315 279
+8 33 404 213.6667 8 33 404 213.6667 8 80 800 314
+6 20 315 279.3333 6 20 315 279.3333 6 23 303 909
+select * from v1,v2,t2 where
+(v1.a=v2.a) and (v1.a=t2.a) and (v2.b<50);
+a b max_c avg_c a b max_c avg_c a b c d
+8 33 404 213.6667 8 33 404 213.6667 8 64 248 107
+6 20 315 279.3333 6 20 315 279.3333 6 20 315 279
+8 33 404 213.6667 8 33 404 213.6667 8 80 800 314
+6 20 315 279.3333 6 20 315 279.3333 6 23 303 909
+explain select * from v1,v2,t2 where
+(v1.a=v2.a) and (v1.a=t2.a) and (v2.b<50);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key1 key1 5 test.t2.a 2
+1 PRIMARY <derived3> ref key0 key0 5 test.t2.a 2 Using where
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+explain format=json select * from v1,v2,t2 where
+(v1.a=v2.a) and (v1.a=t2.a) and (v2.b<50);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null and t2.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key1"],
+ "key": "key1",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.b < 50",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and t1.b < 50"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where
+((v1.a=v2.a) or (v1.a=t2.a)) and (t2.b<50) and (v1.b=v2.b);
+a b max_c avg_c a b max_c avg_c a b c d
+6 20 315 279.3333 6 20 315 279.3333 2 3 207 207
+6 20 315 279.3333 6 20 315 279.3333 1 21 909 12
+6 20 315 279.3333 6 20 315 279.3333 7 13 312 406
+6 20 315 279.3333 6 20 315 279.3333 6 20 315 279
+6 20 315 279.3333 6 20 315 279.3333 1 19 203 107
+6 20 315 279.3333 6 20 315 279.3333 3 12 231 190
+6 20 315 279.3333 6 20 315 279.3333 6 23 303 909
+8 33 404 213.6667 8 33 404 213.6667 2 3 207 207
+8 33 404 213.6667 8 33 404 213.6667 1 21 909 12
+8 33 404 213.6667 8 33 404 213.6667 7 13 312 406
+8 33 404 213.6667 8 33 404 213.6667 6 20 315 279
+8 33 404 213.6667 8 33 404 213.6667 1 19 203 107
+8 33 404 213.6667 8 33 404 213.6667 3 12 231 190
+8 33 404 213.6667 8 33 404 213.6667 6 23 303 909
+select * from v1,v2,t2 where
+((v1.a=v2.a) or (v1.a=t2.a)) and (t2.b<50) and (v1.b=v2.b);
+a b max_c avg_c a b max_c avg_c a b c d
+6 20 315 279.3333 6 20 315 279.3333 2 3 207 207
+6 20 315 279.3333 6 20 315 279.3333 1 21 909 12
+6 20 315 279.3333 6 20 315 279.3333 7 13 312 406
+6 20 315 279.3333 6 20 315 279.3333 6 20 315 279
+6 20 315 279.3333 6 20 315 279.3333 1 19 203 107
+6 20 315 279.3333 6 20 315 279.3333 3 12 231 190
+6 20 315 279.3333 6 20 315 279.3333 6 23 303 909
+8 33 404 213.6667 8 33 404 213.6667 2 3 207 207
+8 33 404 213.6667 8 33 404 213.6667 1 21 909 12
+8 33 404 213.6667 8 33 404 213.6667 7 13 312 406
+8 33 404 213.6667 8 33 404 213.6667 6 20 315 279
+8 33 404 213.6667 8 33 404 213.6667 1 19 203 107
+8 33 404 213.6667 8 33 404 213.6667 3 12 231 190
+8 33 404 213.6667 8 33 404 213.6667 6 23 303 909
+explain select * from v1,v2,t2 where
+((v1.a=v2.a) or (v1.a=t2.a)) and (t2.b<50) and (v1.b=v2.b);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY <derived3> ref key0 key0 5 v1.b 2 Using where
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+explain format=json select * from v1,v2,t2 where
+((v1.a=v2.a) or (v1.a=t2.a)) and (t2.b<50) and (v1.b=v2.b);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.b < 50"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.b is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["v1.b"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.a = v1.a or v1.a = t2.a",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where
+((v1.a=v2.a) and (v1.a=t2.a)) or ((v2.b>13) and (t2.c<115));
+a b max_c avg_c a b max_c avg_c a b c d
+6 20 315 279.3333 6 20 315 279.3333 6 20 315 279
+6 20 315 279.3333 6 20 315 279.3333 6 23 303 909
+8 33 404 213.6667 8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 8 33 404 213.6667 8 80 800 314
+select * from v1,v2,t2 where
+((v1.a=v2.a) and (v1.a=t2.a)) or ((v2.b>13) and (t2.c<115));
+a b max_c avg_c a b max_c avg_c a b c d
+6 20 315 279.3333 6 20 315 279.3333 6 20 315 279
+6 20 315 279.3333 6 20 315 279.3333 6 23 303 909
+8 33 404 213.6667 8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 8 33 404 213.6667 8 80 800 314
+explain select * from v1,v2,t2 where
+((v1.a=v2.a) and (v1.a=t2.a)) or ((v2.b>13) and (t2.c<115));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY <derived3> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (incremental, BNL join)
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+explain format=json select * from v1,v2,t2 where
+((v1.a=v2.a) and (v1.a=t2.a)) or ((v2.b>13) and (t2.c<115));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.a = t2.a or t2.c < 115",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "incremental",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.a = t2.a and v2.a = t2.a or v2.b > 13 and t2.c < 115",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# using several derived tables : pushing in all tables
+# conjunctive subformula : pushing into HAVING
+# extracted or formula : pushing into WHERE
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b max_c avg_c a b max_c avg_c a b c d
+1 19 107 107.0000 6 20 315 279.3333 1 21 909 12
+1 19 107 107.0000 6 20 315 279.3333 1 19 203 107
+1 19 107 107.0000 8 33 404 213.6667 1 21 909 12
+1 19 107 107.0000 8 33 404 213.6667 1 19 203 107
+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);
+a b max_c avg_c a b max_c avg_c a b c d
+1 19 107 107.0000 6 20 315 279.3333 1 21 909 12
+1 19 107 107.0000 6 20 315 279.3333 1 19 203 107
+1 19 107 107.0000 8 33 404 213.6667 1 21 909 12
+1 19 107 107.0000 8 33 404 213.6667 1 19 203 107
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY <derived3> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (incremental, BNL join)
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c < 300"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c < 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v2.b < 50 or v2.b = 19"
+ },
+ "buffer_type": "incremental",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "(v2.a = v1.a or v1.a = t2.a) and (v2.b < 50 or v2.b = 19)",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and (t1.b < 50 or t1.b = 19)"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# using several derived tables : pushing only in one table
+# conjunctive subformula : pushing into WHERE
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b max_c avg_c a b max_c avg_c a b c d
+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);
+a b max_c avg_c a b max_c avg_c a b c d
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key1 key1 10 test.t2.a,test.t2.a 2
+1 PRIMARY <derived3> ref key0 key0 5 test.t2.a 2 Using where
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null and t2.a is not null and t2.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key1"],
+ "key": "key1",
+ "key_length": "10",
+ "used_key_parts": ["a", "b"],
+ "ref": ["test.t2.a", "test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b = t1.a"
+ }
+ }
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.max_c < 300",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707 and max_c < 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# using several derived tables : pushing only in one table
+# extracted and formula : pushing into WHERE
+# conjunctive subformula : pushing into WHERE using equalities
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where (v1.a=1) and (v1.b>10) and (v1.b=v2.b);
+a b max_c avg_c a b max_c avg_c a b c d
+select * from v1,v2,t2 where (v1.a=1) and (v1.b>10) and (v1.b=v2.b);
+a b max_c avg_c a b max_c avg_c a b c d
+explain select * from v1,v2,t2 where (v1.a=1) and (v1.b>10) and (v1.b=v2.b);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY <derived3> ref key0 key0 5 v1.b 2
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v1,v2,t2 where (v1.a=1) and (v1.b>10) and (v1.b=v2.b);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a = 1 and v1.b > 10"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.b is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.b > 10"
+ }
+ }
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["v1.b"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and t1.b > 10"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# extracted or formula : pushing into WHERE
+# conjunctive subformula : pushing into WHERE using equalities
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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'));
+a b max_c a b c
+b Vika 2 b Ivan 1
+b Vika 2 b Ali 6
+b Vika 2 b Hermes 3
+b Vika 2 b Ivan 11
+b Vika 2 b Harry 4
+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'));
+a b max_c a b c
+b Vika 2 b Ivan 1
+b Vika 2 b Ali 6
+b Vika 2 b Hermes 3
+b Vika 2 b Ivan 11
+b Vika 2 b Harry 4
+explain 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'));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 12 Using where
+1 PRIMARY t ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1_char ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort
+explain format=json 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'));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "v.a = 'b' and (v.b = 'Vika' or v.b = 'Ali')",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 9",
+ "filesort": {
+ "sort_key": "t1_char.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1_char",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t1_char.a = 'b' and (t1_char.b = 'Vika' or t1_char.b = 'Ali')"
+ }
+ }
+ }
+ }
+ }
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t.a = 'b'"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL"
+ }
+ }
+}
+# using several derived tables : pushing in all tables
+# extracted or formula : pushing into WHERE
+# conjunctive subformulas : pushing into HAVING
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b max_c avg_c a b max_c avg_c a b min_c a b c d
+6 20 315 279.3333 6 20 315 279.3333 7 11 708 7 13 312 406
+6 20 315 279.3333 6 20 315 279.3333 8 33 114 8 64 248 107
+6 20 315 279.3333 6 20 315 279.3333 6 20 214 6 20 315 279
+6 20 315 279.3333 6 20 315 279.3333 8 33 114 8 80 800 314
+6 20 315 279.3333 6 20 315 279.3333 6 20 214 6 23 303 909
+6 20 315 279.3333 8 33 404 213.6667 6 20 214 6 20 315 279
+6 20 315 279.3333 8 33 404 213.6667 6 20 214 6 23 303 909
+8 33 404 213.6667 6 20 315 279.3333 8 33 114 8 64 248 107
+8 33 404 213.6667 6 20 315 279.3333 8 33 114 8 80 800 314
+8 33 404 213.6667 8 33 404 213.6667 7 11 708 7 13 312 406
+8 33 404 213.6667 8 33 404 213.6667 8 33 114 8 64 248 107
+8 33 404 213.6667 8 33 404 213.6667 6 20 214 6 20 315 279
+8 33 404 213.6667 8 33 404 213.6667 8 33 114 8 80 800 314
+8 33 404 213.6667 8 33 404 213.6667 6 20 214 6 23 303 909
+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);
+a b max_c avg_c a b max_c avg_c a b min_c a b c d
+6 20 315 279.3333 6 20 315 279.3333 7 11 708 7 13 312 406
+6 20 315 279.3333 6 20 315 279.3333 8 33 114 8 64 248 107
+6 20 315 279.3333 6 20 315 279.3333 6 20 214 6 20 315 279
+6 20 315 279.3333 6 20 315 279.3333 8 33 114 8 80 800 314
+6 20 315 279.3333 6 20 315 279.3333 6 20 214 6 23 303 909
+6 20 315 279.3333 8 33 404 213.6667 6 20 214 6 20 315 279
+6 20 315 279.3333 8 33 404 213.6667 6 20 214 6 23 303 909
+8 33 404 213.6667 6 20 315 279.3333 8 33 114 8 64 248 107
+8 33 404 213.6667 6 20 315 279.3333 8 33 114 8 80 800 314
+8 33 404 213.6667 8 33 404 213.6667 7 11 708 7 13 312 406
+8 33 404 213.6667 8 33 404 213.6667 8 33 114 8 64 248 107
+8 33 404 213.6667 8 33 404 213.6667 6 20 214 6 20 315 279
+8 33 404 213.6667 8 33 404 213.6667 8 33 114 8 80 800 314
+8 33 404 213.6667 8 33 404 213.6667 6 20 214 6 23 303 909
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived4> ref key0 key0 5 test.t2.a 2 Using where
+1 PRIMARY <derived3> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (incremental, BNL join)
+4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ },
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v3.b < 50 or v3.b = 33",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "min_c > 109",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and (t1.b < 50 or t1.b = 33)"
+ }
+ }
+ }
+ }
+ }
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v2.max_c > 300"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707 and max_c > 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ }
+ }
+ }
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c < 500"
+ },
+ "buffer_type": "incremental",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.a = v2.a or v1.a = t2.a",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c < 500",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# using several derived tables : pushing in all tables
+# conjunctive subformulas : pushing into HAVING
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b max_c avg_c a b min_c a b c d
+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);
+a b max_c avg_c a b min_c a b c d
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key1 key1 5 test.t2.b 2 Using where
+1 PRIMARY <derived3> ref key0 key0 5 v1.a 2 Using where
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.b is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key1"],
+ "key": "key1",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t2.b"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 130 and v1.a is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 130",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["v1.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.min_c < 130",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "min_c < 707 and min_c < 130",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# using several derived tables : pushing in all tables
+# extracted or formulas : pushing into HAVING
+# conjunctive subformula : pushing into HAVING
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b max_c avg_c a b min_c a b avg_c a b c d
+8 33 404 213.6667 8 33 114 1 33 497.5000 2 3 207 207
+8 33 404 213.6667 8 33 114 1 33 497.5000 1 21 909 12
+8 33 404 213.6667 8 33 114 1 33 497.5000 7 13 312 406
+8 33 404 213.6667 8 33 114 1 33 497.5000 8 64 248 107
+8 33 404 213.6667 8 33 114 1 33 497.5000 6 20 315 279
+8 33 404 213.6667 8 33 114 1 33 497.5000 1 19 203 107
+8 33 404 213.6667 8 33 114 1 33 497.5000 8 80 800 314
+8 33 404 213.6667 8 33 114 1 33 497.5000 3 12 231 190
+8 33 404 213.6667 8 33 114 1 33 497.5000 6 23 303 909
+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);
+a b max_c avg_c a b min_c a b avg_c a b c d
+8 33 404 213.6667 8 33 114 1 33 497.5000 2 3 207 207
+8 33 404 213.6667 8 33 114 1 33 497.5000 1 21 909 12
+8 33 404 213.6667 8 33 114 1 33 497.5000 7 13 312 406
+8 33 404 213.6667 8 33 114 1 33 497.5000 8 64 248 107
+8 33 404 213.6667 8 33 114 1 33 497.5000 6 20 315 279
+8 33 404 213.6667 8 33 114 1 33 497.5000 1 19 203 107
+8 33 404 213.6667 8 33 114 1 33 497.5000 8 80 800 314
+8 33 404 213.6667 8 33 114 1 33 497.5000 3 12 231 190
+8 33 404 213.6667 8 33 114 1 33 497.5000 6 23 303 909
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY <derived3> ref key0 key0 5 v1.a 2 Using where
+1 PRIMARY <derived4> ref key0 key0 5 v1.b 2 Using where
+4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.avg_c < 400 or v1.a > 1"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "(v1.avg_c < 400 or v1.a > 1) and v1.a is not null and v1.b is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (avg_c < 400 or t1.a > 1)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["v1.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.min_c < 200",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "min_c < 707 and min_c < 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["v1.b"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v3.avg_c > 170 or v3.a < 5",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "avg_c > 170 or t1.a < 5",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 8"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# extracted or formula : pushing into HAVING
+# conjunctive subformula : pushing into WHERE
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b max_c avg_c a b c d
+5 27 132 132.0000 2 3 207 207
+5 27 132 132.0000 1 21 909 12
+5 27 132 132.0000 7 13 312 406
+5 27 132 132.0000 8 64 248 107
+5 27 132 132.0000 6 20 315 279
+5 27 132 132.0000 1 19 203 107
+5 27 132 132.0000 8 80 800 314
+5 27 132 132.0000 3 12 231 190
+5 27 132 132.0000 6 23 303 909
+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);
+a b max_c avg_c a b c d
+5 27 132 132.0000 2 3 207 207
+5 27 132 132.0000 1 21 909 12
+5 27 132 132.0000 7 13 312 406
+5 27 132 132.0000 8 64 248 107
+5 27 132 132.0000 6 20 315 279
+5 27 132 132.0000 1 19 203 107
+5 27 132 132.0000 8 80 800 314
+5 27 132 132.0000 3 12 231 190
+5 27 132 132.0000 6 23 303 909
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "(v1.a = 1 or v1.max_c < 300) and v1.b > 25"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.a = 1 or v1.max_c < 300",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (t1.a = 1 or max_c < 300)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 25"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# extracted and formula : pushing into WHERE
+# conjunctive subformula : pushing into HAVING
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b max_c avg_c a b c d
+6 20 315 279.3333 6 20 315 279
+6 20 315 279.3333 6 23 303 909
+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);
+a b max_c avg_c a b c d
+6 20 315 279.3333 6 20 315 279
+6 20 315 279.3333 6 23 303 909
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 300 and v1.b < 30",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and t1.b < 30"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# using query with union
+# conjunctive subformula : pushing into WHERE
+# conjunctive subformulas : pushing into HAVING and WHERE
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b max_c avg_c a b c d
+1 21 500 234.6000 1 21 909 12
+8 33 404 213.6667 6 23 303 909
+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);
+a b max_c avg_c a b c d
+1 21 500 234.6000 1 21 909 12
+8 33 404 213.6667 6 23 303 909
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived3> ref key0 key0 5 test.t2.b 2 Using where
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 UNION t2 ALL NULL NULL NULL NULL 9 Using where
+2 UNION <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "union_result": {
+ "table_name": "<union1,2>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.c > 800 and t2.b is not null"
+ },
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t2.b"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.a < 5",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 5"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.d > 800"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 100 and v1.a > 7"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707 and max_c > 100",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 7"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+}
+# using query with union
+# extracted and formula : pushing into WHERE
+# extracted or formula : pushing into HAVING
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b max_c avg_c a b c d
+1 19 107 107.0000 1 19 203 107
+1 21 500 234.6000 2 3 207 207
+1 21 500 234.6000 7 13 312 406
+1 21 500 234.6000 8 64 248 107
+1 21 500 234.6000 6 20 315 279
+1 21 500 234.6000 8 80 800 314
+1 21 500 234.6000 3 12 231 190
+1 21 500 234.6000 6 23 303 909
+6 20 315 279.3333 7 13 312 406
+6 20 315 279.3333 8 64 248 107
+6 20 315 279.3333 8 80 800 314
+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);
+a b max_c avg_c a b c d
+1 19 107 107.0000 1 19 203 107
+1 21 500 234.6000 2 3 207 207
+1 21 500 234.6000 7 13 312 406
+1 21 500 234.6000 8 64 248 107
+1 21 500 234.6000 6 20 315 279
+1 21 500 234.6000 8 80 800 314
+1 21 500 234.6000 3 12 231 190
+1 21 500 234.6000 6 23 303 909
+6 20 315 279.3333 7 13 312 406
+6 20 315 279.3333 8 64 248 107
+6 20 315 279.3333 8 80 800 314
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived3> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 UNION t2 ALL NULL NULL NULL NULL 9
+2 UNION <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "union_result": {
+ "table_name": "<union1,2>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.b = 19"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.b = 19 and v1.a < 5"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b = 19 and t1.a < 5"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 400 or v1.avg_c > 270"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "(v1.max_c > 400 or v1.avg_c > 270) and v1.a < t2.a",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707 and (max_c > 400 or avg_c > 270)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+}
+# using query with union
+# extracted or formula : pushing into HAVING
+# extracted or formula : pushing into WHERE
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b max_c avg_c a b c d
+1 19 107 107.0000 1 21 909 12
+1 19 107 107.0000 1 19 203 107
+1 21 500 234.6000 1 21 909 12
+1 21 500 234.6000 1 19 203 107
+6 20 315 279.3333 6 20 315 279
+6 20 315 279.3333 6 23 303 909
+8 33 404 213.6667 2 3 207 207
+8 33 404 213.6667 1 21 909 12
+8 33 404 213.6667 7 13 312 406
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 6 20 315 279
+8 33 404 213.6667 1 19 203 107
+8 33 404 213.6667 8 80 800 314
+8 33 404 213.6667 3 12 231 190
+8 33 404 213.6667 6 23 303 909
+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);
+a b max_c avg_c a b c d
+1 19 107 107.0000 1 21 909 12
+1 19 107 107.0000 1 19 203 107
+1 21 500 234.6000 1 21 909 12
+1 21 500 234.6000 1 19 203 107
+6 20 315 279.3333 6 20 315 279
+6 20 315 279.3333 6 23 303 909
+8 33 404 213.6667 2 3 207 207
+8 33 404 213.6667 1 21 909 12
+8 33 404 213.6667 7 13 312 406
+8 33 404 213.6667 8 64 248 107
+8 33 404 213.6667 6 20 315 279
+8 33 404 213.6667 1 19 203 107
+8 33 404 213.6667 8 80 800 314
+8 33 404 213.6667 3 12 231 190
+8 33 404 213.6667 6 23 303 909
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived3> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 UNION t2 ALL NULL NULL NULL NULL 9
+2 UNION <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "union_result": {
+ "table_name": "<union1,2>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a = 1 or v1.a = 6"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "(v1.a = t2.a or v1.b = t2.b) and (v1.a = 1 or v1.a = 6)",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 or t1.a = 6"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a > 3 and v1.b > 27 or v1.max_c > 550"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.a > 3 and v1.b > 27 or v1.max_c > 550",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707 and (t1.a > 3 and t1.b > 27 or max_c > 550)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+}
+# using query with union
+# extracted or formula : pushing into HAVING
+# conjunctive subformulas : pushing into WHERE
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b max_c avg_c a b c d
+1 19 107 107.0000 1 21 909 12
+1 19 107 107.0000 1 19 203 107
+6 20 315 279.3333 1 21 909 12
+6 20 315 279.3333 1 19 203 107
+8 33 404 213.6667 1 21 909 12
+8 33 404 213.6667 1 19 203 107
+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);
+a b max_c avg_c a b c d
+1 19 107 107.0000 1 21 909 12
+1 19 107 107.0000 1 19 203 107
+6 20 315 279.3333 1 21 909 12
+6 20 315 279.3333 1 19 203 107
+8 33 404 213.6667 1 21 909 12
+8 33 404 213.6667 1 19 203 107
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 UNION t2 ALL NULL NULL NULL NULL 9 Using where
+2 UNION <derived5> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+5 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 UNION t2 ALL NULL NULL NULL NULL 9 Using where
+3 UNION <derived6> ref key0 key0 5 test.t2.c 2 Using where
+6 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+NULL UNION RESULT <union1,2,3> ALL NULL NULL NULL NULL NULL
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "union_result": {
+ "table_name": "<union1,2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 1"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a = 1 and (v1.max_c < 500 or v1.avg_c > 500)"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.max_c < 500 or v1.avg_c > 500",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707 and (max_c < 500 or avg_c > 500)",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a < 2"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived5>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v2.b > 10"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v2.a < t2.b or v2.max_c > 200",
+ "materialized": {
+ "query_block": {
+ "select_id": 5,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and t1.b > 10"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.c is not null"
+ },
+ "table": {
+ "table_name": "<derived6>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["max_c"],
+ "ref": ["test.t2.c"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.b < 10",
+ "materialized": {
+ "query_block": {
+ "select_id": 6,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and t1.b < 10"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+}
+# using derived table with union
+# conjunctive subformulas : pushing into WHERE and HAVING
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_union,t2 where (v_union.a<3) and (v_union.c>100);
+a b c a b c d
+1 19 107 2 3 207 207
+1 19 107 1 21 909 12
+1 19 107 7 13 312 406
+1 19 107 8 64 248 107
+1 19 107 6 20 315 279
+1 19 107 1 19 203 107
+1 19 107 8 80 800 314
+1 19 107 3 12 231 190
+1 19 107 6 23 303 909
+select * from v_union,t2 where (v_union.a<3) and (v_union.c>100);
+a b c a b c d
+1 19 107 2 3 207 207
+1 19 107 1 21 909 12
+1 19 107 7 13 312 406
+1 19 107 8 64 248 107
+1 19 107 6 20 315 279
+1 19 107 1 19 203 107
+1 19 107 8 80 800 314
+1 19 107 3 12 231 190
+1 19 107 6 23 303 909
+explain select * from v_union,t2 where (v_union.a<3) and (v_union.c>100);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 40 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+explain format=json select * from v_union,t2 where (v_union.a<3) and (v_union.c>100);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 40,
+ "filtered": 100,
+ "attached_condition": "v_union.a < 3 and v_union.c > 100"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 109 and c > 100",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and t1.a < 3"
+ }
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "c < 300 and c > 100",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.a < 3"
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+# using derived table with union
+# conjunctive subformula : pushing into WHERE
+# extracted or formula : pushing into HAVING
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_union,t2 where
+((v_union.a<2) or (v_union.c>800)) and (v_union.b>12);
+a b c a b c d
+1 19 107 2 3 207 207
+1 19 107 1 21 909 12
+1 19 107 7 13 312 406
+1 19 107 8 64 248 107
+1 19 107 6 20 315 279
+1 19 107 1 19 203 107
+1 19 107 8 80 800 314
+1 19 107 3 12 231 190
+1 19 107 6 23 303 909
+select * from v_union,t2 where
+((v_union.a<2) or (v_union.c>800)) and (v_union.b>12);
+a b c a b c d
+1 19 107 2 3 207 207
+1 19 107 1 21 909 12
+1 19 107 7 13 312 406
+1 19 107 8 64 248 107
+1 19 107 6 20 315 279
+1 19 107 1 19 203 107
+1 19 107 8 80 800 314
+1 19 107 3 12 231 190
+1 19 107 6 23 303 909
+explain select * from v_union,t2 where
+((v_union.a<2) or (v_union.c>800)) and (v_union.b>12);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 40 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+explain format=json select * from v_union,t2 where
+((v_union.a<2) or (v_union.c>800)) and (v_union.b>12);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 40,
+ "filtered": 100,
+ "attached_condition": "(v_union.a < 2 or v_union.c > 800) and v_union.b > 12"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v_union.a < 2 or v_union.c > 800",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 109 and (t1.a < 2 or c > 800)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and t1.b > 12"
+ }
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "c < 300 and (t1.a < 2 or c > 800)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.b > 12"
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+# using derived table with union
+# conjunctive subformula : pushing into HAVING
+# conjunctive subformula : pushing into WHERE
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_union,t2 where
+(v_union.a=1) and (v_union.a=t2.a) and (v_union.c<200);
+a b c a b c d
+1 19 107 1 21 909 12
+1 19 107 1 19 203 107
+select * from v_union,t2 where
+(v_union.a=1) and (v_union.a=t2.a) and (v_union.c<200);
+a b c a b c d
+1 19 107 1 21 909 12
+1 19 107 1 19 203 107
+explain select * from v_union,t2 where
+(v_union.a=1) and (v_union.a=t2.a) and (v_union.c<200);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 40 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+explain format=json select * from v_union,t2 where
+(v_union.a=1) and (v_union.a=t2.a) and (v_union.c<200);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 1"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 40,
+ "filtered": 100,
+ "attached_condition": "v_union.a = 1 and v_union.c < 200"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 109 and c < 200",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1"
+ }
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "c < 300 and c < 200",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.b > 10"
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_char as v,t2_char as t where
+(v.a=t.a) and (v.b='Vika') and (v.max_c>2);
+a b max_c a b c
+c Vika 7 c Vinny 3
+c Vika 7 c Inga 9
+c Vika 7 c Ivan 2
+c Vika 7 c Inga 2
+select * from v_char as v,t2_char as t where
+(v.a=t.a) and (v.b='Vika') and (v.max_c>2);
+a b max_c a b c
+c Vika 7 c Vinny 3
+c Vika 7 c Inga 9
+c Vika 7 c Ivan 2
+c Vika 7 c Inga 2
+explain select * from v_char as v,t2_char as t where
+(v.a=t.a) and (v.b='Vika') and (v.max_c>2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t ALL NULL NULL NULL NULL 12 Using where
+1 PRIMARY <derived2> ref key0 key0 2 test.t.a 2 Using where
+2 DERIVED t1_char ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort
+explain format=json select * from v_char as v,t2_char as t where
+(v.a=t.a) and (v.b='Vika') and (v.max_c>2);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "2",
+ "used_key_parts": ["a"],
+ "ref": ["test.t.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v.b = 'Vika' and v.max_c > 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 9 and max_c > 2",
+ "filesort": {
+ "sort_key": "t1_char.a",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1_char",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t1_char.b = 'Vika'"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# using derived table with union
+# using several derived tables : pushing in all tables
+# conjunctive subformula : pushing into WHERE using equalities
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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));
+a b c a b max_c avg_c a b c d
+1 19 107 1 21 500 234.6000 1 21 909 12
+1 19 107 1 21 500 234.6000 1 19 203 107
+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));
+a b c a b max_c avg_c a b c d
+1 19 107 1 21 500 234.6000 1 21 909 12
+1 19 107 1 21 500 234.6000 1 19 203 107
+explain 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));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 40 Using where; Using join buffer (incremental, BNL join)
+4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+explain format=json 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));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 1"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a = 1"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1"
+ }
+ }
+ }
+ }
+ }
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 40,
+ "filtered": 100,
+ "attached_condition": "v_union.a = 1"
+ },
+ "buffer_type": "incremental",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "v_union.c > 800 or v1.max_c > 200",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 109",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1"
+ }
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "c < 300",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.b > 10"
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+# using derived table with union
+# extracted or formula : pushing into WHERE
+# conjunctive subformula : pushing into HAVING
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v2_union as v,t2 where
+((v.a=6) or (v.a=8)) and (v.c>200) and (v.a=t2.a);
+a b c a b c d
+8 33 404.0000 8 64 248 107
+6 20 312.0000 6 20 315 279
+6 20 214.0000 6 20 315 279
+8 33 404.0000 8 80 800 314
+6 20 312.0000 6 23 303 909
+6 20 214.0000 6 23 303 909
+select * from v2_union as v,t2 where
+((v.a=6) or (v.a=8)) and (v.c>200) and (v.a=t2.a);
+a b c a b c d
+8 33 404.0000 8 64 248 107
+6 20 312.0000 6 20 315 279
+6 20 214.0000 6 20 315 279
+8 33 404.0000 8 80 800 314
+6 20 312.0000 6 23 303 909
+6 20 214.0000 6 23 303 909
+explain select * from v2_union as v,t2 where
+((v.a=6) or (v.a=8)) and (v.c>200) and (v.a=t2.a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 6 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+4 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+NULL UNION RESULT <union2,3,4> ALL NULL NULL NULL NULL NULL
+explain format=json select * from v2_union as v,t2 where
+((v.a=6) or (v.a=8)) and (v.c>200) and (v.a=t2.a);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "(t2.a = 6 or t2.a = 8) and t2.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 6,
+ "filtered": 100,
+ "attached_condition": "v.c > 200",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3,4>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 109 and c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and (t1.a = 6 or t1.a = 8)"
+ }
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "c < 300 and c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and (t1.a = 6 or t1.a = 8)"
+ }
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "c < 707 and c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.c > 300 and (t1.a = 6 or t1.a = 8)"
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+# using derived table with union of selects without aggregation
+# extracted conjunctive predicate: pushing in WHERE of both selects
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v3_union as v,t2 where (v.a=t2.a) and (v.c>6);
+a b c a b c d
+1 21 123 1 21 909 12
+1 21 101 1 21 909 12
+1 21 104 1 21 909 12
+1 33 988 1 21 909 12
+1 19 107 1 21 909 12
+1 21 500 1 21 909 12
+1 21 345 1 21 909 12
+7 11 708 7 13 312 406
+7 11 8 7 13 312 406
+8 33 404 8 64 248 107
+8 33 123 8 64 248 107
+8 33 114 8 64 248 107
+8 33 9 8 64 248 107
+6 20 214 6 20 315 279
+6 20 315 6 20 315 279
+6 20 309 6 20 315 279
+6 20 7 6 20 315 279
+1 21 123 1 19 203 107
+1 21 101 1 19 203 107
+1 21 104 1 19 203 107
+1 33 988 1 19 203 107
+1 19 107 1 19 203 107
+1 21 500 1 19 203 107
+1 21 345 1 19 203 107
+8 33 404 8 80 800 314
+8 33 123 8 80 800 314
+8 33 114 8 80 800 314
+8 33 9 8 80 800 314
+6 20 214 6 23 303 909
+6 20 315 6 23 303 909
+6 20 309 6 23 303 909
+6 20 7 6 23 303 909
+select * from v3_union as v,t2 where (v.a=t2.a) and (v.c>6);
+a b c a b c d
+1 21 123 1 21 909 12
+1 21 101 1 21 909 12
+1 21 104 1 21 909 12
+1 33 988 1 21 909 12
+1 19 107 1 21 909 12
+1 21 500 1 21 909 12
+1 21 345 1 21 909 12
+7 11 708 7 13 312 406
+7 11 8 7 13 312 406
+8 33 404 8 64 248 107
+8 33 123 8 64 248 107
+8 33 114 8 64 248 107
+8 33 9 8 64 248 107
+6 20 214 6 20 315 279
+6 20 315 6 20 315 279
+6 20 309 6 20 315 279
+6 20 7 6 20 315 279
+1 21 123 1 19 203 107
+1 21 101 1 19 203 107
+1 21 104 1 19 203 107
+1 33 988 1 19 203 107
+1 19 107 1 19 203 107
+1 21 500 1 19 203 107
+1 21 345 1 19 203 107
+8 33 404 8 80 800 314
+8 33 123 8 80 800 314
+8 33 114 8 80 800 314
+8 33 9 8 80 800 314
+6 20 214 6 23 303 909
+6 20 315 6 23 303 909
+6 20 309 6 23 303 909
+6 20 7 6 23 303 909
+explain select * from v3_union as v,t2 where (v.a=t2.a) and (v.c>6);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 4 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where
+3 UNION t1 ALL NULL NULL NULL NULL 20 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+explain format=json select * from v3_union as v,t2 where (v.a=t2.a) and (v.c>6);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "v.c > 6",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and t1.a + 1 > 6"
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.c > 100 and t1.c > 6"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+# using derived table with union of selects without aggregation
+# extracted conjunctive OR subformula: pushing in WHERE using equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v3_union as v,t2 where (v.a=t2.a) and ((t2.a>1) or (v.b<20));
+a b c a b c d
+1 19 107 1 21 909 12
+1 19 2 1 21 909 12
+7 11 708 7 13 312 406
+7 11 8 7 13 312 406
+8 33 404 8 64 248 107
+8 33 123 8 64 248 107
+8 33 114 8 64 248 107
+8 33 9 8 64 248 107
+6 20 214 6 20 315 279
+6 20 315 6 20 315 279
+6 20 309 6 20 315 279
+6 20 7 6 20 315 279
+1 19 107 1 19 203 107
+1 19 2 1 19 203 107
+8 33 404 8 80 800 314
+8 33 123 8 80 800 314
+8 33 114 8 80 800 314
+8 33 9 8 80 800 314
+6 20 214 6 23 303 909
+6 20 315 6 23 303 909
+6 20 309 6 23 303 909
+6 20 7 6 23 303 909
+select * from v3_union as v,t2 where (v.a=t2.a) and ((t2.a>1) or (v.b<20));
+a b c a b c d
+1 19 107 1 21 909 12
+1 19 2 1 21 909 12
+7 11 708 7 13 312 406
+7 11 8 7 13 312 406
+8 33 404 8 64 248 107
+8 33 123 8 64 248 107
+8 33 114 8 64 248 107
+8 33 9 8 64 248 107
+6 20 214 6 20 315 279
+6 20 315 6 20 315 279
+6 20 309 6 20 315 279
+6 20 7 6 20 315 279
+1 19 107 1 19 203 107
+1 19 2 1 19 203 107
+8 33 404 8 80 800 314
+8 33 123 8 80 800 314
+8 33 114 8 80 800 314
+8 33 9 8 80 800 314
+6 20 214 6 23 303 909
+6 20 315 6 23 303 909
+6 20 309 6 23 303 909
+6 20 7 6 23 303 909
+explain select * from v3_union as v,t2 where (v.a=t2.a) and ((t2.a>1) or (v.b<20));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 4 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where
+3 UNION t1 ALL NULL NULL NULL NULL 20 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+explain format=json select * from v3_union as v,t2 where (v.a=t2.a) and ((t2.a>1) or (v.b<20));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "t2.a > 1 or v.b < 20",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and (t1.a > 1 or t1.b < 20)"
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.c > 100 and (t1.a > 1 or t1.b < 20)"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+# using derived table with union of selects without aggregation
+# extracted the whole condition: in WHERE of both selects
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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));
+a b c a b c d
+1 19 2 1 21 909 12
+1 21 2 1 21 909 12
+1 19 2 1 19 203 107
+1 21 2 1 19 203 107
+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));
+a b c a b c d
+1 19 2 1 21 909 12
+1 21 2 1 21 909 12
+1 19 2 1 19 203 107
+1 21 2 1 19 203 107
+explain 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));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 4 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where
+3 UNION t1 ALL NULL NULL NULL NULL 20 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+explain format=json 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));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "(v.b = 19 or v.b = 21) and (v.c < 3 or v.c > 600)",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and (t1.b = 19 or t1.b = 21) and (t1.a + 1 < 3 or t1.a + 1 > 600)"
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.c > 100 and (t1.b = 19 or t1.b = 21) and (t1.c < 3 or t1.c > 600)"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+# using derived table with union of
+# a select without aggregation and a select with aggregation
+# extracted conjunctive predicate: pushing in WHERE of both selects
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4_union as v,t2 where (v.a=t2.a) and (v.b<20);
+a b c a b c d
+1 19 207 1 21 909 12
+7 11 808 7 13 312 406
+7 11 608 7 13 312 406
+1 19 207 1 19 203 107
+select * from v4_union as v,t2 where (v.a=t2.a) and (v.b<20);
+a b c a b c d
+1 19 207 1 21 909 12
+7 11 808 7 13 312 406
+7 11 608 7 13 312 406
+1 19 207 1 19 203 107
+explain select * from v4_union as v,t2 where (v.a=t2.a) and (v.b<20);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 4 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 UNION t1 ALL NULL NULL NULL NULL 20 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+explain format=json select * from v4_union as v,t2 where (v.a=t2.a) and (v.b<20);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "v.b < 20",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 109",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and t1.b < 20"
+ }
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.b < 20"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+# using derived table with union of
+# a select without aggregation and a select with aggregation
+# extracted subformula: pushing in WHERE of one select
+# extracted subformula: pushing in HAVING of the other select
+# extracted sub-subformula: pushing in WHERE of the other select
+# using an equality in all pushdowns
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4_union as v,t2 where
+(v.a=t2.a) and ((t2.a<3) or (v.b<40)) and (v.c>500);
+a b c a b c d
+1 33 1088 1 21 909 12
+1 21 600 1 21 909 12
+1 33 888 1 21 909 12
+7 11 808 7 13 312 406
+7 11 608 7 13 312 406
+8 33 504 8 64 248 107
+1 33 1088 1 19 203 107
+1 21 600 1 19 203 107
+1 33 888 1 19 203 107
+8 33 504 8 80 800 314
+select * from v4_union as v,t2 where
+(v.a=t2.a) and ((t2.a<3) or (v.b<40)) and (v.c>500);
+a b c a b c d
+1 33 1088 1 21 909 12
+1 21 600 1 21 909 12
+1 33 888 1 21 909 12
+7 11 808 7 13 312 406
+7 11 608 7 13 312 406
+8 33 504 8 64 248 107
+1 33 1088 1 19 203 107
+1 21 600 1 19 203 107
+1 33 888 1 19 203 107
+8 33 504 8 80 800 314
+explain select * from v4_union as v,t2 where
+(v.a=t2.a) and ((t2.a<3) or (v.b<40)) and (v.c>500);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 4 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 UNION t1 ALL NULL NULL NULL NULL 20 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+explain format=json select * from v4_union as v,t2 where
+(v.a=t2.a) and ((t2.a<3) or (v.b<40)) and (v.c>500);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "(t2.a < 3 or v.b < 40) and v.c > 500",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 109 and c > 500",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and (t1.a < 3 or t1.b < 40)"
+ }
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and (t1.a < 3 or t1.b < 40) and t1.c + 100 > 500"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+}
+# using embedded derived table : pushing the same conditions
+# using several derived tables : pushing in all tables
+# conjunctive subformula : pushing into WHERE
+# extracted and formula : pushing into WHERE
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4,v1 where
+(v4.a<13) and (v1.a>5) and (v1.b>12);
+a b min_c a b max_c avg_c
+1 19 107 6 20 315 279.3333
+1 21 500 6 20 315 279.3333
+5 16 207 6 20 315 279.3333
+5 27 132 6 20 315 279.3333
+6 20 315 6 20 315 279.3333
+8 33 404 6 20 315 279.3333
+1 19 107 8 33 404 213.6667
+1 21 500 8 33 404 213.6667
+5 16 207 8 33 404 213.6667
+5 27 132 8 33 404 213.6667
+6 20 315 8 33 404 213.6667
+8 33 404 8 33 404 213.6667
+select * from v4,v1 where
+(v4.a<13) and (v1.a>5) and (v1.b>12);
+a b min_c a b max_c avg_c
+1 19 107 6 20 315 279.3333
+1 21 500 6 20 315 279.3333
+5 16 207 6 20 315 279.3333
+5 27 132 6 20 315 279.3333
+6 20 315 6 20 315 279.3333
+8 33 404 6 20 315 279.3333
+1 19 107 8 33 404 213.6667
+1 21 500 8 33 404 213.6667
+5 16 207 8 33 404 213.6667
+5 27 132 8 33 404 213.6667
+6 20 315 8 33 404 213.6667
+8 33 404 8 33 404 213.6667
+explain select * from v4,v1 where
+(v4.a<13) and (v1.a>5) and (v1.b>12);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where
+1 PRIMARY <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v4,v1 where
+(v4.a<13) and (v1.a>5) and (v1.b>12);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v4.a < 13",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 15 and v1.a < 13",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 15 and t1.a < 13"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a > 5 and v1.b > 12"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and t1.b > 12"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# using embedded view : nothing to push
+# using several derived tables : pushing only in one table
+# conjunctive subformula : pushing into WHERE
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4,v1,t2 where
+(v4.a=t2.a) and (v4.a=v1.a) and (v1.b>30);
+a b min_c a b max_c avg_c a b c d
+8 33 404 8 33 404 213.6667 8 64 248 107
+8 33 404 8 33 404 213.6667 8 80 800 314
+select * from v4,v1,t2 where
+(v4.a=t2.a) and (v4.a=v1.a) and (v1.b>30);
+a b min_c a b max_c avg_c a b c d
+8 33 404 8 33 404 213.6667 8 64 248 107
+8 33 404 8 33 404 213.6667 8 80 800 314
+explain select * from v4,v1,t2 where
+(v4.a=t2.a) and (v4.a=v1.a) and (v1.b>30);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key1 key1 5 test.t2.a 2
+1 PRIMARY <derived4> ref key0 key0 5 test.t2.a 2 Using where
+4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v4,v1,t2 where
+(v4.a=t2.a) and (v4.a=v1.a) and (v1.b>30);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null and t2.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key1"],
+ "key": "key1",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 15",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 15"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.b > 30",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 30"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# using embedded view : pushing different conditions
+# using several derived tables : pushing in all tables
+# conjunctive subformula : pushing into WHERE using equalities
+# extracted and formula : pushing into WHERE using equalities
+# conjunctive subformula : pushing into HAVING
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b min_c a b max_c avg_c a b c d
+6 20 315 6 20 315 279.3333 6 20 315 279
+6 20 315 6 20 315 279.3333 6 23 303 909
+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);
+a b min_c a b max_c avg_c a b c d
+6 20 315 6 20 315 279.3333 6 20 315 279
+6 20 315 6 20 315 279.3333 6 23 303 909
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key1 key1 5 test.t2.a 2 Using where
+1 PRIMARY <derived4> ref key0 key0 5 test.t2.a 2 Using where
+4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a > 1 and t2.a is not null and t2.a is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key1"],
+ "key": "key1",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v4.min_c > 100",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "min_c > 100",
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 15 and v1.a > 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 15 and t1.a > 1"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.b < 30",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.b < 30"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# using embedded view : pushing different conditions
+# using several derived tables : pushing in all tables
+# extracted or formula : pushing into WHERE
+# conjunctive subformula : pushing into HAVING
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b min_c a b max_c avg_c a b c d
+1 19 107 1 21 500 234.6000 2 3 207 207
+1 19 107 1 21 500 234.6000 1 21 909 12
+1 19 107 1 21 500 234.6000 7 13 312 406
+1 19 107 1 21 500 234.6000 8 64 248 107
+1 19 107 1 21 500 234.6000 6 20 315 279
+1 19 107 1 21 500 234.6000 1 19 203 107
+1 19 107 1 21 500 234.6000 8 80 800 314
+1 19 107 1 21 500 234.6000 3 12 231 190
+1 19 107 1 21 500 234.6000 6 23 303 909
+5 16 207 5 16 207 207.0000 2 3 207 207
+5 16 207 5 16 207 207.0000 1 21 909 12
+5 16 207 5 16 207 207.0000 7 13 312 406
+5 16 207 5 16 207 207.0000 8 64 248 107
+5 16 207 5 16 207 207.0000 6 20 315 279
+5 16 207 5 16 207 207.0000 1 19 203 107
+5 16 207 5 16 207 207.0000 8 80 800 314
+5 16 207 5 16 207 207.0000 3 12 231 190
+5 16 207 5 16 207 207.0000 6 23 303 909
+5 27 132 5 16 207 207.0000 2 3 207 207
+5 27 132 5 16 207 207.0000 1 21 909 12
+5 27 132 5 16 207 207.0000 7 13 312 406
+5 27 132 5 16 207 207.0000 8 64 248 107
+5 27 132 5 16 207 207.0000 6 20 315 279
+5 27 132 5 16 207 207.0000 1 19 203 107
+5 27 132 5 16 207 207.0000 8 80 800 314
+5 27 132 5 16 207 207.0000 3 12 231 190
+5 27 132 5 16 207 207.0000 6 23 303 909
+6 20 315 6 20 315 279.3333 2 3 207 207
+6 20 315 6 20 315 279.3333 1 21 909 12
+6 20 315 6 20 315 279.3333 7 13 312 406
+6 20 315 6 20 315 279.3333 8 64 248 107
+6 20 315 6 20 315 279.3333 6 20 315 279
+6 20 315 6 20 315 279.3333 1 19 203 107
+6 20 315 6 20 315 279.3333 8 80 800 314
+6 20 315 6 20 315 279.3333 3 12 231 190
+6 20 315 6 20 315 279.3333 6 23 303 909
+8 33 404 8 33 404 213.6667 2 3 207 207
+8 33 404 8 33 404 213.6667 1 21 909 12
+8 33 404 8 33 404 213.6667 7 13 312 406
+8 33 404 8 33 404 213.6667 8 64 248 107
+8 33 404 8 33 404 213.6667 6 20 315 279
+8 33 404 8 33 404 213.6667 1 19 203 107
+8 33 404 8 33 404 213.6667 8 80 800 314
+8 33 404 8 33 404 213.6667 3 12 231 190
+8 33 404 8 33 404 213.6667 6 23 303 909
+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);
+a b min_c a b max_c avg_c a b c d
+1 19 107 1 21 500 234.6000 2 3 207 207
+1 19 107 1 21 500 234.6000 1 21 909 12
+1 19 107 1 21 500 234.6000 7 13 312 406
+1 19 107 1 21 500 234.6000 8 64 248 107
+1 19 107 1 21 500 234.6000 6 20 315 279
+1 19 107 1 21 500 234.6000 1 19 203 107
+1 19 107 1 21 500 234.6000 8 80 800 314
+1 19 107 1 21 500 234.6000 3 12 231 190
+1 19 107 1 21 500 234.6000 6 23 303 909
+5 16 207 5 16 207 207.0000 2 3 207 207
+5 16 207 5 16 207 207.0000 1 21 909 12
+5 16 207 5 16 207 207.0000 7 13 312 406
+5 16 207 5 16 207 207.0000 8 64 248 107
+5 16 207 5 16 207 207.0000 6 20 315 279
+5 16 207 5 16 207 207.0000 1 19 203 107
+5 16 207 5 16 207 207.0000 8 80 800 314
+5 16 207 5 16 207 207.0000 3 12 231 190
+5 16 207 5 16 207 207.0000 6 23 303 909
+5 27 132 5 16 207 207.0000 2 3 207 207
+5 27 132 5 16 207 207.0000 1 21 909 12
+5 27 132 5 16 207 207.0000 7 13 312 406
+5 27 132 5 16 207 207.0000 8 64 248 107
+5 27 132 5 16 207 207.0000 6 20 315 279
+5 27 132 5 16 207 207.0000 1 19 203 107
+5 27 132 5 16 207 207.0000 8 80 800 314
+5 27 132 5 16 207 207.0000 3 12 231 190
+5 27 132 5 16 207 207.0000 6 23 303 909
+6 20 315 6 20 315 279.3333 2 3 207 207
+6 20 315 6 20 315 279.3333 1 21 909 12
+6 20 315 6 20 315 279.3333 7 13 312 406
+6 20 315 6 20 315 279.3333 8 64 248 107
+6 20 315 6 20 315 279.3333 6 20 315 279
+6 20 315 6 20 315 279.3333 1 19 203 107
+6 20 315 6 20 315 279.3333 8 80 800 314
+6 20 315 6 20 315 279.3333 3 12 231 190
+6 20 315 6 20 315 279.3333 6 23 303 909
+8 33 404 8 33 404 213.6667 2 3 207 207
+8 33 404 8 33 404 213.6667 1 21 909 12
+8 33 404 8 33 404 213.6667 7 13 312 406
+8 33 404 8 33 404 213.6667 8 64 248 107
+8 33 404 8 33 404 213.6667 6 20 315 279
+8 33 404 8 33 404 213.6667 1 19 203 107
+8 33 404 8 33 404 213.6667 8 80 800 314
+8 33 404 8 33 404 213.6667 3 12 231 190
+8 33 404 8 33 404 213.6667 6 23 303 909
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY <derived4> ref key0 key0 5 v4.a 2 Using where
+4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort
+2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v4.b > 10 and v4.a > 1 or v4.b < 20"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "(v4.b > 10 and v4.a > 1 or v4.b < 20) and v4.a is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 15 and (v1.b > 10 and v1.a > 1 or v1.b < 20)",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 15 and (t1.b > 10 and t1.a > 1 or t1.b < 20)"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["v4.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 200",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707 and max_c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# using embedded view : pushing different conditions
+# using several derived tables : pushing only in one table
+# extracted or formula : pushing into WHERE
+# extracted or formula : pushing into HAVING
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4,v2 where
+((v4.a>12) and (v4.min_c<300) and (v4.b>13)) or (v4.a<1);
+a b min_c a b max_c avg_c
+select * from v4,v2 where
+((v4.a>12) and (v4.min_c<300) and (v4.b>13)) or (v4.a<1);
+a b min_c a b max_c avg_c
+explain select * from v4,v2 where
+((v4.a>12) and (v4.min_c<300) and (v4.b>13)) or (v4.a<1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where
+1 PRIMARY <derived4> ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join)
+4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v4,v2 where
+((v4.a>12) and (v4.min_c<300) and (v4.b>13)) or (v4.a<1);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v4.a > 12 and v4.min_c < 300 and v4.b > 13 or v4.a < 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "v1.a > 12 and min_c < 300 and v1.b > 13 or v1.a < 1",
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 15 and (v1.a > 12 and v1.b > 13 or v1.a < 1)",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 15 and (t1.a > 12 and t1.b > 13 or t1.a < 1)"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# using embedded view : pushing different conditions
+# using several derived tables : pushing only in one table
+# conjunctive subformula : pushing into WHERE
+# conjunctive subformula : pushing into HAVING
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4,v2 where
+(v4.a=v2.b) and (v4.a=v4.b) and (v4.min_c<100);
+a b min_c a b max_c avg_c
+select * from v4,v2 where
+(v4.a=v2.b) and (v4.a=v4.b) and (v4.min_c<100);
+a b min_c a b max_c avg_c
+explain select * from v4,v2 where
+(v4.a=v2.b) and (v4.a=v4.b) and (v4.min_c<100);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where
+1 PRIMARY <derived4> ref key0 key0 5 v4.a 2
+4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v4,v2 where
+(v4.a=v2.b) and (v4.a=v4.b) and (v4.min_c<100);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v4.b = v4.a and v4.min_c < 100 and v4.a is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "min_c < 100",
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.b = v1.a and v1.a < 15",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b = t1.a and t1.a < 15"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["v4.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# using embedded view : pushing the same conditions
+# using several derived tables : pushing in all tables
+# extracted and formula : pushing into WHERE using equalities
+# conjunctive subformula : pushing into WHERE
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4,v2 where
+(v4.a=v2.b) and (v4.a=v4.b) and (v2.b<30);
+a b min_c a b max_c avg_c
+select * from v4,v2 where
+(v4.a=v2.b) and (v4.a=v4.b) and (v2.b<30);
+a b min_c a b max_c avg_c
+explain select * from v4,v2 where
+(v4.a=v2.b) and (v4.a=v4.b) and (v2.b<30);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where
+1 PRIMARY <derived4> ref key0 key0 5 v4.a 2
+4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v4,v2 where
+(v4.a=v2.b) and (v4.a=v4.b) and (v2.b<30);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v4.b = v4.a and v4.a < 30 and v4.a is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.b = v1.a and v1.a < 15 and v1.a < 30",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b = t1.a and t1.a < 15 and t1.a < 30"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["v4.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and t1.b < 30"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# using embedded view : pushing the same conditions
+# using several derived tables : pushing in all tables
+# extracted or formula : pushing into WHERE using equalities
+# extracted and formula : pushing into WHERE using equalities
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4,v2 where
+(v4.a=v2.b) and (v4.a=v4.b) and ((v2.b<30) or (v4.a>2));
+a b min_c a b max_c avg_c
+select * from v4,v2 where
+(v4.a=v2.b) and (v4.a=v4.b) and ((v2.b<30) or (v4.a>2));
+a b min_c a b max_c avg_c
+explain select * from v4,v2 where
+(v4.a=v2.b) and (v4.a=v4.b) and ((v2.b<30) or (v4.a>2));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where
+1 PRIMARY <derived4> ref key0 key0 5 v4.a 2
+4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json select * from v4,v2 where
+(v4.a=v2.b) and (v4.a=v4.b) and ((v2.b<30) or (v4.a>2));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v4.b = v4.a and (v4.a < 30 or v4.a > 2) and v4.a is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.b = v1.a and v1.a < 15 and (v1.a < 30 or v1.a > 2)",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b = t1.a and t1.a < 15 and (t1.a < 30 or t1.a > 2)"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["v4.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and (t1.b < 30 or t1.b > 2)"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# using embedded view : pushing the same conditions
+# using several derived tables : pushing in all tables
+# extracted or formula : pushing into WHERE
+# conjunctive subformula : pushing into WHERE
+# pushing equalities
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b min_c a b max_c avg_c
+6 20 315 6 20 315 279.3333
+8 33 404 8 33 404 213.6667
+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);
+a b min_c a b max_c avg_c
+6 20 315 6 20 315 279.3333
+8 33 404 8 33 404 213.6667
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where
+1 PRIMARY <derived4> ref key0 key0 5 v4.min_c 2
+4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "(v4.a < 12 and v4.b > 13 or v4.a > 10) and v4.min_c > 100 and v4.min_c is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "min_c > 100",
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 15 and (v1.a < 12 and v1.b > 13 or v1.a > 10)",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 15 and (t1.a < 12 and t1.b > 13 or t1.a > 10)"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["max_c"],
+ "ref": ["v4.min_c"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707 and max_c > 100",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+# using embedded view : pushing the same conditions
+# using several derived tables : pushing only in one table
+# extracted or formula : pushing into WHERE
+set statement optimizer_switch='condition_pushdown_for_derived=off' for 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);
+a b min_c a b max_c avg_c a b c d
+6 20 315 6 20 315 279.3333 6 20 315 279
+6 20 315 8 33 404 213.6667 6 20 315 279
+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);
+a b min_c a b max_c avg_c a b c d
+6 20 315 6 20 315 279.3333 6 20 315 279
+6 20 315 8 33 404 213.6667 6 20 315 279
+explain 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);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2 Using where
+1 PRIMARY <derived4> ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join)
+4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort
+explain format=json 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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.c > 100 and t2.c is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["min_c"],
+ "ref": ["test.t2.c"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v4.a < 12 and t2.b > 13 or v4.a > 10",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "min_c > 100",
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 15 and (v1.a < 12 or v1.a > 10)",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 15 and (t1.a < 12 or t1.a > 10)"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+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;
+#
+# MDEV-10782: condition extracted from a multiple equality
+# pushed into HAVING
+#
+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;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 100.00 Using where
+3 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00
+Warnings:
+Note 1003 select `sq1`.`f` AS `f` from (select min(`test`.`t1`.`i`) AS `f` from `test`.`t1` having `f` = 8) `sq1` where `sq1`.`f` = 8
+SELECT *
+FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2
+WHERE f = 8;
+f
+SELECT *
+FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2
+WHERE f = 1;
+f
+1
+DROP TABLE t1;
+#
+# MDEV-10783: pushdown into constant view
+#
+CREATE TABLE t1 (i int) ENGINE=MyISAM;
+CREATE VIEW v AS SELECT 5;
+SELECT * FROM t1 WHERE 1 IN ( SELECT * FROM v );
+i
+DROP VIEW v;
+DROP TABLE t1;
+#
+# MDEV-10785: second execution of a query with condition
+# pushed into view
+#
+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;
+i
+EXECUTE stmt;
+i
+DROP FUNCTION f;
+DROP VIEW v2,v1;
+DROP TABLE t1;
+#
+# MDEV-10884: condition pushdown into derived specified by
+# 1. unit with SELECT containing ORDER BY ... LIMIT
+# 2. unit containing global ORDER BY ... LIMIT
+#
+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;
+a
+0
+1
+2
+3
+4
+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);
+a
+0
+4
+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);
+a
+0
+4
+select a from t1 where a < 4 union select a from t1 where a > 5
+order by a limit 5;
+a
+0
+1
+2
+3
+6
+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);
+a
+0
+1
+3
+6
+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);
+a
+0
+1
+3
+6
+drop table t1;
+#
+# MDEV-11072: pushdown of the condition obtained
+# after constant row substitution
+#
+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
+)
+);
+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
+)
+);
+a
+2
+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
+)
+);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "const_condition": "0 or <in_optimizer>(2,<exists>(subquery#3))",
+ "table": {
+ "table_name": "t1",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100
+ },
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.b = 2",
+ "first_match": "t1"
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "<derived5>",
+ "access_type": "index_subquery",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["c"],
+ "ref": ["func"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 5,
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "t3.c = 2"
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+}
+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;
+set statement optimizer_switch='condition_pushdown_for_derived=off' for SELECT * FROM t1 WHERE a IN (
+SELECT b FROM v2 WHERE b < a OR b IN (
+SELECT d FROM v4 WHERE s > a
+)
+);
+a
+2
+SELECT * FROM t1 WHERE a IN (
+SELECT b FROM v2 WHERE b < a OR b IN (
+SELECT d FROM v4 WHERE s > a
+)
+);
+a
+2
+explain SELECT * FROM t1 WHERE a IN (
+SELECT b FROM v2 WHERE b < a OR b IN (
+SELECT d FROM v4 WHERE s > a
+)
+);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1)
+3 DEPENDENT SUBQUERY <derived5> index_subquery key0 key0 5 func 2 Using where
+5 DERIVED t4 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort
+explain format=json SELECT * FROM t1 WHERE a IN (
+SELECT b FROM v2 WHERE b < a OR b IN (
+SELECT d FROM v4 WHERE s > a
+)
+);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "const_condition": "0 or <in_optimizer>(2,<exists>(subquery#3))",
+ "table": {
+ "table_name": "t1",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100
+ },
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.b = 2",
+ "first_match": "t1"
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "<derived5>",
+ "access_type": "index_subquery",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["func"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 5,
+ "having_condition": "s > 2",
+ "filesort": {
+ "sort_key": "t4.d",
+ "temporary_table": {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+}
+DROP VIEW v2,v3,v4;
+DROP TABLE t1,t2,t3,t4;
+#
+# MDEV-10800: pushdown of the condition obtained
+# after constant row substitution
+#
+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;
+a
+EXPLAIN FORMAT=JSON
+SELECT * FROM
+( SELECT * FROM t1
+WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "const_condition": "<in_optimizer>(1,exists(subquery#3))",
+ "table": {
+ "table_name": "t1",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.b = 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.b = 1"
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+}
+DROP VIEW v2;
+DROP TABLE t1,t2;
+#
+# MDEV-11102: condition pushdown into materialized inner table
+# of outer join is not applied as not being valid
+#
+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;
+a b
+0 NULL
+SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL;
+a b
+0 NULL
+EXPLAIN FORMAT=JSON
+SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t1.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "trigcond(v2.b is null) and trigcond(trigcond(t1.a is not null))",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+}
+DROP VIEW v2;
+DROP TABLE t1,t2;
+#
+# MDEV-11103: pushdown condition with ANY subquery
+#
+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 );
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "<nop>(v1.i <= 3)",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "<nop>(t1.i <= 3)"
+ }
+ }
+ }
+ }
+ }
+}
+Warnings:
+Note 1249 Select 2 was reduced during optimization
+SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 );
+i
+1
+2
+DROP VIEW v1;
+DROP TABLE t1;
+#
+# MDEV-11315: condition with outer reference to mergeable derived
+#
+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;
+pk1 a b
+10 7 1
+11 0 2
+EXPLAIN FORMAT=JSON
+SELECT * FROM v1 AS sq
+WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "<in_optimizer>(t1.b,<exists>(subquery#2)) or t1.b = 100"
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "index_subquery",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "4",
+ "used_key_parts": ["pk2"],
+ "ref": ["func"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+}
+SELECT * FROM ( SELECT * FROM t1 ) AS sq
+WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100;
+pk1 a b
+10 7 1
+11 0 2
+EXPLAIN FORMAT=JSON
+SELECT * FROM ( SELECT * FROM t1 ) AS sq
+WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "<in_optimizer>(t1.b,<exists>(subquery#3)) or t1.b = 100"
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "index_subquery",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "4",
+ "used_key_parts": ["pk2"],
+ "ref": ["func"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+}
+DROP VIEW v1,v2;
+DROP TABLE t1,t2;
+#
+# MDEV-11313: pushdown of the condition obtained
+# after constant row substitution
+#
+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;
+f
+0
+EXPLAIN FORMAT=JSON
+SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.a = 50",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.a = 50"
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+}
+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;
+f
+3
+EXPLAIN FORMAT=JSON
+SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "v2.s < 50",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "s < 50",
+ "filesort": {
+ "sort_key": "t3.a",
+ "temporary_table": {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+}
+DROP VIEW v1,v2;
+DROP TABLE t1,t2,t3;
+#
+# MDEV-10882: pushdown of the predicate with cached value
+#
+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;
+a GROUP_CONCAT(b)
+1 2
+EXPLAIN FORMAT=JSON
+SELECT a, GROUP_CONCAT(b) FROM v1
+WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "message": "Select tables optimized away"
+ }
+ }
+ }
+ },
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "v1.a",
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.b = 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.b = 2"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+DROP VIEW v1;
+DROP TABLE t1,t2;
+#
+# MDEV-10836: pushdown of the predicate with cached value
+#
+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 );
+pk f pk f
+3 2 3 2
+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 );
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "message": "Select tables optimized away"
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.f = 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t.f = 2"
+ }
+ }
+ }
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.pk > 2"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "table": {
+ "table_name": "t",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["pk"],
+ "rows": 2,
+ "filtered": 100,
+ "index_condition": "t.pk > 2"
+ }
+ }
+ }
+ }
+ }
+}
+DROP VIEW v;
+DROP TABLE t;
+#
+# MDEV-11488: pushdown of the predicate with cached value
+#
+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 );
+i
+3
+EXPLAIN FORMAT=JSON
+SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
+WHERE i IN ( SELECT MIN(j) FROM t2 );
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "message": "Select tables optimized away"
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "sq.i = 3",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.i = 3"
+ }
+ }
+ }
+ }
+ }
+}
+UPDATE t2 SET j = 2 WHERE j = 3;
+SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
+WHERE i IN ( SELECT MIN(j) FROM t2 );
+i
+2
+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 );
+i
+2.71
+EXPLAIN FORMAT=JSON
+SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
+WHERE i IN ( SELECT MIN(j) FROM t2 );
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "message": "Select tables optimized away"
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "sq.i = 2.7100000381469727",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.i = 2.7100000381469727"
+ }
+ }
+ }
+ }
+ }
+}
+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 );
+i
+3.21
+EXPLAIN FORMAT=JSON
+SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
+WHERE i IN ( SELECT MIN(j) FROM t2 );
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "message": "Select tables optimized away"
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "sq.i = 3.21",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.i = 3.21"
+ }
+ }
+ }
+ }
+ }
+}
+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 );
+i
+aa
+EXPLAIN FORMAT=JSON
+SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
+WHERE i IN ( SELECT MIN(j) FROM t2 );
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "message": "Select tables optimized away"
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "sq.i = 'aa'",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.i = 'aa'"
+ }
+ }
+ }
+ }
+ }
+}
+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 );
+i
+2007-05-28 00:00:00
+EXPLAIN FORMAT=JSON
+SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
+WHERE i IN ( SELECT MIN(j) FROM t2 );
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "message": "Select tables optimized away"
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "sq.i = '2007-05-28 00:00:00'",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.i = TIMESTAMP'2007-05-28 00:00:00'"
+ }
+ }
+ }
+ }
+ }
+}
+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 );
+i
+2007-05-28
+EXPLAIN FORMAT=JSON
+SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
+WHERE i IN ( SELECT MIN(j) FROM t2 );
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "message": "Select tables optimized away"
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "sq.i = '2007-05-28'",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.i = TIMESTAMP'2007-05-28 00:00:00'"
+ }
+ }
+ }
+ }
+ }
+}
+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 );
+i
+10:00:02
+EXPLAIN FORMAT=JSON
+SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
+WHERE i IN ( SELECT MIN(j) FROM t2 );
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "message": "Select tables optimized away"
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "sq.i = '10:00:02'",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.i = TIME'10:00:02'"
+ }
+ }
+ }
+ }
+ }
+}
+DROP TABLE t1,t2;
+#
+# MDEV-11593: pushdown of condition with NULLIF
+#
+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);
+i
+2
+EXPLAIN FORMAT=JSON
+SELECT * FROM v1 WHERE NULLIF(1, i);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "nullif(1,v1.i)",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "nullif(1,t1.i)"
+ }
+ }
+ }
+ }
+ }
+}
+DROP VIEW v1;
+DROP TABLE t1;
+#
+# MDEV-11608: pushdown of the predicate with cached null value
+#
+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 );
+c
+EXPLAIN FORMAT=JSON
+SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 );
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "message": "Impossible WHERE"
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.c = NULL",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.c = NULL"
+ }
+ }
+ }
+ }
+ }
+}
+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 );
+d
+DROP VIEW v1;
+DROP TABLE t1,t2;
+#
+# MDEV-11820: second execution of PS for query
+# with false subquery predicate in WHERE
+#
+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;
+c
+foo
+EXECUTE stmt2;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.c = 'foo'",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.c = 'foo'"
+ }
+ }
+ }
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "1 = t2.a"
+ }
+ }
+ }
+ ]
+ }
+}
+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;
+c
+foo
+EXECUTE stmt2;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "<cache>(<in_optimizer>(1,<exists>(subquery#2))) or v1.c = 'foo'",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ }
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 128,
+ "filtered": 100,
+ "attached_condition": "1 = t2.a"
+ }
+ }
+ }
+ ]
+ }
+}
+DEALLOCATE PREPARE stmt1;
+DEALLOCATE PREPARE stmt2;
+DROP VIEW v1;
+DROP TABLE t1,t2;
+#
+# MDEV-12373: pushdown into derived with side effects is prohibited
+#
+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;
+row order_number
+14 51
+DROP TABLE sales_documents;
+#
+# MDEV-12845: pushdown from merged derived using equalities
+#
+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;
+select b
+from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t
+where b > 2;
+b
+4
+5
+explain format=json select b
+from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t
+where b > 2;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "t1.a > 2 and t1.a is not null"
+ },
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t1.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "filesort": {
+ "sort_key": "t2.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.b > 2"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+select a
+from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t
+where a > 2;
+a
+4
+5
+explain format=json select a
+from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t
+where a > 2;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "t1.a > 2 and t1.a is not null"
+ },
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t1.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "filesort": {
+ "sort_key": "t2.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.b > 2"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+select a
+from ( select t1.a, v2.b, v2.c from t1, v2 where t1.a = v2.b ) as t
+where a > 2;
+a
+4
+4
+4
+5
+5
+explain format=json select a
+from ( select t1.a, v2.b, v2.c from t1, v2 where t1.a = v2.b ) as t
+where a > 2;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "t1.a > 2 and t1.a is not null"
+ },
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t1.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "temporary_table": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.b > 2"
+ }
+ }
+ }
+ }
+ }
+ }
+}
+select a
+from ( select t1.a, v3.b, v3.m from t1, v3 where t1.a = v3.m ) as t
+where a > 2;
+a
+4
+3
+explain format=json select a
+from ( select t1.a, v3.b, v3.m from t1, v3 where t1.a = v3.m ) as t
+where a > 2;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "t1.a > 2 and t1.a is not null"
+ },
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["m"],
+ "ref": ["test.t1.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "m > 2",
+ "filesort": {
+ "sort_key": "t2.b",
+ "temporary_table": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+drop view v1,v2,v3;
+drop table t1,t2;
+#
+# MDEV-13166: pushdown from merged derived
+#
+CREATE TABLE t1 (i int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE VIEW v1 AS SELECT MAX(i) AS f FROM t1;
+SELECT * FROM ( SELECT * FROM v1 ) AS sq WHERE f > 0;
+f
+2
+explain format=json SELECT * FROM ( SELECT * FROM v1 ) AS sq WHERE f > 0;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.f > 0",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "f > 0",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+}
+DROP VIEW v1;
+DROP TABLE t1;
+#
+# MDEV-13193: pushdown of equality extracted from multiple equality
+#
+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;
+SELECT * FROM t1, ( SELECT * FROM v2 ) AS sq
+WHERE i1 = 1 AND ( i1 = i2 OR i1 = 2 );
+i1 i2
+explain format=json SELECT * FROM t1, ( SELECT * FROM v2 ) AS sq
+WHERE i1 = 1 AND ( i1 = i2 OR i1 = 2 );
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["i1"],
+ "key": "i1",
+ "key_length": "5",
+ "used_key_parts": ["i1"],
+ "ref": ["const"],
+ "rows": 1,
+ "filtered": 100,
+ "using_index": true
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.i2 = 1"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.i2 = 1"
+ }
+ }
+ }
+ }
+ }
+}
+DROP VIEW v2;
+DROP TABLE t1,t2;
+#
+# MDEV-14237: derived with regexp_substr() in select list
+#
+create table t1 (a char(8));
+insert into t1 values ('b'), ('a'), ('xx');
+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';
+f
+b
+a
+explain format=json 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';
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t.f = 'a' or t.f = 'b'",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ }
+}
+drop table t1;
+#
+# MDEV-13454: consequence of mdev-14368 fixed for 5.5
+#
+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);
+SELECT * FROM t1
+LEFT OUTER JOIN
+(SELECT id2, COUNT(*) as ct FROM t2 GROUP BY id2) vc USING (id2)
+WHERE (vc.ct>0);
+id2 id ct
+1 1 1
+3 2 1
+2 7 1
+EXPLAIN FORMAT=JSON SELECT * FROM t1
+LEFT OUTER JOIN
+(SELECT id2, COUNT(*) as ct FROM t2 GROUP BY id2) vc USING (id2)
+WHERE (vc.ct>0);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "vc.ct > 0",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "ct > 0",
+ "filesort": {
+ "sort_key": "t2.id2",
+ "temporary_table": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "t1.id2 = vc.id2"
+ }
+ }
+}
+DROP TABLE t1,t2;
+SET sql_mode = DEFAULT;
+#
+# MDEV-15579: incorrect removal of sub-formulas to be pushed
+# into WHERE of materialized derived with GROUP BY
+#
+CREATE TABLE t1 (a INT, b INT, c INT, d INT);
+CREATE TABLE t2 (x INT, y INT, z INT);
+INSERT INTO t1 VALUES (1,1,66,1), (1,1,56,2), (3,2,42,3);
+INSERT INTO t2 VALUES (1,1,66), (1,12,32);
+SELECT *
+FROM t2,
+(
+SELECT a, b, max(c) AS max_c
+FROM t1
+GROUP BY a
+HAVING max_c > 37
+) AS v1
+WHERE (v1.a=1) AND (v1.b=v1.a) AND
+(v1.a=t2.x) AND (v1.max_c>30);
+x y z a b max_c
+1 1 66 1 1 66
+1 12 32 1 1 66
+EXPLAIN SELECT *
+FROM t2,
+(
+SELECT a, b, max(c) AS max_c
+FROM t1
+GROUP BY a
+HAVING max_c > 37
+) AS v1
+WHERE (v1.a=1) AND (v1.b=v1.a) AND
+(v1.a=t2.x) AND (v1.max_c>30);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where
+EXPLAIN FORMAT=JSON SELECT *
+FROM t2,
+(
+SELECT a, b, max(c) AS max_c
+FROM t1
+GROUP BY a
+HAVING max_c > 37
+) AS v1
+WHERE (v1.a=1) AND (v1.b=v1.a) AND
+(v1.a=t2.x) AND (v1.max_c>30);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.x = 1"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "v1.a = 1 and v1.b = 1 and v1.max_c > 30"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c > 37 and max_c > 30 and t1.b = 1",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1"
+ }
+ }
+ }
+ }
+ }
+}
+SELECT *
+FROM t2,
+(
+SELECT a, b, d, max(c) AS max_c
+FROM t1
+GROUP BY a,d
+HAVING max_c > 37
+) AS v1
+WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.b=v1.d) AND
+(v1.a=t2.x) AND (v1.max_c>30);
+x y z a b d max_c
+1 1 66 1 1 1 66
+1 12 32 1 1 1 66
+EXPLAIN SELECT *
+FROM t2,
+(
+SELECT a, b, d, max(c) AS max_c
+FROM t1
+GROUP BY a,d
+HAVING max_c > 37
+) AS v1
+WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.b=v1.d) AND
+(v1.a=t2.x) AND (v1.max_c>30);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where
+EXPLAIN FORMAT=JSON SELECT *
+FROM t2,
+(
+SELECT a, b, d, max(c) AS max_c
+FROM t1
+GROUP BY a,d
+HAVING max_c > 37
+) AS v1
+WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.b=v1.d) AND
+(v1.a=t2.x) AND (v1.max_c>30);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.x = 1"
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "v1.a = 1 and v1.b = 1 and v1.d = 1 and v1.max_c > 30"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c > 37 and max_c > 30 and t1.b = 1",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.d = 1"
+ }
+ }
+ }
+ }
+ }
+}
+DROP TABLE t1,t2;
+#
+# MDEV-15765: pushing condition with temporal constants
+# into constant tables
+#
+select * from (select date('2018-01-01') as d
+union all
+select date('2018-01-01') as d) as t
+where t.d between date ('2017-01-01') and date ('2019-01-01');
+d
+2018-01-01
+2018-01-01
+select * from (select date('2018-01-01') as d) as t
+where t.d between date ('2017-01-01') and date ('2019-01-01');
+d
+2018-01-01
diff --git a/mysql-test/r/derived_opt.result b/mysql-test/r/derived_opt.result
index 04a76c2cbc8..6e4ea1b5d36 100644
--- a/mysql-test/r/derived_opt.result
+++ b/mysql-test/r/derived_opt.result
@@ -231,8 +231,8 @@ 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;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 1 Using filesort
-1 PRIMARY <derived2> ref key0 key0 5 const 1 Using where
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+1 PRIMARY <derived2> ref key0 key0 5 const 1 Using where; Using filesort
2 DERIVED t2 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort
SELECT * FROM v1, t1 WHERE v1.b=t1.a ORDER BY v1.a;
a b a
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result
index 416d4e3aeb9..df6ba084a87 100644
--- a/mysql-test/r/derived_view.result
+++ b/mysql-test/r/derived_view.result
@@ -36,7 +36,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`f2` = `test`.`t1`.`f1`)
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`f2` = `test`.`t1`.`f1`
select * from (select * from t1 join t2 on f1=f2) tt;
f1 f11 f2 f22
1 1 1 1
@@ -48,7 +48,7 @@ select * from (select * from t1 where f1 in (2,3)) tt where f11=2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where ((`test`.`t1`.`f11` = 2) and (`test`.`t1`.`f1` in (2,3)))
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f11` = 2 and `test`.`t1`.`f1` in (2,3)
select * from (select * from t1 where f1 in (2,3)) tt where f11=2;
f1 f11
2 2
@@ -60,7 +60,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` join `test`.`t1` where ((`test`.`t1`.`f1` = `test`.`t1`.`f1`) and (`test`.`t1`.`f1` in (1,2)) and (`test`.`t1`.`f1` in (2,3)))
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` join `test`.`t1` where `test`.`t1`.`f1` = `test`.`t1`.`f1` and `test`.`t1`.`f1` in (1,2) and `test`.`t1`.`f1` in (2,3)
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;
f1 f11 f1 f11
@@ -71,7 +71,7 @@ select * from (select * from t1 where f1 in (2,3)) tt where f11=2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where ((`test`.`t1`.`f11` = 2) and (`test`.`t1`.`f1` in (2,3)))
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f11` = 2 and `test`.`t1`.`f1` in (2,3)
show status like 'Handler_read%';
Variable_name Value
Handler_read_first 0
@@ -128,7 +128,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`f2` = `test`.`t1`.`f1`)
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`f2` = `test`.`t1`.`f1`
select * from v2;
f1 f11 f2 f22
1 1 1 1
@@ -139,7 +139,7 @@ explain extended select * from v3 where f11 in (1,3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where ((`test`.`t1`.`f11` in (1,3)) and (`test`.`t1`.`f1` in (2,3)))
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f11` in (1,3) and `test`.`t1`.`f1` in (2,3)
select * from v3 where f11 in (1,3);
f1 f11
3 3
@@ -150,7 +150,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`f2` = `test`.`t1`.`f1`) and (`test`.`t1`.`f1` in (2,3)) and (`test`.`t1`.`f1` in (2,3)))
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`f2` = `test`.`t1`.`f1` and `test`.`t1`.`f1` in (2,3) and `test`.`t1`.`f1` in (2,3)
select * from v3 join v4 on f1=f2;
f1 f11 f2 f22
3 3 3 3
@@ -160,7 +160,7 @@ explain extended select * from v4 where f2 in (1,3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 11 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` where ((`test`.`t2`.`f2` in (1,3)) and (`test`.`t2`.`f2` in (2,3)))
+Note 1003 select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` where `test`.`t2`.`f2` in (1,3) and `test`.`t2`.`f2` in (2,3)
show status like 'Handler_read%';
Variable_name Value
Handler_read_first 0
@@ -216,7 +216,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ref key0 key0 5 test.t1.f1 2 100.00
2 DERIVED t2 ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`tt`.`f2` AS `f2`,`tt`.`f22` AS `f22` from `test`.`t1` join (select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` group by `test`.`t2`.`f2`) `tt` where (`tt`.`f2` = `test`.`t1`.`f1`)
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`tt`.`f2` AS `f2`,`tt`.`f22` AS `f22` from `test`.`t1` join (select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` group by `test`.`t2`.`f2`) `tt` where `tt`.`f2` = `test`.`t1`.`f1`
select * from t1 join (select * from t2 group by f2) tt on f1=f2;
f1 f11 f2 f22
1 1 1 1
@@ -290,7 +290,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ref key0 key0 5 test.t1.f1 2 100.00
2 DERIVED t2 ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`v2`.`f2` AS `f2`,`v2`.`f22` AS `f22` from `test`.`t1` join `test`.`v2` where (`v2`.`f2` = `test`.`t1`.`f1`)
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`v2`.`f2` AS `f2`,`v2`.`f22` AS `f22` from `test`.`t1` join `test`.`v2` where `v2`.`f2` = `test`.`t1`.`f1`
select * from t1 join v2 on f1=f2;
f1 f11 f2 f22
1 1 1 1
@@ -307,7 +307,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00
2 DERIVED t11 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`v31`.`f1` AS `f1`,`v31`.`f11` AS `f11`,`v3`.`f1` AS `f1`,`v3`.`f11` AS `f11` from `test`.`t1` join `test`.`v3` `v31` join `test`.`v3` where ((`v31`.`f1` = `test`.`t1`.`f1`) and (`v3`.`f1` = `test`.`t1`.`f1`))
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`v31`.`f1` AS `f1`,`v31`.`f11` AS `f11`,`v3`.`f1` AS `f1`,`v3`.`f11` AS `f11` from `test`.`t1` join `test`.`v3` `v31` join `test`.`v3` where `v31`.`f1` = `test`.`t1`.`f1` and `v3`.`f1` = `test`.`t1`.`f1`
flush status;
select * from t1,v3 as v31,v3 where t1.f1=v31.f1 and t1.f1=v3.f1;
f1 f11 f1 f11 f1 f11
@@ -372,9 +372,51 @@ explain extended select * from v1 join v4 on f1=f2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 11 100.00 Using where
1 PRIMARY <derived2> ref key0 key0 5 test.t2.f2 2 100.00
-2 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort
+2 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
Warnings:
-Note 1003 select `v1`.`f1` AS `f1`,`v1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`v1` join `test`.`t2` where ((`v1`.`f1` = `test`.`t2`.`f2`) and (`test`.`t2`.`f2` in (2,3)))
+Note 1003 select `v1`.`f1` AS `f1`,`v1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`v1` join `test`.`t2` where `v1`.`f1` = `test`.`t2`.`f2` and `test`.`t2`.`f2` in (2,3)
+explain format=json select * from v1 join v4 on f1=f2;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t2.f2 in (2,3) and t2.f2 is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["f1"],
+ "ref": ["test.t2.f2"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "t1.f1",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t1.f1 in (2,3)"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
select * from v1 join v4 on f1=f2;
f1 f11 f2 f22
3 3 3 3
@@ -385,7 +427,7 @@ explain extended select * from (select * from
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where ((`test`.`t1`.`f1` > 2) and (`test`.`t1`.`f1` < 7))
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` > 2 and `test`.`t1`.`f1` < 7
select * from (select * from
(select * from t1 where f1 < 7) tt where f1 > 2) zz;
f1 f11
@@ -398,7 +440,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived3> ALL NULL NULL NULL NULL 11 100.00 Using where
3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
Warnings:
-Note 1003 select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where (`test`.`t1`.`f1` < 7) group by `test`.`t1`.`f1`) `tt` where (`tt`.`f1` > 2)
+Note 1003 select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` < 7 and `test`.`t1`.`f1` > 2 group by `test`.`t1`.`f1`) `tt` where `tt`.`f1` > 2
select * from (select * from
(select * from t1 where f1 < 7 group by f1) tt where f1 > 2) zz;
f1 f11
@@ -411,7 +453,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11 100.00
2 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
Warnings:
-Note 1003 select `zz`.`f1` AS `f1`,`zz`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where ((`test`.`t1`.`f1` > 2) and (`test`.`t1`.`f1` < 7)) group by `test`.`t1`.`f1`) `zz`
+Note 1003 select `zz`.`f1` AS `f1`,`zz`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` > 2 and `test`.`t1`.`f1` < 7 group by `test`.`t1`.`f1`) `zz`
select * from (select * from
(select * from t1 where f1 < 7) tt where f1 > 2 group by f1) zz;
f1 f11
@@ -425,7 +467,55 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DERIVED <derived3> ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
Warnings:
-Note 1003 select `zz`.`f1` AS `f1`,`zz`.`f11` AS `f11` from (select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where (`test`.`t1`.`f1` < 7) group by `test`.`t1`.`f1`) `tt` where (`tt`.`f1` > 2) group by `tt`.`f1`) `zz`
+Note 1003 select `zz`.`f1` AS `f1`,`zz`.`f11` AS `f11` from (select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` < 7 and `test`.`t1`.`f1` > 2 group by `test`.`t1`.`f1`) `tt` where `tt`.`f1` > 2 group by `tt`.`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;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "tt.f1",
+ "temporary_table": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "tt.f1 > 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "filesort": {
+ "sort_key": "t1.f1",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t1.f1 < 7 and t1.f1 > 2"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
select * from (select * from
(select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) zz;
f1 f11
@@ -443,7 +533,70 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
5 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
Warnings:
-Note 1003 select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11`,`tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where (`test`.`t1`.`f1` < 7) group by `test`.`t1`.`f1`) `tt` join (select `t1`.`f1` AS `f1`,`t1`.`f11` AS `f11` from `test`.`t1` where (`t1`.`f1` < 7) group by `t1`.`f1`) `tt` where ((`tt`.`f1` = `tt`.`f1`) and (`tt`.`f1` > 2) and (`tt`.`f1` > 2))
+Note 1003 select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11`,`tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` < 7 and `test`.`t1`.`f1` > 2 and `test`.`t1`.`f1` > 2 group by `test`.`t1`.`f1`) `tt` join (select `t1`.`f1` AS `f1`,`t1`.`f11` AS `f11` from `test`.`t1` where `t1`.`f1` < 7 and `t1`.`f1` > 2 and `t1`.`f1` > 2 group by `t1`.`f1`) `tt` where `tt`.`f1` = `tt`.`f1` and `tt`.`f1` > 2 and `tt`.`f1` > 2
+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;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "tt.f1 > 2 and tt.f1 > 2 and tt.f1 is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "filesort": {
+ "sort_key": "t1.f1",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t1.f1 < 7 and t1.f1 > 2 and t1.f1 > 2"
+ }
+ }
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived5>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["f1"],
+ "ref": ["tt.f1"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 5,
+ "filesort": {
+ "sort_key": "t1.f1",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t1.f1 < 7 and t1.f1 > 2 and t1.f1 > 2"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
flush status;
select * from
(select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) x
@@ -461,9 +614,9 @@ Handler_read_last 0
Handler_read_next 2
Handler_read_prev 0
Handler_read_retry 0
-Handler_read_rnd 8
+Handler_read_rnd 4
Handler_read_rnd_deleted 0
-Handler_read_rnd_next 39
+Handler_read_rnd_next 33
flush status;
merged in merged derived join merged in merged derived
explain extended select * from
@@ -477,7 +630,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`t1`.`f1` AS `f1`,`t1`.`f11` AS `f11` from `test`.`t1` join `test`.`t1` where ((`t1`.`f1` = `test`.`t1`.`f1`) and (`test`.`t1`.`f1` > 2) and (`test`.`t1`.`f1` < 7) and (`test`.`t1`.`f1` > 2) and (`test`.`t1`.`f1` < 7))
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`t1`.`f1` AS `f1`,`t1`.`f11` AS `f11` from `test`.`t1` join `test`.`t1` where `t1`.`f1` = `test`.`t1`.`f1` and `test`.`t1`.`f1` > 2 and `test`.`t1`.`f1` < 7 and `test`.`t1`.`f1` > 2 and `test`.`t1`.`f1` < 7
select * from
(select * from
(select * from t1 where f1 < 7 ) tt where f1 > 2 ) x
@@ -505,7 +658,106 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DERIVED <derived3> ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
Warnings:
-Note 1003 select `x`.`f1` AS `f1`,`x`.`f11` AS `f11`,`z`.`f1` AS `f1`,`z`.`f11` AS `f11` from (select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where (`test`.`t1`.`f1` < 7) group by `test`.`t1`.`f1`) `tt` where (`tt`.`f1` > 2) group by `tt`.`f1`) `x` join (select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `t1`.`f1` AS `f1`,`t1`.`f11` AS `f11` from `test`.`t1` where (`t1`.`f1` < 7) group by `t1`.`f1`) `tt` where (`tt`.`f1` > 2) group by `tt`.`f1`) `z` where (`z`.`f1` = `x`.`f1`)
+Note 1003 select `x`.`f1` AS `f1`,`x`.`f11` AS `f11`,`z`.`f1` AS `f1`,`z`.`f11` AS `f11` from (select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` < 7 and `test`.`t1`.`f1` > 2 group by `test`.`t1`.`f1`) `tt` where `tt`.`f1` > 2 group by `tt`.`f1`) `x` join (select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (select `t1`.`f1` AS `f1`,`t1`.`f11` AS `f11` from `test`.`t1` where `t1`.`f1` < 7 and `t1`.`f1` > 2 group by `t1`.`f1`) `tt` where `tt`.`f1` > 2 group by `tt`.`f1`) `z` where `z`.`f1` = `x`.`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;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "x.f1 is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "tt.f1",
+ "temporary_table": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "tt.f1 > 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "filesort": {
+ "sort_key": "t1.f1",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t1.f1 < 7 and t1.f1 > 2"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["f1"],
+ "ref": ["x.f1"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "filesort": {
+ "sort_key": "tt.f1",
+ "temporary_table": {
+ "table": {
+ "table_name": "<derived5>",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "tt.f1 > 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 5,
+ "filesort": {
+ "sort_key": "t1.f1",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t1.f1 < 7 and t1.f1 > 2"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
select * from
(select * from
(select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) x
@@ -523,7 +775,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11 100.00
2 DERIVED t2 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
Warnings:
-Note 1003 select `tt`.`f2` AS `f2`,`tt`.`f22` AS `f22` from (select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` where (`test`.`t2`.`f2` in (2,3)) group by 1) `tt`
+Note 1003 select `tt`.`f2` AS `f2`,`tt`.`f22` AS `f22` from (select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` where `test`.`t2`.`f2` in (2,3) group by 1) `tt`
select * from (select * from v4 group by 1) tt;
f2 f22
2 2
@@ -533,9 +785,41 @@ explain extended
select * from ( select * from v1 where f1 < 7) tt;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived3> ALL NULL NULL NULL NULL 11 100.00 Using where
-3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort
+3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
Warnings:
-Note 1003 select `v1`.`f1` AS `f1`,`v1`.`f11` AS `f11` from `test`.`v1` where (`v1`.`f1` < 7)
+Note 1003 select `v1`.`f1` AS `f1`,`v1`.`f11` AS `f11` from `test`.`v1` where `v1`.`f1` < 7
+explain format=json
+select * from ( select * from v1 where f1 < 7) tt;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "v1.f1 < 7",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "filesort": {
+ "sort_key": "t1.f1",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t1.f1 < 7"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
select * from ( select * from v1 where f1 < 7) tt;
f1 f11
1 1
@@ -548,7 +832,7 @@ explain extended select * from (select * from v6) tt;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 11 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` where ((`test`.`t2`.`f2` < 7) and (`test`.`t2`.`f2` in (2,3)))
+Note 1003 select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` where `test`.`t2`.`f2` < 7 and `test`.`t2`.`f2` in (2,3)
select * from (select * from v6) tt;
f2 f22
3 3
@@ -580,9 +864,51 @@ explain extended select * from v6 join v7 on f2=f1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 11 100.00 Using where
1 PRIMARY <derived5> ref key0 key0 5 test.t2.f2 2 100.00
-5 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort
+5 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
Warnings:
-Note 1003 select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22`,`v1`.`f1` AS `f1`,`v1`.`f11` AS `f11` from `test`.`t2` join `test`.`v1` where ((`v1`.`f1` = `test`.`t2`.`f2`) and (`test`.`t2`.`f2` < 7) and (`test`.`t2`.`f2` in (2,3)))
+Note 1003 select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22`,`v1`.`f1` AS `f1`,`v1`.`f11` AS `f11` from `test`.`t2` join `test`.`v1` where `v1`.`f1` = `test`.`t2`.`f2` and `test`.`t2`.`f2` < 7 and `test`.`t2`.`f2` in (2,3)
+explain format=json select * from v6 join v7 on f2=f1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t2.f2 < 7 and t2.f2 in (2,3) and t2.f2 is not null"
+ },
+ "table": {
+ "table_name": "<derived5>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["f1"],
+ "ref": ["test.t2.f2"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 5,
+ "filesort": {
+ "sort_key": "t1.f1",
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t1.f1 < 7 and t1.f1 in (2,3)"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
select * from v6 join v7 on f2=f1;
f2 f22 f1 f11
3 3 3 3
@@ -724,7 +1050,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t`.`a` AS `a` from `test`.`t1` left join (`test`.`t2` `t` join `test`.`t3`) on(((`test`.`t`.`a` >= 1) and (`test`.`t3`.`b` > 5))) where 1 group by `test`.`t`.`a`
+Note 1003 select `test`.`t`.`a` AS `a` from `test`.`t1` left join (`test`.`t2` `t` join `test`.`t3`) on(`test`.`t`.`a` >= 1 and `test`.`t3`.`b` > 5) where 1 group by `test`.`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;
@@ -739,7 +1065,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`a` >= 1) and (`test`.`t3`.`b` > 5))) where 1 group by `test`.`t2`.`a`
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`a` >= 1 and `test`.`t3`.`b` > 5) where 1 group by `test`.`t2`.`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;
@@ -755,7 +1081,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`a` >= 1) and (`test`.`t3`.`b` > 5))) where 1 group by `test`.`t2`.`a`
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`a` >= 1 and `test`.`t3`.`b` > 5) where 1 group by `test`.`t2`.`a`
SELECT t.a FROM t1 LEFT JOIN
(v1 t JOIN t3 ON t3.b > 5) ON t.a >= 1
GROUP BY t.a;
@@ -817,7 +1143,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
3 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 Using temporary; Using filesort
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <expr_cache><`test`.`t3`.`a`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(select `v1`.`a` from `test`.`v1` join `test`.`t2` where ((`test`.`t2`.`a` = `v1`.`b`) and (<cache>(`test`.`t3`.`a`) = `v1`.`a`)))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <expr_cache><`test`.`t3`.`a`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(select `v1`.`a` from `test`.`v1` join `test`.`t2` where `test`.`t2`.`a` = `v1`.`b` and <cache>(`test`.`t3`.`a`) = `v1`.`a`)))
SELECT * FROM t3
WHERE t3.a IN (SELECT v1.a FROM v1, t2 WHERE t2.a = v1.b);
a
@@ -907,7 +1233,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 0 0.00 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t3`.`b` AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t3` left join (`test`.`t2` join `test`.`t1`) on((`test`.`t3`.`a` <> 0)) where ((`test`.`t1`.`a` = `test`.`t1`.`a`) or (`test`.`t3`.`b` <> 0))
+Note 1003 select `test`.`t3`.`b` AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t3` left join (`test`.`t2` join `test`.`t1`) on(`test`.`t3`.`a` <> 0) where `test`.`t1`.`a` = `test`.`t1`.`a` or `test`.`t3`.`b` <> 0
DROP VIEW v1;
DROP TABLE t1,t2,t3;
#
@@ -1298,7 +1624,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 't.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(1,<expr_cache><`test`.`t1`.`a`>(exists(select 28 from `test`.`t3` where ('j' < `test`.`t1`.`a`))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(1,<expr_cache><`test`.`t1`.`a`>(exists(select 28 from `test`.`t3` where 'j' < `test`.`t1`.`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);
@@ -1337,7 +1663,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t5 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select straight_join `test`.`s2`.`a` AS `a`,`test`.`s3`.`a` AS `a`,`test`.`s3`.`c` AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`test`.`t5`.`d` AS `d` from `test`.`t2` `s2` join `test`.`t3` `s3` left join (`test`.`t4` left join `test`.`t3` on((`test`.`t4`.`a` <> 0))) on((`test`.`s3`.`a` <> 0)) join `test`.`t5` where ((`test`.`t5`.`d` = 0) and (`test`.`s3`.`c` <> 0) and (`test`.`s2`.`a` <> 0))
+Note 1003 select straight_join `test`.`s2`.`a` AS `a`,`test`.`s3`.`a` AS `a`,`test`.`s3`.`c` AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`test`.`t5`.`d` AS `d` from `test`.`t2` `s2` join `test`.`t3` `s3` left join (`test`.`t4` left join `test`.`t3` on(`test`.`t4`.`a` <> 0)) on(`test`.`s3`.`a` <> 0) join `test`.`t5` where `test`.`t5`.`d` = 0 and `test`.`s3`.`c` <> 0 and `test`.`s2`.`a` <> 0
SELECT STRAIGHT_JOIN *
FROM ( t2 AS s2
JOIN
@@ -1364,7 +1690,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 0 0.00 Using where
1 SIMPLE s3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select straight_join `test`.`s2`.`a` AS `a`,`test`.`t5`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`test`.`t4`.`a` AS `a`,`test`.`s3`.`a` AS `a`,`test`.`s3`.`c` AS `c` from `test`.`t2` `s2` join `test`.`t5` join `test`.`t3` left join (`test`.`t4` left join `test`.`t3` `s3` on((`test`.`t4`.`a` <> 0))) on((`test`.`t3`.`a` <> 0)) where ((`test`.`t5`.`d` = 0) and (`test`.`s2`.`a` <> 0) and (`test`.`t3`.`c` <> 0))
+Note 1003 select straight_join `test`.`s2`.`a` AS `a`,`test`.`t5`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`test`.`t4`.`a` AS `a`,`test`.`s3`.`a` AS `a`,`test`.`s3`.`c` AS `c` from `test`.`t2` `s2` join `test`.`t5` join `test`.`t3` left join (`test`.`t4` left join `test`.`t3` `s3` on(`test`.`t4`.`a` <> 0)) on(`test`.`t3`.`a` <> 0) where `test`.`t5`.`d` = 0 and `test`.`s2`.`a` <> 0 and `test`.`t3`.`c` <> 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)
@@ -1386,7 +1712,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 0 0.00 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select straight_join `test`.`t2`.`a` AS `a`,`test`.`t5`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c` from `test`.`t2` join `test`.`t5` join `test`.`t3` left join (`test`.`t4` left join (`test`.`t3`) on((`test`.`t4`.`a` <> 0))) on((`test`.`t3`.`a` <> 0)) where ((`test`.`t5`.`d` = 0) and (`test`.`t2`.`a` <> 0) and (`test`.`t3`.`c` <> 0))
+Note 1003 select straight_join `test`.`t2`.`a` AS `a`,`test`.`t5`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c` from `test`.`t2` join `test`.`t5` join `test`.`t3` left join (`test`.`t4` left join (`test`.`t3`) on(`test`.`t4`.`a` <> 0)) on(`test`.`t3`.`a` <> 0) where `test`.`t5`.`d` = 0 and `test`.`t2`.`a` <> 0 and `test`.`t3`.`c` <> 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)
@@ -1692,7 +2018,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t2`.`b` <> 0))
+Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t2`.`b` <> 0
SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b AND t.c = t1.a;
@@ -1707,7 +2033,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t2`.`b` <> 0))
+Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t2`.`b` <> 0
SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b <> 0 AND t.c = t1.a;
@@ -1723,7 +2049,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`b` = `test`.`t2`.`a`)) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t2`.`b` <> 0))
+Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t2`.`a`) where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t2`.`b` <> 0
SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b AND t.c = t1.a;
@@ -1738,7 +2064,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`b` = `test`.`t2`.`a`)) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t2`.`b` <> 0))
+Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t2`.`a`) where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t2`.`b` <> 0
SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b <> 0 AND t.c = t1.a;
@@ -2196,7 +2522,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ref key0 key0 5 test.t2.c2 2 100.00 Using where
2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00
Warnings:
-Note 1003 select `v1`.`c1` AS `c1`,`v1`.`c2` AS `c2` from `test`.`v1` join `test`.`t2` where ((`v1`.`c1` = `test`.`t2`.`c1`) and (`v1`.`c2` = `test`.`t2`.`c2`))
+Note 1003 select `v1`.`c1` AS `c1`,`v1`.`c2` AS `c2` from `test`.`v1` join `test`.`t2` where `v1`.`c1` = `test`.`t2`.`c1` and `v1`.`c2` = `test`.`t2`.`c2`
SELECT v1.c1, v1.c2 FROM v1, t2 WHERE v1.c1=t2.c1 AND v1.c2=t2.c2;
c1 c2
c 3
@@ -2209,7 +2535,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ref key0 key0 5 test.t2.c2 2 100.00 Using where
2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort
Warnings:
-Note 1003 select `test`.`t2`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from (select `test`.`t1`.`c1` AS `g`,max(`test`.`t1`.`c2`) AS `m` from `test`.`t1` group by `test`.`t1`.`c1`) `t` join `test`.`t2` where ((`t`.`g` = `test`.`t2`.`c1`) and (`t`.`m` = `test`.`t2`.`c2`))
+Note 1003 select `test`.`t2`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from (select `test`.`t1`.`c1` AS `g`,max(`test`.`t1`.`c2`) AS `m` from `test`.`t1` group by `test`.`t1`.`c1`) `t` join `test`.`t2` where `t`.`g` = `test`.`t2`.`c1` and `t`.`m` = `test`.`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;
c1 c2
@@ -2221,7 +2547,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00
Warnings:
-Note 1003 select `v1`.`c1` AS `c1`,`v1`.`c2` AS `c2`,`test`.`t2`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`v1` join `test`.`t2` where (`v1`.`c1` = `test`.`t2`.`c1`)
+Note 1003 select `v1`.`c1` AS `c1`,`v1`.`c2` AS `c2`,`test`.`t2`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`v1` join `test`.`t2` where `v1`.`c1` = `test`.`t2`.`c1`
SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1;
c1 c2 c1 c2
c 3 c 3
@@ -2369,7 +2695,7 @@ ON p.id = g.p_random
ORDER BY gallery_name ASC
;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using filesort
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 10 Using filesort
1 PRIMARY p eq_ref PRIMARY PRIMARY 4 g.p_random 1 Using where
2 DERIVED gal ALL NULL NULL NULL NULL 10
3 DEPENDENT SUBQUERY pi ref gallery_id gallery_id 4 test.gal.id 4 Using temporary; Using filesort
@@ -2647,7 +2973,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select straight_join `test`.`t1`.`c1` AS `c1` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t2`.`c2` from `test`.`t2` where (<cache>(`test`.`t1`.`c1`) = `test`.`t2`.`c2`)))
+Note 1003 select straight_join `test`.`t1`.`c1` AS `c1` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t2`.`c2` from `test`.`t2` where <cache>(`test`.`t1`.`c1`) = `test`.`t2`.`c2`))
DROP TABLE t1, t2;
set optimizer_switch=@exit_optimizer_switch;
set join_cache_level=@exit_join_cache_level;
diff --git a/mysql-test/r/dirty_close.result b/mysql-test/r/dirty_close.result
index f7012ff9c01..d13fdb09192 100644
--- a/mysql-test/r/dirty_close.result
+++ b/mysql-test/r/dirty_close.result
@@ -1,3 +1,8 @@
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
+disconnect con1;
+connection con2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (n INT);
INSERT INTO t1 VALUES (1),(2),(3);
@@ -7,13 +12,25 @@ n
2
3
DROP TABLE t1;
+connection default;
+disconnect con2;
+connection default;
SELECT GET_LOCK("dangling", 0);
GET_LOCK("dangling", 0)
1
+connect con1, localhost, root,,;
+connection con1;
SELECT GET_LOCK('dangling', 3600);;
+connection default;
+disconnect con1;
+connect con1, localhost, root,,;
SELECT GET_LOCK('dangling', 3600);;
+connection default;
SELECT RELEASE_LOCK('dangling');
RELEASE_LOCK('dangling')
1
+connection con1;
GET_LOCK('dangling', 3600)
1
+connection default;
+disconnect con1;
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index b5e8cefca69..8d7074cd270 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -175,7 +175,7 @@ explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 4 Using where; Using temporary
1 SIMPLE t3 ref a a 5 test.t1.b 2 Using index
-1 SIMPLE t2 index a a 4 NULL 5 Using where; Using index; Distinct; Using join buffer (flat, BNL join)
+1 SIMPLE t2 index a a 4 NULL 5 Using where; Using index; Using join buffer (flat, BNL join)
SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
a
1
@@ -212,7 +212,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 Using index
explain SELECT distinct a from t3 order by a desc limit 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 index NULL a 5 NULL 2 Using index
+1 SIMPLE t3 index NULL a 5 NULL 40 Using index
explain SELECT distinct a,b from t3 order by a+1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort
@@ -302,11 +302,11 @@ WHERE
AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index id id 4 NULL 2 Using index; Using temporary
-1 SIMPLE t2 index id id 8 NULL 1 Using index; Distinct; Using join buffer (flat, BNL join)
-1 SIMPLE t3 index id id 8 NULL 1 Using index; Distinct; Using join buffer (flat, BNL join)
-1 SIMPLE j_lj_t2 index id id 4 NULL 2 Using where; Using index; Distinct; Using join buffer (flat, BNL join)
-1 SIMPLE t2_lj ref id id 4 test.j_lj_t2.id 1 Using where; Using index; Distinct
-1 SIMPLE j_lj_t3 index id id 4 NULL 2 Using where; Using index; Distinct; Using join buffer (flat, BNL join)
+1 SIMPLE t2 index id id 8 NULL 1 Using index; Using join buffer (flat, BNL join)
+1 SIMPLE t3 index id id 8 NULL 1 Using index; Using join buffer (flat, BNL join)
+1 SIMPLE j_lj_t2 index id id 4 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
+1 SIMPLE t2_lj ref id id 4 test.j_lj_t2.id 1 Using where; Using index
+1 SIMPLE j_lj_t3 index id id 4 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
1 SIMPLE t3_lj ref id id 4 test.j_lj_t3.id 1 Using where; Using index; Distinct
SELECT DISTINCT
t1.id
@@ -518,7 +518,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT DISTINCT t1_1.a, t1_1.b FROM t1 t1_1, t1 t1_2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1_1 ALL NULL NULL NULL NULL 3 Using temporary
-1 SIMPLE t1_2 index NULL PRIMARY 4 NULL 3 Using index; Distinct; Using join buffer (flat, BNL join)
+1 SIMPLE t1_2 index NULL PRIMARY 4 NULL 3 Using index; Using join buffer (flat, BNL join)
EXPLAIN SELECT DISTINCT t1_1.a, t1_1.b FROM t1 t1_1, t1 t1_2
WHERE t1_1.a = t1_2.a;
id select_type table type possible_keys key key_len ref rows Extra
@@ -916,11 +916,11 @@ SELECT STRAIGHT_JOIN DISTINCT t1.id FROM
t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 96 100.00 Using where; Using temporary
-1 PRIMARY <derived2> ref key0 key0 5 test.t1.i1 9 100.00 Using where; Distinct
-1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Distinct; Using join buffer (flat, BNL join)
-2 DERIVED t1 ALL NULL NULL NULL NULL 96 100.00
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.i1 9 100.00 Using where
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 96 100.00 Using where
Warnings:
-Note 1003 select straight_join distinct `test`.`t1`.`id` AS `id` from `test`.`t1` join `test`.`v1` join `test`.`t2` where ((`test`.`t2`.`i` = `v1`.`id`) and (`v1`.`i1` = `test`.`t1`.`i1`) and (`v1`.`id` <> 3))
+Note 1003 select straight_join distinct `test`.`t1`.`id` AS `id` from `test`.`t1` join `test`.`v1` join `test`.`t2` where `test`.`t2`.`i` = `v1`.`id` and `v1`.`i1` = `test`.`t1`.`i1` and `v1`.`id` <> 3
set join_buffer_size=1024;
SELECT STRAIGHT_JOIN DISTINCT t1.id FROM
t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3;
diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result
index c25ae9e3055..1a06380e66f 100644
--- a/mysql-test/r/drop.result
+++ b/mysql-test/r/drop.result
@@ -82,13 +82,22 @@ drop table if exists t1;
create table t1 (i int);
create database mysqltest;
lock tables t1 read;
+connect addconroot1, localhost, root,,;
drop table t1;
+connect addconroot2, localhost, root,,;
show open tables;
drop database mysqltest;
+connection default;
select 1;
1
1
unlock tables;
+connection addconroot1;
+connection addconroot2;
+disconnect addconroot2;
+connection addconroot1;
+disconnect addconroot1;
+connection default;
drop table if exists t1,t2;
create table t1 (a int);
create table t2 (a int);
@@ -99,14 +108,20 @@ drop table t1;
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
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;
drop table t1;
ERROR HY000: Table 't1' was not locked with LOCK TABLES
+connection default;
drop table t1,t2;
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+disconnect addconroot;
+connection default;
unlock tables;
drop table t1,t2;
End of 5.0 tests
diff --git a/mysql-test/r/drop_debug.result b/mysql-test/r/drop_debug.result
deleted file mode 100644
index 852b3ac2163..00000000000
--- a/mysql-test/r/drop_debug.result
+++ /dev/null
@@ -1,25 +0,0 @@
-
-# --
-# -- Bug#43138: DROP DATABASE failure does not clean up message list.
-# --
-
-DROP DATABASE IF EXISTS mysql_test;
-
-CREATE DATABASE mysql_test;
-CREATE TABLE mysql_test.t1(a INT);
-CREATE TABLE mysql_test.t2(b INT);
-CREATE TABLE mysql_test.t3(c INT);
-
-SET SESSION debug_dbug= "+d,bug43138";
-
-DROP DATABASE mysql_test;
-Warnings:
-Error 1051 Unknown table 't1'
-Error 1051 Unknown table 't2'
-Error 1051 Unknown table 't3'
-
-SET SESSION debug_dbug= "-d,bug43138";
-
-# --
-# -- End of Bug#43138.
-# --
diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result
index fe4ee3f7de2..7a5eeac67cc 100644
--- a/mysql-test/r/dyncol.result
+++ b/mysql-test/r/dyncol.result
@@ -47,7 +47,7 @@ select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS unsigned int));
hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS unsigned int))
000100010001FFFFFFFFFFFFFF7F
Warnings:
-Warning 1916 Got overflow when converting '99999999999999999999999999999' to INT. Value truncated.
+Warning 1916 Got overflow when converting '99999999999999999999999999999' to INT. Value truncated
select hex(COLUMN_CREATE(1, NULL AS int));
hex(COLUMN_CREATE(1, NULL AS int))
000000
@@ -73,7 +73,7 @@ select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS int));
hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS int))
000100010000FEFFFFFFFFFFFFFF
Warnings:
-Warning 1916 Got overflow when converting '99999999999999999999999999999' to INT. Value truncated.
+Warning 1916 Got overflow when converting '99999999999999999999999999999' to INT. Value truncated
select hex(COLUMN_CREATE(1, NULL AS double));
hex(COLUMN_CREATE(1, NULL AS double))
000000
@@ -91,19 +91,19 @@ hex(COLUMN_CREATE(1, NULL AS decimal))
000000
select hex(COLUMN_CREATE(1, 1212 AS decimal));
hex(COLUMN_CREATE(1, 1212 AS decimal))
-0001000100040900800004BC
+000100010004040084BC
select hex(COLUMN_CREATE(1, 7 AS decimal));
hex(COLUMN_CREATE(1, 7 AS decimal))
-000100010004090080000007
+000100010004010087
select hex(COLUMN_CREATE(1, 8 AS decimal));
hex(COLUMN_CREATE(1, 8 AS decimal))
-000100010004090080000008
+000100010004010088
select hex(COLUMN_CREATE(1, 127 AS decimal));
hex(COLUMN_CREATE(1, 127 AS decimal))
-00010001000409008000007F
+0001000100040300807F
select hex(COLUMN_CREATE(1, 128 AS decimal));
hex(COLUMN_CREATE(1, 128 AS decimal))
-000100010004090080000080
+00010001000403008080
select hex(COLUMN_CREATE(1, 12.12 AS decimal));
hex(COLUMN_CREATE(1, 12.12 AS decimal))
00010001000402028C0C
@@ -157,7 +157,7 @@ select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8,
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select hex(column_create(1,'afaf' AS char charset 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)) AS `hex(COLUMN_CREATE(1, "afaf" AS char character set utf8,
+Note 1003 select hex(column_create(1,'afaf' AS char charset 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)) AS `hex(COLUMN_CREATE(1, "afaf" AS char character set utf8,
2, 1212 AS unsigned int,
3, 1212 AS int,
4, 12.12 AS double,
@@ -223,7 +223,7 @@ select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1
column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as unsigned int)
18446744073709551615
Warnings:
-Warning 1916 Got overflow when converting '99999999999999999999999999999' to UNSIGNED INT. Value truncated.
+Warning 1916 Got overflow when converting '99999999999999999999999999999' to UNSIGNED INT. Value truncated
select column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as unsigned int);
column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as unsigned int)
1000
@@ -231,12 +231,12 @@ select column_get(column_create(1, -1 AS decimal), 1 as unsigned int);
column_get(column_create(1, -1 AS decimal), 1 as unsigned int)
0
Warnings:
-Warning 1916 Got overflow when converting '-1' to UNSIGNED INT. Value truncated.
+Warning 1916 Got overflow when converting '-1' to UNSIGNED INT. Value truncated
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as unsigned int);
column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as unsigned int)
18446744073709551615
Warnings:
-Warning 1916 Got overflow when converting '1e+29' to UNSIGNED INT. Value truncated.
+Warning 1916 Got overflow when converting '1e29' to UNSIGNED INT. Value truncated
select column_get(column_create(1, 999.9 AS double), 1 as unsigned int);
column_get(column_create(1, 999.9 AS double), 1 as unsigned int)
1000
@@ -244,7 +244,7 @@ select column_get(column_create(1, -1 AS double), 1 as unsigned int);
column_get(column_create(1, -1 AS double), 1 as unsigned int)
0
Warnings:
-Warning 1916 Got overflow when converting '-1' to UNSIGNED INT. Value truncated.
+Warning 1916 Got overflow when converting '-1' to UNSIGNED INT. Value truncated
select column_get(column_create(1, "1212III" AS char), 1 as unsigned int);
column_get(column_create(1, "1212III" AS char), 1 as unsigned int)
1212
@@ -314,12 +314,12 @@ select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1
column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as int)
9223372036854775807
Warnings:
-Warning 1916 Got overflow when converting '99999999999999999999999999999' to INT. Value truncated.
+Warning 1916 Got overflow when converting '99999999999999999999999999999' to INT. Value truncated
select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as int);
column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as int)
-9223372036854775808
Warnings:
-Warning 1916 Got overflow when converting '-99999999999999999999999999999' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-99999999999999999999999999999' to INT. Value truncated
select column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as int);
column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as int)
1000
@@ -330,7 +330,7 @@ select column_get(column_create(1, -99999999999999999999999999999 AS double), 1
column_get(column_create(1, -99999999999999999999999999999 AS double), 1 as int)
-9223372036854775808
Warnings:
-Warning 1916 Got overflow when converting '-1e+29' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-1e29' to INT. Value truncated
select column_get(column_create(1, "-1212III" AS char), 1 as int);
column_get(column_create(1, "-1212III" AS char), 1 as int)
-1212
@@ -1458,8 +1458,8 @@ Note 1105 Cast to signed converted positive out-of-range integer to it's negativ
# MDEV-7505 - Too large scale in DECIMAL dynamic column getter crashes
# mysqld
#
-SELECT COLUMN_GET(`x`, 'y' AS DECIMAL(5,34));
-ERROR 42000: Too big scale 34 specified for ''y''. Maximum is 30.
+SELECT COLUMN_GET(`x`, 'y' AS DECIMAL(5,50));
+ERROR 42000: Too big scale 50 specified for ''y''. Maximum is 38
#
# test of symbolic names
#
@@ -1731,36 +1731,36 @@ column_json(column_create(1, "val", 2, column_create(3, "val2")))
# Time encoding
#
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 json;
-hex json
+column_json(column_create("t", "800:46:06.23434" AS time)) as js;
+hex js
04010001000000070074649363B82003 {"t":"800:46:06.234340"}
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 json;
-hex json
+column_json(column_create(1, "800:46:06.23434" AS time)) as js;
+hex js
000100010007649363B82003 {"1":"800:46:06.234340"}
select hex(column_create("t", "800:46:06" AS time)) as hex,
-column_json(column_create("t", "800:46:06" AS time)) as json;
-hex json
+column_json(column_create("t", "800:46:06" AS time)) as js;
+hex js
04010001000000070074860B32 {"t":"800:46:06"}
select hex(column_create(1, "800:46:06" AS time)) as hex,
-column_json(column_create(1, "800:46:06" AS time)) as json;
-hex json
+column_json(column_create(1, "800:46:06" AS time)) as js;
+hex js
000100010007000060B82003 {"1":"800:46:06"}
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 json;
-hex json
+column_json(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as js;
+hex js
0401000100000005007495B90F649363B80A00 {"t":"2012-12-21 10:46:06.234340"}
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 json;
-hex json
+column_json(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as js;
+hex js
00010001000595B90F649363B80A00 {"1":"2012-12-21 10:46:06.234340"}
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 json;
-hex json
+column_json(column_create("t", "2012-12-21 10:46:06" AS datetime)) as js;
+hex js
0401000100000005007495B90F86AB00 {"t":"2012-12-21 10:46:06"}
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 json;
-hex json
+column_json(column_create(1, "2012-12-21 10:46:06" AS datetime)) as js;
+hex js
00010001000595B90F000060B80A00 {"1":"2012-12-21 10:46:06"}
#
# MDEV-4849: Out of memory error and valgrind warnings on COLUMN_ADD
@@ -1895,3 +1895,64 @@ drop table t1;
#
# end of 10.0 tests
#
+#
+# Start of 10.2 tests
+#
+create view v1 as select column_get(column_add(column_create(1 , 'blue' as char), 2, 'ttt'), 1 as char);
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select column_get(column_add(column_create(1,'blue' AS char charset utf8 ),2,'ttt'),1 as char charset utf8) AS `Name_exp_1` utf8 utf8_general_ci
+select * from v1;
+Name_exp_1
+blue
+drop view v1;
+#
+# MDEV-10134 Add full support for DEFAULT
+#
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `name` varchar(10) DEFAULT NULL,
+ `value` varchar(10) DEFAULT NULL,
+ `dyncol0` blob DEFAULT column_create(`name`,`value`),
+ `value_dyncol0_name0` varchar(10) DEFAULT (column_get(`dyncol0`,'name0' as char charset utf8)),
+ `dyncol1` blob DEFAULT column_add(`dyncol0`,'name1','value1'),
+ `value_dyncol1_name1` varchar(10) DEFAULT (column_get(`dyncol1`,'name1' as char charset utf8)),
+ `dyncol2` blob DEFAULT column_add(`dyncol1`,'name1',NULL AS int),
+ `dyncol2_exists_name0` int(11) DEFAULT column_exists(`dyncol2`,'name0'),
+ `dyncol2_exists_name1` int(11) DEFAULT column_exists(`dyncol2`,'name1'),
+ `dyncol2_check` int(11) DEFAULT column_check(`dyncol2`),
+ `dyncol1_list` text DEFAULT column_list(`dyncol1`),
+ `dyncol1_json` text DEFAULT column_json(`dyncol1`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (name,value) VALUES ('name0', 'value0');
+SELECT value_dyncol0_name0, value_dyncol1_name1 FROM t1;
+value_dyncol0_name0 value_dyncol1_name1
+value0 value1
+SELECT dyncol2_check, dyncol2_exists_name0, dyncol2_exists_name1 FROM t1;
+dyncol2_check dyncol2_exists_name0 dyncol2_exists_name1
+1 1 0
+SELECT dyncol1_list FROM t1;
+dyncol1_list
+`name0`,`name1`
+SELECT dyncol1_json FROM t1;
+dyncol1_json
+{"name0":"value0","name1":"value1"}
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/empty_table.result b/mysql-test/r/empty_table.result
index cea787f4abd..2bca3e792fa 100644
--- a/mysql-test/r/empty_table.result
+++ b/mysql-test/r/empty_table.result
@@ -7,4 +7,12 @@ select * from t1;
nr b str
select * from t1 limit 0;
nr b str
+show status like "Empty_queries";
+Variable_name Value
+Empty_queries 2
drop table t1;
+select * from t2;
+ERROR 42S02: Table 'test.t2' doesn't exist
+show status like "Empty_queries";
+Variable_name Value
+Empty_queries 2
diff --git a/mysql-test/r/empty_user_table.result b/mysql-test/r/empty_user_table.result
index b93596ab59a..54a7fd4907b 100644
--- a/mysql-test/r/empty_user_table.result
+++ b/mysql-test/r/empty_user_table.result
@@ -2,6 +2,7 @@ create table t1 as select * from mysql.user;
truncate table mysql.user;
flush privileges;
connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET);
+connect fail,localhost,u1;
Got one of the listed errors
insert mysql.user select * from t1;
drop table t1;
diff --git a/mysql-test/r/enforce_storage_engine.result b/mysql-test/r/enforce_storage_engine.result
index 6b5e1f6958b..296ed405a72 100644
--- a/mysql-test/r/enforce_storage_engine.result
+++ b/mysql-test/r/enforce_storage_engine.result
@@ -69,8 +69,12 @@ ERROR 42000: Unknown storage engine 'FooBar'
select @@session.enforce_storage_engine;
@@session.enforce_storage_engine
MyISAM
+connect con1,localhost,user_1,,;
+connection con1;
SET SESSION enforce_storage_engine=MyISAM;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
+disconnect con1;
+connection default;
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;
@@ -102,6 +106,8 @@ t1 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;
@@session.enforce_storage_engine
MEMORY
@@ -119,6 +125,8 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
DROP TABLE t1;
+connection default;
+disconnect con1;
set global sql_mode=default;
SET SESSION enforce_storage_engine=NULL;
SET GLOBAL enforce_storage_engine=NULL;
diff --git a/mysql-test/r/error_simulation.result b/mysql-test/r/error_simulation.result
index edb97d4ab2e..e0ec26b2d1c 100644
--- a/mysql-test/r/error_simulation.result
+++ b/mysql-test/r/error_simulation.result
@@ -121,3 +121,12 @@ a
2
#cleanup
DROP TABLE t1, pid_table;
+#
+# MDEV-12416 OOM in create_virtual_tmp_table() makes the server crash
+#
+CREATE FUNCTION f1(a INT) RETURNS INT RETURN a;
+SET SESSION debug_dbug="+d,simulate_create_virtual_tmp_table_out_of_memory";
+SELECT f1(1);
+Got one of the listed errors
+DROP FUNCTION f1;
+SET SESSION debug_dbug=DEFAULT;
diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result
index e1d494d3324..2be04abb15d 100644
--- a/mysql-test/r/errors.result
+++ b/mysql-test/r/errors.result
@@ -32,6 +32,8 @@ set sql_mode=default;
CREATE TABLE t1 (a INT);
SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
a
+Warnings:
+Warning 1365 Division by 0
INSERT INTO t1 VALUES(1);
SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
a
@@ -40,6 +42,8 @@ INSERT INTO t1 VALUES(2),(3);
SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
a
1
+Warnings:
+Warning 1365 Division by 0
DROP TABLE t1;
CREATE TABLE t1( a INT );
SELECT b FROM t1;
@@ -142,7 +146,7 @@ SELECT (CONVERT('0' USING latin1) IN (CHAR(COT('v') USING utf8),''));
ERROR 22003: DOUBLE value is out of range in 'cot('v')'
SET NAMES utf8 COLLATE utf8_latvian_ci ;
SELECT UPDATEXML(-73 * -2465717823867977728,@@global.auto_increment_increment,null);
-ERROR 22003: BIGINT value is out of range in '(-(73) * -(2465717823867977728))'
+ERROR 22003: BIGINT value is out of range in '-73 * -2465717823867977728'
#
# End Bug#57882
#
diff --git a/mysql-test/r/events_1.result b/mysql-test/r/events_1.result
index a105dcd2125..fc8d02e5e93 100644
--- a/mysql-test/r/events_1.result
+++ b/mysql-test/r/events_1.result
@@ -11,8 +11,10 @@ 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';
Database (db_x)
db_x
@@ -24,8 +26,11 @@ SHOW TABLES FROM db_x;
Tables_in_db_x
x_table
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;
diff --git a/mysql-test/r/events_2.result b/mysql-test/r/events_2.result
index 1589fbddf0c..6d2ebda03d0 100644
--- a/mysql-test/r/events_2.result
+++ b/mysql-test/r/events_2.result
@@ -262,13 +262,13 @@ begin
alter event e1 rename to e2;
return 1;
end|
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
create function f1() returns int
begin
drop event e2;
return 1;
end|
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
----------------------------------------------------------------------
create trigger trg before insert on t1 for each row
begin
@@ -309,14 +309,14 @@ begin
alter event e1 rename to e2;
end|
insert into t1 (a) values (1)|
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
drop procedure p1|
create procedure p1()
begin
drop event e1;
end|
insert into t1 (a) values (1)|
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
drop table t1|
drop event e1|
set names utf8;
@@ -379,7 +379,7 @@ do
select 1;
alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
ends '1999-01-02 00:00:00';
-ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future.
+ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future
drop event event_35981;
create event event_35981 on schedule every 1 hour starts current_timestamp
on completion not preserve
@@ -400,7 +400,7 @@ Warnings:
Note 1544 Event execution time is in the past. Event has been disabled
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;
-ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future.
+ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future
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;
Warnings:
diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result
index bde4f1c785b..b56912dea7e 100644
--- a/mysql-test/r/events_bugs.result
+++ b/mysql-test/r/events_bugs.result
@@ -38,7 +38,7 @@ create event e_55 on schedule at 10000101000000 do drop table t;
ERROR HY000: Incorrect AT value: '10000101000000'
create event e_55 on schedule at 20000101000000 do drop table t;
Warnings:
-Note 1588 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation.
+Note 1588 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation
show events;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
create event e_55 on schedule at 20200101000000 starts 10000101000000 do drop table t;
@@ -203,10 +203,13 @@ drop database if exists mysqltest_db1;
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;
alter event mysqltest_user1 rename to mysqltest_db1.mysqltest_user1;
ERROR 42000: Access denied for user 'mysqltest_user1'@'localhost' to database 'mysqltest_db1'
"Let's test now rename when there is no select DB"
+disconnect conn2;
+connect conn2,localhost,mysqltest_user1,,*NO-ONE*;
select database();
database()
NULL
@@ -216,16 +219,18 @@ select event_schema, event_name, definer, event_type, status from information_sc
event_schema event_name definer event_type status
events_test mysqltest_user1 mysqltest_user1@localhost RECURRING ENABLED
drop event events_test.mysqltest_user1;
+disconnect conn2;
+connection default;
drop user mysqltest_user1@localhost;
drop database mysqltest_db1;
create event e_53 on schedule at (select s1 from ttx) do drop table t;
-ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions.
+ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions
create event e_53 on schedule every (select s1 from ttx) second do drop table t;
-ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions.
+ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions
create event e_53 on schedule every 5 second starts (select s1 from ttx) do drop table t;
-ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions.
+ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions
create event e_53 on schedule every 5 second ends (select s1 from ttx) do drop table t;
-ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions.
+ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions
drop event if exists e_16;
drop procedure if exists p_16;
create event e_16 on schedule every 1 second do set @a=5;
@@ -266,7 +271,7 @@ begin
call p22830_wait();
select 123;
end|
-ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions.
+ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions
create event e22830_1 on schedule every 1 hour do
begin
call p22830_wait();
@@ -366,6 +371,7 @@ SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
event_name definer
e1 mysqltest_u1@localhost
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;
event_name definer
@@ -390,6 +396,8 @@ CREATE DEFINER=root@localhost EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
DROP EVENT e1;
ERROR HY000: Unknown event 'e1'
+disconnect conn1;
+connection default;
DROP USER mysqltest_u1@localhost;
SET GLOBAL EVENT_SCHEDULER= OFF;
SET @save_time_zone= @@TIME_ZONE;
@@ -455,32 +463,32 @@ e3 +00:00 CREATE DEFINER=`root`@`localhost` EVENT `e3` ON SCHEDULE EVERY 1 DAY
The following should fail, and nothing should be altered.
ALTER EVENT e1 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
ENDS '1999-01-02 00:00:00';
-ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future.
+ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future
ALTER EVENT e1 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
ENDS '1999-01-02 00:00:00' DISABLE;
-ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future.
+ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future
The following should give warnings, and nothing should be created.
CREATE EVENT e4 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
ENDS '1999-01-02 00:00:00'
DO
SELECT 1;
Warnings:
-Note 1588 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation.
+Note 1588 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation
CREATE EVENT e4 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
ENDS '1999-01-02 00:00:00' DISABLE
DO
SELECT 1;
Warnings:
-Note 1588 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation.
+Note 1588 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation
CREATE EVENT e4 ON SCHEDULE AT '1999-01-01 00:00:00' DO
SELECT 1;
Warnings:
-Note 1588 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation.
+Note 1588 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation
CREATE EVENT e4 ON SCHEDULE AT '1999-01-01 00:00:00' DISABLE
DO
SELECT 1;
Warnings:
-Note 1588 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation.
+Note 1588 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
events_test e1 root@localhost +05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
@@ -586,7 +594,7 @@ Grants for evtest1@localhost
GRANT USAGE ON *.* TO 'evtest1'@'localhost' IDENTIFIED BY PASSWORD '*3170F3644E31580C25DE4A08F4C07CC9A2D40C32'
GRANT SELECT, INSERT ON `test`.* TO 'evtest1'@'localhost'
GRANT SELECT, INSERT, CREATE, EVENT ON `events_test`.* TO 'evtest1'@'localhost'
-connection e1;
+connect e1,localhost,evtest1,ev1,events_test,$MASTER_MYPORT,$MASTER_MYSOCK;
CREATE EVENT ev_sched_1823 ON SCHEDULE EVERY 2 SECOND
DO BEGIN
SET AUTOCOMMIT = 0;
@@ -615,6 +623,7 @@ Sleep 4 seconds
SELECT COUNT(*) > @row_cnt AS "Expect 0" FROM events_test.event_log;
Expect 0
0
+disconnect e1;
DROP EVENT events_test.ev_sched_1823;
DROP TABLE events_test.event_log;
SET GLOBAL event_scheduler = OFF;
@@ -640,9 +649,7 @@ GRANT EVENT ON *.* TO mysqltest_u1@localhost;
SET GLOBAL READ_ONLY = 1;
-#
-# Connection: u1_con (mysqltest_u1@localhost/events_test).
-#
+connect u1_con,localhost,mysqltest_u1,,events_test;
CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
@@ -653,9 +660,7 @@ ERROR HY000: The MariaDB server is running with the --read-only option so it can
DROP EVENT e1;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
-#
-# Connection: root_con (root@localhost/events_test).
-#
+connect root_con,localhost,root,,events_test;
CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1;
@@ -665,9 +670,7 @@ DROP EVENT e1;
SET GLOBAL READ_ONLY = 0;
-#
-# Connection: u1_con (mysqltest_u1@localhost/test).
-#
+connection u1_con;
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;
@@ -682,9 +685,7 @@ event_name last_executed IS NULL definer
e1 1 mysqltest_u1@localhost
e2 1 mysqltest_u1@localhost
-#
-# Connection: root_con (root@localhost/events_test).
-#
+connection root_con;
SET GLOBAL READ_ONLY = 1;
@@ -714,9 +715,9 @@ DROP EVENT e2;
SET GLOBAL READ_ONLY = 0;
-#
-# Connection: default
-#
+disconnect u1_con;
+disconnect root_con;
+connection default;
DROP USER mysqltest_u1@localhost;
diff --git a/mysql-test/r/events_grant.result b/mysql-test/r/events_grant.result
index 0fb589dfba5..a054e58494b 100644
--- a/mysql-test/r/events_grant.result
+++ b/mysql-test/r/events_grant.result
@@ -12,6 +12,7 @@ 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;
+connect ev_con1,localhost,ev_test,,events_test2;
select "NEW CONNECTION";
NEW CONNECTION
NEW CONNECTION
@@ -52,9 +53,12 @@ events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLE
"This should show us no events:";
SHOW EVENTS FROM test LIKE '%';
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
+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;
"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;
@@ -70,9 +74,11 @@ EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_
def events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
def events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
def events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
+connection default;
CREATE DATABASE events_test2;
USE events_test2;
CREATE EVENT five_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
+connection ev_con1;
"Should see 4 events - one, two, three & five"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
@@ -80,7 +86,9 @@ def events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND
def events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
def events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
def events_test2 five_event root@localhost SQL SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
+connection default;
REVOKE EVENT ON events_test2.* FROM ev_test@localhost;
+connection ev_con1;
USE test;
"Should see 3 events - one, two & three"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
@@ -95,8 +103,10 @@ ALTER EVENT one_event ON SCHEDULE EVERY 10 SECOND;
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
def events_test one_event ev_test@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
+connection default;
USE events_test;
ALTER EVENT one_event COMMENT "comment";
+connection ev_con1;
"The definer should be root@localhost"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
@@ -106,16 +116,22 @@ ALTER EVENT one_event DO SELECT 12;
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
def events_test one_event ev_test@localhost SQL SELECT 12 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE comment
+connection default;
"make the definer again root@localhost"
ALTER EVENT one_event COMMENT "new comment";
+connection ev_con1;
"test DROP by another user"
DROP EVENT one_event;
+connection default;
"One event should not be there"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
def events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
def events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
def events_test2 five_event root@localhost SQL SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
+connection ev_con1;
+disconnect ev_con1;
+connection default;
DROP USER ev_test@localhost;
DROP DATABASE events_test2;
DROP DATABASE events_test;
diff --git a/mysql-test/r/events_slowlog.result b/mysql-test/r/events_slowlog.result
index 7de5925bc0f..be0a1e78d2a 100644
--- a/mysql-test/r/events_slowlog.result
+++ b/mysql-test/r/events_slowlog.result
@@ -6,7 +6,7 @@ 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);
-FOUND /update t1 set i=1/ in mysqld-slow.log
+FOUND 1 /update t1 set i=1/ in mysqld-slow.log
drop table t1;
set global event_scheduler= @event_scheduler_save;
set global slow_query_log= @slow_query_log_save;
diff --git a/mysql-test/r/events_stress.result b/mysql-test/r/events_stress.result
index 6015e7c53eb..1a91ff0f528 100644
--- a/mysql-test/r/events_stress.result
+++ b/mysql-test/r/events_stress.result
@@ -9,8 +9,11 @@ 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;
"In the second connection we create some events which won't be dropped till the end"
+connect conn3,localhost,event_user3,,events_conn3_db;
"In the second connection we create some events which won't be dropped till the end"
+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;
@@ -52,13 +55,21 @@ USE events_conn1_test2;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
COUNT(*)
50
+connection conn2;
DROP DATABASE events_conn2_db;
+connection conn3;
DROP DATABASE events_conn3_db;
+connection default;
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;
+disconnect conn2;
+connection conn3;
+disconnect conn3;
+connection default;
USE events_test;
DROP TABLE fill_it1;
DROP TABLE fill_it2;
diff --git a/mysql-test/r/events_trans_notembedded.result b/mysql-test/r/events_trans_notembedded.result
index fb68bc9ceab..324e28ddb62 100644
--- a/mysql-test/r/events_trans_notembedded.result
+++ b/mysql-test/r/events_trans_notembedded.result
@@ -6,6 +6,7 @@ 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;
select @@autocommit;
@@autocommit
@@ -41,6 +42,8 @@ a
OK: drop event: insufficient privileges
delete from t1;
commit work;
+disconnect conn1;
+connection default;
drop user mysqltest_user1@localhost;
drop database mysqltest_db2;
drop database events_test;
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index b3c33e3559a..6d73f1ac4d6 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -99,45 +99,45 @@ 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));
Warnings:
-Note 1831 Duplicate index `b_2`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_3`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_4`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_5`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_6`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_7`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_8`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_9`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_10`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_11`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_12`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_13`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_14`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_15`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_16`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_17`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_18`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_19`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_20`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_21`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_22`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_23`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_24`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_25`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_26`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_27`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_28`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_29`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_30`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_31`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_32`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_33`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_34`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_35`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_36`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_37`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_38`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_39`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `b_40`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `b_2`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_3`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_4`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_5`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_6`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_7`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_8`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_9`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_10`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_11`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_12`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_13`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_14`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_15`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_16`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_17`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_18`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_19`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_20`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_21`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_22`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_23`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_24`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_25`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_26`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_27`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_28`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_29`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_30`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_31`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_32`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_33`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_34`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_35`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_36`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_37`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_38`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_39`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `b_40`. This is deprecated and will be disallowed in a future release
INSERT INTO t2 VALUES (),(),();
EXPLAIN SELECT 1 FROM
(SELECT 1 FROM t2,t1 WHERE b < c GROUP BY 1 LIMIT 1) AS d2;
@@ -268,7 +268,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
-Note 1003 select (select 1 from `test`.`t2` where (`test`.`t2`.`d` = NULL)) AS `(SELECT 1 FROM t2 WHERE d = c)` from dual
+Note 1003 select (select 1 from `test`.`t2` where `test`.`t2`.`d` = NULL) AS `(SELECT 1 FROM t2 WHERE d = c)` from dual
DROP TABLE t1, t2;
#
# Bug#30302: Tables that were optimized away are printed in the
@@ -288,7 +288,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select 1 AS `f1`,`test`.`t2`.`f2` AS `f2` from `test`.`t2` where (`test`.`t2`.`f2` = 1)
+Note 1003 select 1 AS `f1`,`test`.`t2`.`f2` AS `f2` from `test`.`t2` where `test`.`t2`.`f2` = 1
drop table t1,t2;
#
# Bug #48419: another explain crash..
diff --git a/mysql-test/r/explain_json.result b/mysql-test/r/explain_json.result
index 9e5515f3cfa..db792f4f2b6 100644
--- a/mysql-test/r/explain_json.result
+++ b/mysql-test/r/explain_json.result
@@ -34,7 +34,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 10,
"filtered": 100,
- "attached_condition": "(t0.a < 3)"
+ "attached_condition": "t0.a < 3"
}
}
}
@@ -56,7 +56,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 10,
"filtered": 100,
- "attached_condition": "(t0.a is not null)"
+ "attached_condition": "t0.a is not null"
},
"table": {
"table_name": "t1",
@@ -88,7 +88,7 @@ EXPLAIN
"used_key_parts": ["a1"],
"rows": 5,
"filtered": 100,
- "index_condition": "(t2.a1 < 5)"
+ "index_condition": "t2.a1 < 5"
}
}
}
@@ -116,7 +116,7 @@ EXPLAIN
},
"rows": 2,
"filtered": 100,
- "attached_condition": "((t2.a1 = 1) or (t2.b1 = 2))"
+ "attached_condition": "t2.a1 = 1 or t2.b1 = 2"
}
}
}
@@ -144,7 +144,7 @@ EXPLAIN
},
"rows": 2,
"filtered": 100,
- "attached_condition": "((t2.a1 = 1) or ((t2.b1 = 2) and (t2.b2 = 3)))"
+ "attached_condition": "t2.a1 = 1 or t2.b1 = 2 and t2.b2 = 3"
}
}
}
@@ -173,7 +173,7 @@ EXPLAIN
},
"rows": 2,
"filtered": 100,
- "attached_condition": "(((t2.a1 = 1) and (t2.a2 = 1)) or ((t2.b1 = 2) and (t2.b2 = 1)))"
+ "attached_condition": "t2.a1 = 1 and t2.a2 = 1 or t2.b1 = 2 and t2.b2 = 1"
}
}
}
@@ -188,7 +188,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 10,
"filtered": 100,
- "attached_condition": "(t0.a is not null)"
+ "attached_condition": "t0.a is not null"
},
"table": {
"table_name": "t2",
@@ -302,7 +302,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 10,
"filtered": 100,
- "attached_condition": "(t1.b = t0.a)"
+ "attached_condition": "t1.b = t0.a"
}
}
}
@@ -322,7 +322,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 10,
"filtered": 100,
- "attached_condition": "((t0.a > (subquery#2)) or (t0.a < 3))"
+ "attached_condition": "t0.a > (subquery#2) or t0.a < 3"
},
"subqueries": [
{
@@ -335,7 +335,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 10,
"filtered": 100,
- "attached_condition": "(t1.b = t0.a)"
+ "attached_condition": "t1.b = t0.a"
}
}
}
@@ -360,7 +360,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 100,
"filtered": 100,
- "attached_condition": "(tbl1.b < 3)"
+ "attached_condition": "tbl1.b < 3"
},
"block-nl-join": {
"table": {
@@ -368,12 +368,12 @@ EXPLAIN
"access_type": "ALL",
"rows": 100,
"filtered": 100,
- "attached_condition": "(tbl2.b < 5)"
+ "attached_condition": "tbl2.b < 5"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
- "attached_condition": "(tbl2.a = tbl1.a)"
+ "attached_condition": "tbl2.a = tbl1.a"
}
}
}
@@ -411,7 +411,7 @@ EXPLAIN
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
- "attached_condition": "(t0.a < 3)"
+ "attached_condition": "t0.a < 3"
}
}
}
@@ -425,7 +425,7 @@ EXPLAIN
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
- "attached_condition": "(t0.a in (2,3,4))"
+ "attached_condition": "t0.a in (2,3,4)"
}
}
}
@@ -481,13 +481,14 @@ EXPLAIN
"access_type": "ALL",
"rows": 10,
"filtered": 100,
- "attached_condition": "(tbl.cnt > 0)",
+ "attached_condition": "tbl.cnt > 0",
"materialized": {
"query_block": {
"select_id": 2,
+ "having_condition": "cnt > 0",
"filesort": {
+ "sort_key": "t1.a",
"temporary_table": {
- "function": "buffer",
"table": {
"table_name": "t1",
"access_type": "ALL",
@@ -513,7 +514,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 10,
"filtered": 100,
- "attached_condition": "(tbl2.a is not null)"
+ "attached_condition": "tbl2.a is not null"
},
"table": {
"table_name": "<derived2>",
@@ -525,13 +526,13 @@ EXPLAIN
"ref": ["test.tbl2.a"],
"rows": 2,
"filtered": 100,
- "attached_condition": "(tbl1.cnt = tbl2.a)",
+ "attached_condition": "tbl1.cnt = tbl2.a",
"materialized": {
"query_block": {
"select_id": 2,
"filesort": {
+ "sort_key": "t1.a",
"temporary_table": {
- "function": "buffer",
"table": {
"table_name": "t1",
"access_type": "ALL",
@@ -559,7 +560,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 10,
"filtered": 100,
- "attached_condition": "(t1.a is not null)"
+ "attached_condition": "t1.a is not null"
},
"table": {
"table_name": "<subquery2>",
@@ -576,7 +577,6 @@ EXPLAIN
"query_block": {
"select_id": 2,
"temporary_table": {
- "function": "buffer",
"table": {
"table_name": "t1",
"access_type": "ALL",
@@ -674,7 +674,7 @@ EXPLAIN
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
- "attached_condition": "((t1.b = t2.b) and (t1.a = t2.a))"
+ "attached_condition": "t1.b = t2.b and t1.a = t2.a"
}
}
}
@@ -711,7 +711,7 @@ EXPLAIN
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
- "attached_condition": "((t1.b = t2.b) and (t1.a = t2.a))"
+ "attached_condition": "t1.b = t2.b and t1.a = t2.a"
}
}
}
@@ -739,7 +739,7 @@ EXPLAIN
"used_key_parts": ["a"],
"rows": 1,
"filtered": 100,
- "index_condition": "(t1.a < 3)",
+ "index_condition": "t1.a < 3",
"mrr_type": "Rowid-ordered scan"
}
}
@@ -792,14 +792,14 @@ EXPLAIN
"used_key_parts": ["a"],
"rows": 2,
"filtered": 100,
- "attached_condition": "(not(<in_optimizer>(outer_t1.a,<exists>(subquery#2))))",
+ "attached_condition": "!<in_optimizer>(outer_t1.a,<exists>(subquery#2))",
"using_index": true
},
"subqueries": [
{
"query_block": {
"select_id": 2,
- "having_condition": "trigcond(<is_not_null_test>(t1.a))",
+ "having_condition": "trigcond(t1.a is null)",
"full-scan-on-null_key": {
"table": {
"table_name": "t1",
@@ -811,7 +811,7 @@ EXPLAIN
"ref": ["func"],
"rows": 2,
"filtered": 100,
- "attached_condition": "trigcond(((<cache>(outer_t1.a) = t1.a) or isnull(t1.a)))",
+ "attached_condition": "trigcond(<cache>(outer_t1.a) = t1.a or t1.a is null)",
"using_index": true
}
},
@@ -825,7 +825,7 @@ EXPLAIN
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
- "attached_condition": "(t2.b <> outer_t1.a)"
+ "attached_condition": "t2.b <> outer_t1.a"
}
}
}
@@ -849,7 +849,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "const_condition": "<not>(<in_optimizer>(20000,(<max>(subquery#2) >= 20000)))",
+ "const_condition": "<not>(<in_optimizer>(20000,<max>(subquery#2) >= 20000))",
"table": {
"table_name": "t0",
"access_type": "ALL",
@@ -876,7 +876,7 @@ EXPLAIN
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
- "attached_condition": "(tbl2.b = tbl1.b)"
+ "attached_condition": "tbl2.b = tbl1.b"
}
}
}
@@ -902,7 +902,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 2,
"filtered": 100,
- "attached_condition": "(not(<in_optimizer>(t1.a,t1.a in (subquery#2))))"
+ "attached_condition": "!<in_optimizer>(t1.a,t1.a in (subquery#2))"
},
"subqueries": [
{
@@ -1030,10 +1030,10 @@ Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
explain select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index
+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 65 Using where; Using index for group-by (scanning)
explain format=json select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
EXPLAIN
{
@@ -1041,14 +1041,14 @@ EXPLAIN
"select_id": 1,
"table": {
"table_name": "t1",
- "access_type": "index",
- "key": "idx_t1_2",
+ "access_type": "range",
+ "key": "idx_t1_1",
"key_length": "147",
"used_key_parts": ["a1", "a2", "b"],
- "rows": 128,
+ "rows": 17,
"filtered": 100,
- "attached_condition": "((t1.b = 'a') and (t1.a2 >= 'b'))",
- "using_index": true
+ "attached_condition": "t1.b = 'a' and t1.a2 >= 'b'",
+ "using_index_for_group_by": true
}
}
}
@@ -1059,14 +1059,14 @@ EXPLAIN
"select_id": 1,
"table": {
"table_name": "t1",
- "access_type": "index",
+ "access_type": "range",
"key": "idx_t1_1",
"key_length": "163",
"used_key_parts": ["a1", "a2", "b", "c"],
- "rows": 128,
+ "rows": 65,
"filtered": 100,
- "attached_condition": "((t1.b = 'a') and (t1.c = 'i121') and (t1.a2 >= 'b'))",
- "using_index": true
+ "attached_condition": "t1.b = 'a' and t1.c = 'i121' and t1.a2 >= 'b'",
+ "using_index_for_group_by": "scanning"
}
}
}
@@ -1086,7 +1086,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 2,
"filtered": 100,
- "attached_condition": "(t1.a = _latin1'\xDF')"
+ "attached_condition": "t1.a = _latin1'\xDF'"
}
}
}
@@ -1106,7 +1106,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 2,
"filtered": 100,
- "attached_condition": "(case when convert(t1.a using utf8) = <cache>((_utf8'a' collate utf8_bin)) then NULL else t1.a end)"
+ "attached_condition": "(case when convert(t1.a using utf8) = <cache>(_utf8'a' collate utf8_bin) then NULL else t1.a end)"
}
}
}
@@ -1130,10 +1130,10 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "having_condition": "(TOP > t2.a)",
+ "having_condition": "TOP > t2.a",
"filesort": {
+ "sort_key": "t2.a",
"temporary_table": {
- "function": "buffer",
"table": {
"table_name": "t2",
"access_type": "ALL",
@@ -1151,8 +1151,8 @@ EXPLAIN
"query_block": {
"select_id": 1,
"filesort": {
+ "sort_key": "t2.a",
"temporary_table": {
- "function": "buffer",
"table": {
"table_name": "t2",
"access_type": "ALL",
@@ -1181,8 +1181,8 @@ EXPLAIN
"query_block": {
"select_id": 1,
"filesort": {
+ "sort_key": "t2.a",
"temporary_table": {
- "function": "buffer",
"table": {
"table_name": "t2",
"access_type": "ALL",
@@ -1323,7 +1323,7 @@ EXPLAIN
"ref": ["test.t1.a"],
"rows": 1,
"filtered": 100,
- "attached_condition": "(trigcond(isnull(t2.pk)) and trigcond(trigcond((t1.a is not null))))",
+ "attached_condition": "trigcond(t2.pk is null) and trigcond(trigcond(t1.a is not null))",
"using_index": true,
"not_exists": true
}
@@ -1361,7 +1361,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
- "attached_condition": "(trigcond(isnull(t2.pk)) and trigcond(trigcond((t1.a is not null))))",
+ "attached_condition": "trigcond(t2.pk is null) and trigcond(trigcond(t1.a is not null))",
"using_index": true,
"not_exists": true
}
@@ -1380,13 +1380,12 @@ EXPLAIN
"query_block": {
"select_id": 1,
"temporary_table": {
- "function": "buffer",
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"filtered": 100,
- "attached_condition": "(t1.a is not null)"
+ "attached_condition": "t1.a is not null"
},
"table": {
"table_name": "t2",
@@ -1422,7 +1421,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
- "attached_condition": "(t1.a is not null)"
+ "attached_condition": "t1.a is not null"
},
"table": {
"table_name": "t2",
@@ -1474,7 +1473,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 10,
"filtered": 100,
- "attached_condition": "(t3.a is not null)"
+ "attached_condition": "t3.a is not null"
},
"block-nl-join": {
"table": {
@@ -1487,7 +1486,7 @@ EXPLAIN
"ref": ["test.t3.a"],
"rows": 1,
"filtered": 100,
- "index_condition_bka": "((t4.b + 1) <= (t3.b + 1))"
+ "index_condition_bka": "t4.b + 1 <= t3.b + 1"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
@@ -1513,7 +1512,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
- "attached_condition": "(t3.a is not null)"
+ "attached_condition": "t3.a is not null"
},
"block-nl-join": {
"table": {
@@ -1530,7 +1529,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
- "index_condition_bka": "((t4.b + 1) <= (t3.b + 1))"
+ "index_condition_bka": "t4.b + 1 <= t3.b + 1"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
@@ -1543,3 +1542,103 @@ ANALYZE
set optimizer_switch=@tmp_optimizer_switch;
set join_cache_level=@tmp_join_cache_level;
drop table t1,t2,t3,t4;
+#
+# MDEV-9652: EXPLAIN FORMAT=JSON should show outer_ref_cond
+#
+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;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ },
+ "subqueries": [
+ {
+ "expression_cache": {
+ "state": "uninitialized",
+ "query_block": {
+ "select_id": 2,
+ "outer_ref_condition": "t0.a < 5",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t1.b < t0.a"
+ }
+ }
+ }
+ }
+ ]
+ }
+}
+drop table t0,t1;
+#
+# MDEV-10844: EXPLAIN FORMAT=JSON doesn't show order direction for filesort
+#
+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
+{
+ "query_block": {
+ "select_id": 1,
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "t1.a, t1.b desc",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+explain format=json select * from t1 order by a desc, b desc;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "t1.a desc, t1.b desc",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+explain format=json select * from t1 order by a desc, b ;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "t1.a desc, t1.b",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+drop table t1;
diff --git a/mysql-test/r/explain_json_format_partitions.result b/mysql-test/r/explain_json_format_partitions.result
index fa2b5681120..5d7fdbc4864 100644
--- a/mysql-test/r/explain_json_format_partitions.result
+++ b/mysql-test/r/explain_json_format_partitions.result
@@ -18,7 +18,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 10,
"filtered": 100,
- "attached_condition": "(t1.a in (2,3,4))"
+ "attached_condition": "t1.a in (2,3,4)"
}
}
}
@@ -39,7 +39,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 30,
- "attached_condition": "(t1.a in (2,3,4))"
+ "attached_condition": "t1.a in (2,3,4)"
}
}
}
@@ -59,7 +59,7 @@ ANALYZE
"r_rows": 10,
"r_filtered": 30,
"r_total_time_ms": "REPLACED",
- "attached_condition": "(t1.a in (2,3,4))"
+ "attached_condition": "t1.a in (2,3,4)"
}
}
}
@@ -79,7 +79,7 @@ ANALYZE
"r_rows": 10,
"r_filtered": 0,
"r_total_time_ms": "REPLACED",
- "attached_condition": "(t1.a in (20,30,40))"
+ "attached_condition": "t1.a in (20,30,40)"
}
}
}
diff --git a/mysql-test/r/explain_json_innodb.result b/mysql-test/r/explain_json_innodb.result
index cc389c63bda..8cec65642b4 100644
--- a/mysql-test/r/explain_json_innodb.result
+++ b/mysql-test/r/explain_json_innodb.result
@@ -31,7 +31,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 1,
"filtered": 100,
- "attached_condition": "((tbl_alias1.column_name_2 is not null) and (tbl_alias1.column_name_1 is not null))"
+ "attached_condition": "tbl_alias1.column_name_2 is not null and tbl_alias1.column_name_1 is not null"
},
"table": {
"table_name": "tbl_alias2",
@@ -46,7 +46,7 @@ EXPLAIN
],
"rows": 1,
"filtered": 100,
- "attached_condition": "(tbl_alias2.c = tbl_alias1.column_name_2)",
+ "attached_condition": "tbl_alias2.c = tbl_alias1.column_name_2",
"using_index": true
}
}
diff --git a/mysql-test/r/explain_slowquerylog.result b/mysql-test/r/explain_slowquerylog.result
index 8acbdc69a4c..2b350cf04ff 100644
--- a/mysql-test/r/explain_slowquerylog.result
+++ b/mysql-test/r/explain_slowquerylog.result
@@ -12,11 +12,14 @@ drop table t0;
#
# MDEV-5047 virtual THD::~THD(): Assertion `status_var.memory_used == 0' fails on disconnect
#
+connect con1,localhost,root,,;
ALTER TABLE nonexisting ENABLE KEYS;
ERROR 42S02: Table 'test.nonexisting' doesn't exist
SHOW WARNINGS;
Level Code Message
Error 1146 Table 'test.nonexisting' doesn't exist
+disconnect con1;
+connection default;
SELECT 1;
1
1
diff --git a/mysql-test/r/failed_auth_3909.result b/mysql-test/r/failed_auth_3909.result
index 0a757e2cee2..d0fd2c41221 100644
--- a/mysql-test/r/failed_auth_3909.result
+++ b/mysql-test/r/failed_auth_3909.result
@@ -1,7 +1,7 @@
optimize table mysql.user;
Table Op Msg_type Msg_text
mysql.user optimize status OK
-insert mysql.user (user,plugin) values ('foo','bar'),('bar','bar'),('baz','bar');
+insert ignore mysql.user (user,plugin) values ('foo','bar'),('bar','bar'),('baz','bar');
Warnings:
Warning 1364 Field 'ssl_cipher' doesn't have a default value
Warning 1364 Field 'x509_issuer' doesn't have a default value
@@ -9,10 +9,13 @@ Warning 1364 Field 'x509_subject' doesn't have a default value
Warning 1364 Field 'authentication_string' doesn't have a default value
flush privileges;
connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET);
+connect fail,localhost,u1;
ERROR HY000: Plugin 'bar' is not loaded
connect(localhost,u2,,test,MASTER_PORT,MASTER_SOCKET);
+connect fail,localhost,u2;
ERROR 28000: Access denied for user 'u2'@'localhost' (using password: NO)
connect(localhost,u2,password,test,MASTER_PORT,MASTER_SOCKET);
+connect fail,localhost,u2,password;
ERROR 28000: Access denied for user 'u2'@'localhost' (using password: YES)
ERROR HY000: Plugin 'bar' is not loaded
ERROR 28000: Access denied for user 'u2'@'localhost' (using password: NO)
diff --git a/mysql-test/r/failed_auth_unixsocket.result b/mysql-test/r/failed_auth_unixsocket.result
index 3cf58ca5bec..680d3b48a33 100644
--- a/mysql-test/r/failed_auth_unixsocket.result
+++ b/mysql-test/r/failed_auth_unixsocket.result
@@ -1,6 +1,7 @@
update mysql.user set plugin='unix_socket';
flush privileges;
connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET);
+connect fail,localhost,$USER;
ERROR HY000: Plugin 'unix_socket' is not loaded
ERROR HY000: Plugin 'unix_socket' is not loaded
install plugin unix_socket soname 'auth_socket.so';
diff --git a/mysql-test/r/features.result b/mysql-test/r/features.result
index 52650d118b3..c6d1a6b0bac 100644
--- a/mysql-test/r/features.result
+++ b/mysql-test/r/features.result
@@ -3,6 +3,7 @@ set sql_mode="";
flush status;
show status like "feature%";
Variable_name Value
+Feature_check_constraint 0
Feature_delay_key_write 0
Feature_dynamic_columns 0
Feature_fulltext 0
@@ -11,6 +12,7 @@ Feature_locale 0
Feature_subquery 0
Feature_timezone 0
Feature_trigger 0
+Feature_window_functions 0
Feature_xml 0
#
# Feature GIS
@@ -116,7 +118,7 @@ select @a;
1
SHOW TRIGGERS IN test like 't1';
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
-trg INSERT t1 set @a:=1 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+trg INSERT t1 set @a:=1 BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
drop trigger trg;
drop table t1;
show status like "%trigger%";
@@ -158,3 +160,9 @@ drop table t1;
show status like "feature_delay_key_write";
Variable_name Value
Feature_delay_key_write 2
+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";
+Variable_name Value
+Feature_check_constraint 2
diff --git a/mysql-test/r/filesort_debug.result b/mysql-test/r/filesort_debug.result
index 13912ac8756..4aa40592be7 100644
--- a/mysql-test/r/filesort_debug.result
+++ b/mysql-test/r/filesort_debug.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("Sort aborted.*");
SET @old_debug= @@session.debug;
#
# Bug#36022 please log more information about "Sort aborted" queries
@@ -18,17 +19,21 @@ DROP FUNCTION f1;
# Bug #11747102
# 30771: LOG MORE INFO ABOUT THREADS KILL'D AND SORT ABORTED MESSAGES
#
-# connection 1
+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);
SET DEBUG_SYNC='filesort_start SIGNAL filesort_started WAIT_FOR filesort_killed';
# Sending: (not reaped since connection is killed later)
SELECT * FROM t1 ORDER BY f1 ASC, f0;
-# connection 2
+connection con2;
SET DEBUG_SYNC='now WAIT_FOR filesort_started';
KILL @id;
SET DEBUG_SYNC='now SIGNAL filesort_killed';
-# connection default
+connection default;
+disconnect con1;
+disconnect con2;
SET DEBUG_SYNC= "RESET";
DROP TABLE t1;
#
diff --git a/mysql-test/r/flush-innodb-notembedded.result b/mysql-test/r/flush-innodb-notembedded.result
index 911abfe6daf..0b63a7b3519 100644
--- a/mysql-test/r/flush-innodb-notembedded.result
+++ b/mysql-test/r/flush-innodb-notembedded.result
@@ -8,26 +8,31 @@ 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;
-# Connection con1 as user1
+connect con1, localhost, user1;
FLUSH TABLE db1.t1 FOR EXPORT;
UNLOCK TABLES;
-# Connection default
-# Connection con1 as user2
+disconnect con1;
+connection default;
+connect con1, localhost, user2;
FLUSH TABLE db1.t1 FOR EXPORT;
ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
-# Connection default
-# Connection con1 as user3
+disconnect con1;
+connection default;
+connect con1, localhost, user3;
FLUSH TABLE db1.t1 FOR EXPORT;
ERROR 42000: Access denied for user 'user3'@'localhost' to database 'db1'
-# Connection default
-# Connection con1 as user4
+disconnect con1;
+connection default;
+connect con1, localhost, user4;
FLUSH TABLE db1.t1 FOR EXPORT;
ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
-# Connection default
-# Connection con1 as user5
+disconnect con1;
+connection default;
+connect con1, localhost, user5;
FLUSH TABLE db1.t1 FOR EXPORT;
ERROR 42000: SELECT command denied to user 'user5'@'localhost' for table 't1'
-# Connection default
+disconnect con1;
+connection default;
DROP USER user1@localhost, user2@localhost, user3@localhost,
user4@localhost, user5@localhost;
DROP TABLE db1.t1;
diff --git a/mysql-test/r/flush-innodb.result b/mysql-test/r/flush-innodb.result
index d596ffbbd51..bd09f0d62dc 100644
--- a/mysql-test/r/flush-innodb.result
+++ b/mysql-test/r/flush-innodb.result
@@ -71,26 +71,26 @@ DROP VIEW v1;
#
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) engine= InnoDB;
CREATE TABLE t2 (a INT) engine= InnoDB;
-# Connection con1
+connect con1, localhost, root;
START TRANSACTION;
INSERT INTO t1 VALUES (1, 1);
-# Connection default
+connection default;
# Should be blocked
# Sending:
FLUSH TABLES t1 FOR EXPORT;
-# Connection con1
+connection con1;
COMMIT;
-# Connection default
+connection default;
# Reaping: FLUSH TABLES t1 FOR EXPORT
-# Connection con1
+connection con1;
# Should not be blocked
INSERT INTO t2 VALUES (1);
# Should be blocked
# Sending:
INSERT INTO t1 VALUES (2, 2);
-# Connection default
+connection default;
UNLOCK TABLES;
-# Connection con1
+connection con1;
# Reaping: INSERT INTO t1 VALUES (2, 2);
# Test 3: Read operations should not be affected.
#
@@ -99,17 +99,17 @@ SELECT * FROM t1;
a b
1 1
2 2
-# Connection default
+connection default;
# Should not be blocked
FLUSH TABLES t1 FOR EXPORT;
-# Connection con1
+connection con1;
COMMIT;
# Should not be blocked
SELECT * FROM t1;
a b
1 1
2 2
-# Connection default
+connection default;
UNLOCK TABLES;
# Test 4: Blocked by DDL, blocks DDL.
#
@@ -118,39 +118,40 @@ SELECT * FROM t1;
a b
1 1
2 2
-# Connection con2
+connect con2, localhost, root;
# Sending:
ALTER TABLE t1 ADD INDEX i1(b);
-# Connection con1
+connection con1;
# Should be blocked
FLUSH TABLE t1 FOR EXPORT;
-# Connection default
+connection default;
COMMIT;
-# Connection con2
+connection con2;
# Reaping ALTER TABLE ...
-# Connection con1
+connection con1;
# Reaping FLUSH TABLE t1 FOR EXPORT
UNLOCK TABLES;
-# Connection default
+connection default;
FLUSH TABLE t1 FOR EXPORT;
-# Connection con2
+connection con2;
# Should be blocked
DROP TABLE t1;
-# Connection default
+connection default;
UNLOCK TABLES;
-# Connection con2
+connection con2;
# Reaping DROP TABLE t1
-# Connection default
+disconnect con2;
+connection default;
DROP TABLE t2;
# Test 5: Compatibilty with FLUSH TABLES WITH READ LOCK
#
CREATE TABLE t1(a INT) engine= InnoDB;
FLUSH TABLES WITH READ LOCK;
-# Connection con1
+connection con1;
# This should not block
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
-# Connection default
+connection default;
UNLOCK TABLES;
DROP TABLE t1;
# Test 6: Unsupported storage engines.
@@ -159,8 +160,9 @@ CREATE TABLE t1(a INT) engine= MEMORY;
FLUSH TABLE t1 FOR EXPORT;
ERROR HY000: Storage engine MEMORY of the table `test`.`t1` doesn't have this option
DROP TABLE t1;
-# Connection con1
-# Connection defalt
+connection con1;
+disconnect con1;
+connection default;
# Test 7: Check privileges required.
# in flush-innodb-notembedded.test
# Test 8: FLUSH TABLE <table_list> FOR EXPORT is incompatible
@@ -169,38 +171,39 @@ DROP TABLE t1;
#
CREATE TABLE t1 (a INT) engine= InnoDB;
CREATE TABLE t2 (a INT) engine= InnoDB;
-# Connection con1
+connect con1, localhost, root;
FLUSH TABLE t1 FOR EXPORT;
-# Connection default
+connection default;
# This should not block
FLUSH TABLE t2 FOR EXPORT;
UNLOCK TABLES;
# This should block
# Sending:
FLUSH TABLE t1 FOR EXPORT;
-# Connection con1
+connection con1;
UNLOCK TABLES;
-# Connection default
+connection default;
# Reaping: FLUSH TABLE t1 FOR EXPORT
UNLOCK TABLES;
# Test 9: LOCK TABLES ... READ is not affected
#
LOCK TABLE t1 READ;
-# Connection con1
+connection con1;
# Should not block
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
-# Connection default
+connection default;
UNLOCK TABLES;
FLUSH TABLE t1 FOR EXPORT;
-# Connection con1
+connection con1;
# Should not block
LOCK TABLE t1 READ;
UNLOCK TABLES;
-# Connection default
+connection default;
UNLOCK TABLES;
-# Connection con1
-# Connection default
+connection con1;
+disconnect con1;
+connection default;
DROP TABLE t1, t2;
# Test 10: Lock is released if transaction is started after doing
# 'flush table..' in same session
@@ -217,30 +220,30 @@ UNLOCK TABLES;
DROP TABLE t1;
# Test 11: Test 'flush table with fully qualified table names
# and with syntax local/NO_WRITE_TO_BINLOG
-# Connection con1
-# Connection default
+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
+connection con1;
# Should be blocked
# Sending:
FLUSH LOCAL TABLES t1 FOR EXPORT;
-# Connection default
+connection default;
UNLOCK TABLE;
-# Connection con1
+connection con1;
# Reaping: FLUSH LOCAL TABLES t1 FOR EXPORT
SELECT * FROM t1 ORDER BY i;
i
100
200
-# Connection default
+connection default;
# Should be blocked
# Sending:
FLUSH NO_WRITE_TO_BINLOG TABLES test.t1 FOR EXPORT;
-# Connection con1
+connection con1;
UNLOCK TABLES;
-# Connection default
+connection default;
# Reaping: FLUSH NO_WRITE_TO_BINLOG TABLES test.t1 FOR EXPORT
SELECT * FROM t1 ORDER BY i;
i
@@ -250,7 +253,7 @@ UNLOCK TABLE;
DROP TABLE t1;
# Test 12: Active transaction get committed if user execute
# "FLUSH TABLE ... FOR EXPORT" or "LOCK TABLE.."
-# Connection default
+connection default;
CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
INSERT INTO t1 VALUES (100),(200);
START TRANSACTION;
@@ -278,7 +281,7 @@ UNLOCK TABLES;
DROP TABLE t1;
# Test 13: Verify "FLUSH TABLE ... FOR EXPORT" and "LOCK TABLE.."
# in same session
-# Connection default
+connection default;
CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
# Lock table
LOCK TABLES test.t1 WRITE;
@@ -294,6 +297,9 @@ ERROR HY000: Can't execute the given command because you have active locked tabl
LOCK TABLES test.t1 WRITE;
UNLOCK TABLES;
DROP TABLE t1;
+connection con1;
+disconnect con1;
+connection default;
# Reset innodb_file_per_table
SET GLOBAL innodb_file_per_table= @old_innodb_file_per_table;
# End of 5.6 tests
diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result
index b64351045bf..2c651b71a66 100644
--- a/mysql-test/r/flush.result
+++ b/mysql-test/r/flush.result
@@ -1,27 +1,42 @@
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
drop table if exists t1,t2;
drop database if exists mysqltest;
create temporary table t1(n int not null primary key);
create table t2(n int);
insert into t2 values(3);
+connection con1;
select * from t1;
n
3
+connection con2;
flush tables with read lock and disable checkpoint;
drop table t2;
ERROR HY000: Can't execute the query because you have a conflicting read lock
+connection con1;
drop table t2;
+connection con2;
unlock tables;
+connection con1;
+connection con1;
create database mysqltest;
create table mysqltest.t1(n int);
insert into mysqltest.t1 values (23);
flush tables with read lock;
+connection con2;
drop database mysqltest;
+connection con1;
select * from mysqltest.t1;
n
23
unlock tables;
+connection con2;
+connection con1;
create table t1 (n int);
flush tables with read lock;
+disconnect con1;
+connection con2;
insert into t1 values (345);
select * from t1;
n
@@ -54,10 +69,22 @@ unlock tables;
drop table t1, t2, t3;
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;
flush tables with read lock;
+connection con3;
insert into t2 values(1);
+connection con1;
unlock tables;
+disconnect con1;
+connection con2;
+disconnect con2;
+connection con3;
+disconnect con3;
+connection default;
drop table t1, t2;
drop table if exists t1, t2;
set session low_priority_updates=1;
@@ -77,7 +104,10 @@ ERROR HY000: Can't execute the given command because you have active locked tabl
unlock tables;
drop table t1, t2;
set session low_priority_updates=default;
+connect con1,localhost,root,,;
select benchmark(200, (select sin(1))) > 1000;
+disconnect con1;
+connection default;
End of 5.0 tests
set @old_general_log= @@general_log;
set @old_read_only= @@read_only;
@@ -189,13 +219,14 @@ insert into t3 (a) values (2);
#
# III. Concurrent tests.
#
-# --> connection default
+connect con1,localhost,root,,;
#
# Check that flush tables <list> with read lock
# does not affect non-locked tables.
+connection default;
#
flush tables t1 with read lock;
-# --> connection con1;
+connection con1;
select * from t1;
a
1
@@ -203,7 +234,7 @@ select * from t2;
a
1
insert into t2 (a) values (3);
-# --> connection default;
+connection default;
unlock tables;
#
# Check that "FLUSH TABLES <list> WITH READ LOCK" is
@@ -211,13 +242,13 @@ unlock tables;
# Vice versa it is not true, since tables read-locked by
# "FLUSH TABLES <list> WITH READ LOCK" can't be flushed.
flush tables with read lock;
-# --> connection con1;
+connection con1;
flush table t1 with read lock;
select * from t1;
a
1
unlock tables;
-# --> connection default;
+connection default;
unlock tables;
#
# Check that FLUSH TABLES t1 WITH READ LOCK
@@ -225,32 +256,34 @@ unlock tables;
# WITH READ LOCK.
#
flush table t1 with read lock;
-# --> connection con1
+connection con1;
flush table t2 with read lock;
unlock tables;
-# --> connection default
+connection default;
unlock tables;
#
# Check that FLUSH TABLES t1 WITH READ LOCK
# does not conflict with SET GLOBAL read_only=1.
#
set global read_only=1;
-# connection con1
+connection con1;
flush table t1 with read lock;
unlock tables;
-# connection default
+connection default;
set global read_only=0;
#
# Check that it's possible to read-lock
# tables locked with FLUSH TABLE <list> WITH READ LOCK.
#
flush tables t1, t2 with read lock;
-# connection con1
+connection con1;
lock table t1 read, t2 read;
unlock tables;
-# connection default
+connection default;
unlock tables;
-# --> connection con1
+connection con1;
+disconnect con1;
+connection default;
drop table t1, t2, t3;
#
# Bug#51710 FLUSH TABLES <view> WITH READ LOCK kills the server
@@ -309,33 +342,35 @@ drop table t1;
# transactions unnecessarily.
#
drop table if exists t1;
-# --> conection default
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection default;
create table t1 (a int);
begin;
select * from t1;
a
-# --> connection con1
+connection con1;
#
# Issue a LOCK TABLE t1 READ. We could use HANDLER t1 OPEN
# or a long-running select -- anything that
# prevents FLUSH TABLE t1 from immediate completion would do.
#
lock table t1 read;
-# --> connection con2
+connection con2;
#
# FLUSH TABLE expels the table definition from the cache.
# Sending 'flush table t1'...
flush table t1;
-# --> connection default
+connection default;
# Let flush table sync in.
select * from t1;
-# --> connection con1
+connection con1;
select * from t1;
a
unlock tables;
-# --> connection con2
+connection con2;
# Reaping 'flush table t1'...
-# --> connection default
+connection default;
# Reaping 'select * from t1'...
a
commit;
@@ -345,33 +380,35 @@ commit;
begin;
select * from t1;
a
-# --> connection con1
+connection con1;
#
# Issue a LOCK TABLE t1 READ.
#
lock table t1 read;
-# --> connection con2
+connection con2;
#
# FLUSH TABLES expels the table definition from the cache.
# Sending 'flush tables'...
flush tables;
-# --> connection default
+connection default;
# Let flush table sync in.
select * from t1;
-# --> connection con1
+connection con1;
select * from t1;
a
unlock tables;
-# --> connection con2
+connection con2;
# Reaping 'flush tables'...
-# --> connection default
+connection default;
# Reaping 'select * from t1'...
a
commit;
# Cleanup
-# --> connection con1
-# --> connection con2
-# --> connection default
+connection con1;
+disconnect con1;
+connection con2;
+disconnect con2;
+connection default;
drop table t1;
#
# Test for bug #55273 "FLUSH TABLE tm WITH READ LOCK for Merge table
@@ -428,28 +465,36 @@ drop tables tm, t1, t2;
# FLUSH TABLES WITH READ LOCK".
#
drop table if exists t1, t2;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection default;
create table t1 (i int);
create table t2 (i int);
handler t1 open;
-# Switching to connection 'con1'.
+connection con1;
# Sending:
flush tables with read lock;
-# Switching to connection 'con2'.
+connection con2;
# Wait until FTWRL starts waiting for 't1' to be closed.
-# Switching to connection 'default'.
+connection default;
# The below statement should not cause deadlock.
# Sending:
insert into t2 values (1);
-# Switching to connection 'con2'.
+connection con2;
# Wait until INSERT starts to wait for FTWRL to go away.
-# Switching to connection 'con1'.
+connection con1;
# FTWRL should be able to continue now.
# Reap FTWRL.
unlock tables;
-# Switching to connection 'default'.
+connection default;
# Reap INSERT.
handler t1 close;
# Cleanup.
+connection con1;
+disconnect con1;
+connection con2;
+disconnect con2;
+connection default;
drop tables t1, t2;
#
# Bug#57649 FLUSH TABLES under FLUSH TABLES <list> WITH READ LOCK leads
@@ -481,12 +526,13 @@ 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;
-# Switching to connection 'con1'.
+connect con1, localhost, root;
# The below FLUSH TABLES WITH READ LOCK should succeed and
# should not be blocked by the transaction in default connection.
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
-# Switching to connection 'default'.
+disconnect con1;
+connection default;
COMMIT;
DROP TABLE t1;
#
diff --git a/mysql-test/r/flush2.result b/mysql-test/r/flush2.result
index ff5d8755f01..a66b0d5c688 100644
--- a/mysql-test/r/flush2.result
+++ b/mysql-test/r/flush2.result
@@ -4,6 +4,8 @@ show variables like 'log_bin%';
Variable_name Value
log_bin OFF
log_bin_basename
+log_bin_compress OFF
+log_bin_compress_min_len 256
log_bin_index
log_bin_trust_function_creators ON
show variables like 'relay_log%';
@@ -20,6 +22,8 @@ show variables like 'log_bin%';
Variable_name Value
log_bin OFF
log_bin_basename
+log_bin_compress OFF
+log_bin_compress_min_len 256
log_bin_index
log_bin_trust_function_creators ON
show variables like 'relay_log%';
diff --git a/mysql-test/r/flush_block_commit.result b/mysql-test/r/flush_block_commit.result
index 7062d05c2d7..e9684e5aa46 100644
--- a/mysql-test/r/flush_block_commit.result
+++ b/mysql-test/r/flush_block_commit.result
@@ -1,50 +1,50 @@
# Save the initial number of concurrent sessions
-# Establish connection con1 (user=root)
-# Establish connection con2 (user=root)
-# Establish connection con3 (user=root)
-# Switch to connection con1
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connect con3,localhost,root,,;
+connection con1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT) ENGINE=innodb;
BEGIN;
INSERT INTO t1 VALUES(1);
-# Switch to connection con2
+connection con2;
FLUSH TABLES WITH READ LOCK;
-# Switch to connection con1
+connection con1;
# Sending:
COMMIT;
-# Switch to connection con2
+connection con2;
# Wait until COMMIT gets blocked.
# Verify that 'con1' was blocked and data did not move.
SELECT * FROM t1;
a
UNLOCK TABLES;
-# Switch to connection con1
+connection con1;
# Reaping COMMIT
-# Switch to connection con1
+connection con1;
BEGIN;
SELECT * FROM t1 FOR UPDATE;
a
1
-# Switch to connection con2
+connection con2;
BEGIN;
SELECT * FROM t1 FOR UPDATE;
-# Switch to connection con3
+connection con3;
FLUSH TABLES WITH READ LOCK;
-# Switch to connection con1
+connection con1;
COMMIT;
-# Switch to connection con2
+connection con2;
a
1
COMMIT;
-# Switch to connection con3
+connection con3;
UNLOCK TABLES;
-# Switch to connection con2
+connection con2;
COMMIT;
-# Switch to connection con1
+connection con1;
BEGIN;
INSERT INTO t1 VALUES(10);
FLUSH TABLES WITH READ LOCK;
-# Switch to connection con2
+connection con2;
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
BEGIN;
@@ -57,7 +57,10 @@ Database Create Database
test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
COMMIT;
# Cleanup
-# Switch to connection default and close connections con1, con2, con3
+connection default;
+disconnect con1;
+disconnect con2;
+disconnect con3;
# We commit open transactions when we disconnect: only then we can
# drop the table.
DROP TABLE t1;
diff --git a/mysql-test/r/flush_block_commit_notembedded.result b/mysql-test/r/flush_block_commit_notembedded.result
index 130146bf252..7dd6410ac70 100644
--- a/mysql-test/r/flush_block_commit_notembedded.result
+++ b/mysql-test/r/flush_block_commit_notembedded.result
@@ -1,30 +1,36 @@
# Save the initial number of concurrent sessions
-# Establish connection con1 (user=root)
-# Establish connection con2 (user=root)
-# Switch to connection con1
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
CREATE TABLE t1 (a INT) ENGINE=innodb;
RESET MASTER;
SET AUTOCOMMIT=0;
SELECT 1;
1
1
-# Switch to connection con2
+connection con2;
FLUSH TABLES WITH READ LOCK;
include/show_binlog_events.inc
-# Switch to connection con1
+connection con1;
INSERT INTO t1 VALUES (1);
-# Switch to connection con2
+connection con2;
include/show_binlog_events.inc
UNLOCK TABLES;
-# Switch to connection con1
+connection con1;
DROP TABLE t1;
SET AUTOCOMMIT=1;
create table t1 (a int) engine=innodb;
+connection con1;
flush tables with read lock;
+connection con2;
begin;
insert into t1 values (1);;
+connection con1;
unlock tables;
+connection con2;
commit;
drop table t1;
-# Switch to connection default and close connections con1 and con2
+connection default;
+disconnect con1;
+disconnect con2;
# Wait till all disconnects are completed
diff --git a/mysql-test/r/flush_read_lock.result b/mysql-test/r/flush_read_lock.result
index 260edf8e51d..55c31ae8d12 100644
--- a/mysql-test/r/flush_read_lock.result
+++ b/mysql-test/r/flush_read_lock.result
@@ -85,6 +85,10 @@ insert into t1_temp values (1);
return 0;
end|
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;
#
# Test compatibility of FLUSH TABLES WITH READ LOCK
# with various statements.
@@ -186,34 +190,34 @@ unlock tables;
# COMMIT is blocked by active FTWRL in another
# connection.
#
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
begin;
-# Switching to connection 'con1'.
+connection con1;
unlock tables;
-# Switching to connection 'default'.
+connection default;
# Do some work so ROLLBACK is not a no-op.
insert into t3_trans values (1);
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
rollback;
-# Switching to connection 'con1'.
+connection con1;
unlock tables;
-# Switching to connection 'default'.
+connection default;
begin;
# Do some work so COMMIT is not a no-op.
insert into t3_trans values (1);
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
# Send:
commit;
-# Switching to connection 'con1'.
+connection con1;
# Wait until COMMIT is blocked.
unlock tables;
-# Switching to connection 'default'.
+connection default;
# Reap COMMIT.
delete from t3_trans;
#
@@ -223,18 +227,18 @@ 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';
commit;
-# Switching to connection 'con1'.
+connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
-# Switching to connection 'con2'.
+connection con2;
# Wait until FTWRL is blocked.
set debug_sync='now SIGNAL go';
-# Switching to connection 'default'.
+connection default;
# Reap COMMIT.
-# Switching to connection 'con1'.
+connection con1;
# Reap FTWRL.
unlock tables;
-# Switching to connection 'default'.
+connection default;
delete from t3_trans;
set debug_sync= "RESET";
# We don't run similar test for BEGIN and ROLLBACK as
@@ -447,30 +451,30 @@ unlock tables;
# Check that active FTWRL in another connection
# blocks EXECUTE which changes data.
#
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
execute stmt1 ;
-# Switching to connection 'con1'.
+connection con1;
# Check that EXECUTE is blocked.
unlock tables;
-# Switching to connection 'default'.
+connection default;
# Reap EXECUTE.
set debug_sync='RESET';
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
execute stmt1; ;
-# Switching to connection 'con1'.
+connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
-# Switching to connection 'con2'.
+connection con2;
# Wait until FTWRL is blocked.
set debug_sync='now SIGNAL go';
-# Switching to connection 'default'.
+connection default;
# Reap EXECUTE.
-# Switching to connection 'con1'.
+connection con1;
# Reap FTWRL.
unlock tables;
-# Switching to connection 'default'.
+connection default;
set debug_sync= "RESET";
delete from t1_base;
deallocate prepare stmt1;
@@ -631,20 +635,19 @@ drop trigger t1_bi;
# Check that FTWRL statements can be run while FTWRL
# is active in another connection.
#
-# Switching to connection 'con1'.
flush tables with read lock;
# The second FTWRL in a row is allowed at the moment.
# It does not make much sense as it does only flush.
flush tables with read lock;
unlock tables;
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
flush tables with read lock;
unlock tables;
-# Switching to connection 'con1'.
+connection con1;
unlock tables;
-# Switching to connection 'default'.
+connection default;
#
# 14.2) FLUSH TABLES <list> WITH READ LOCK is not blocked by
# active FTWRL. But since the latter keeps tables open
@@ -654,25 +657,25 @@ flush tables with read lock;
# It does not make much sense though.
flush tables t1_base, t2_base with read lock;
unlock tables;
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
flush tables t1_base, t2_base with read lock;
unlock tables;
-# Switching to connection 'con1'.
+connection con1;
unlock tables;
-# Switching to connection 'default'.
+connection default;
flush tables t1_base, t2_base with read lock;
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'con2'.
+connection con2;
# Wait until FTWRL is blocked.
-# Switching to connection 'default'.
+connection default;
unlock tables;
-# Switching to connection 'con1'.
+connection con1;
# Reap FTWRL.
unlock tables;
-# Switching to connection 'default'.
+connection default;
#
# 14.3) FLUSH TABLES is compatible with FTWRL.
Success: Was able to run 'flush tables' under FTWRL.
@@ -711,16 +714,16 @@ unlock tables;
# Check that HANDLER statements can be run while FTWRL
# is active in another connection.
#
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
handler t1_base open;
handler t1_base read first;
i
handler t1_base close;
-# Switching to connection 'con1'.
+connection con1;
unlock tables;
-# Switching to connection 'default'.
+connection default;
#
# 17) HELP statement is compatible with FTWRL.
#
@@ -767,24 +770,24 @@ unlock tables;
# Check that KILL statements can be run while FTWRL
# is active in another connection.
#
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
kill query @id;
ERROR 70100: Query execution was interrupted
-# Switching to connection 'con1'.
+connection con1;
unlock tables;
-# Switching to connection 'default'.
+connection default;
# 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';
kill query @id;
-# Switching to connection 'con1'.
+connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
unlock tables;
set debug_sync='now SIGNAL go';
-# Switching to connection 'default'.
+connection default;
# Reap KILL.
ERROR 70100: Query execution was interrupted
set debug_sync='RESET';
@@ -814,14 +817,14 @@ flush tables with read lock;
lock tables t1_base read;
unlock tables;
#
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
lock tables t1_base read;
unlock tables;
-# Switching to connection 'con1'.
+connection con1;
unlock tables;
-# Switching to connection 'default'.
+connection default;
#
# 21.b) LOCK TABLES WRITE on a base table is disallowed
# under FTWRL and should be blocked by active FTWRL.
@@ -830,14 +833,14 @@ lock tables t1_base write;
ERROR HY000: Can't execute the query because you have a conflicting read lock
unlock tables;
#
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
lock tables t1_base write ;
-# Switching to connection 'con1'.
+connection con1;
# Check that LOCK TABLES WRITE is blocked.
unlock tables;
-# Switching to connection 'default'.
+connection default;
# Reap LOCK TABLES WRITE
unlock tables;
#
@@ -848,14 +851,14 @@ flush tables with read lock;
lock tables t1_temp write;
unlock tables;
#
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
lock tables t1_temp write;
unlock tables;
-# Switching to connection 'con1'.
+connection con1;
unlock tables;
-# Switching to connection 'default'.
+connection default;
#
# 22) OPTIMIZE TABLE statement.
#
@@ -868,14 +871,14 @@ test.t1_base optimize Error Can't execute the query because you have a conflicti
test.t1_base optimize error Corrupt
unlock tables;
#
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
optimize table t1_base;
-# Switching to connection 'con1'.
+connection con1;
# Check that OPTIMIZE TABLE is blocked.
unlock tables;
-# Switching to connection 'default'.
+connection default;
# Reap OPTIMIZE TABLE
Table Op Msg_type Msg_text
test.t1_base optimize status OK
@@ -919,32 +922,32 @@ commit;
# Check that these statements are not blocked by
# active FTWRL in another connection.
#
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
begin;
-# Switching to connection 'con1'.
+connection con1;
unlock tables;
-# Switching to connection 'default'.
+connection default;
# Do some changes to avoid SAVEPOINT and friends
# being almost no-ops.
insert into t3_trans values (1);
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
savepoint sv1;
-# Switching to connection 'con1'.
+connection con1;
unlock tables;
-# Switching to connection 'default'.
+connection default;
insert into t3_trans values (2);
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
rollback to savepoint sv1;
release savepoint sv1;
-# Switching to connection 'con1'.
+connection con1;
unlock tables;
-# Switching to connection 'default'.
+connection default;
rollback;
# Check that these statements don't block FTWRL in
# another connection.
@@ -955,31 +958,31 @@ insert into t3_trans values (1);
set debug_sync='RESET';
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
savepoint sv1;
-# Switching to connection 'con1'.
+connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
unlock tables;
set debug_sync='now SIGNAL go';
-# Switching to connection 'default'.
+connection default;
# Reap SAVEPOINT
insert into t3_trans values (2);
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
rollback to savepoint sv1;
-# Switching to connection 'con1'.
+connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
unlock tables;
set debug_sync='now SIGNAL go';
-# Switching to connection 'default'.
+connection default;
# Reap ROLLBACK TO SAVEPOINT
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
release savepoint sv1;
-# Switching to connection 'con1'.
+connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
unlock tables;
set debug_sync='now SIGNAL go';
-# Switching to connection 'default'.
+connection default;
# Reap RELEASE SAVEPOINT
rollback;
set debug_sync= "RESET";
@@ -1009,14 +1012,14 @@ test.t1_base repair Error Can't execute the query because you have a conflicting
test.t1_base repair error Corrupt
unlock tables;
#
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
repair table t1_base;
-# Switching to connection 'con1'.
+connection con1;
# Check that REPAIR TABLE is blocked.
unlock tables;
-# Switching to connection 'default'.
+connection default;
# Reap REPAIR TABLE
Table Op Msg_type Msg_text
test.t1_base repair status OK
@@ -1155,25 +1158,25 @@ delete from t3_temp_trans;
# SET AUTOCOMMIT=1 is blocked by active FTWRL in
# another connection.
#
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
set autocommit= 0;
-# Switching to connection 'con1'.
+connection con1;
unlock tables;
-# Switching to connection 'default'.
+connection default;
# Do some work so implicit commit in SET AUTOCOMMIT=1
# is not a no-op.
insert into t3_trans values (1);
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
# Send:
set autocommit= 1;
-# Switching to connection 'con1'.
+connection con1;
# Wait until SET AUTOCOMMIT=1 is blocked.
unlock tables;
-# Switching to connection 'default'.
+connection default;
# Reap SET AUTOCOMMIT=1.
delete from t3_trans;
#
@@ -1183,18 +1186,18 @@ 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';
set autocommit= 1;
-# Switching to connection 'con1'.
+connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
-# Switching to connection 'con2'.
+connection con2;
# Wait until FTWRL is blocked.
set debug_sync='now SIGNAL go';
-# Switching to connection 'default'.
+connection default;
# Reap SET AUTOCOMMIT=1.
-# Switching to connection 'con1'.
+connection con1;
# Reap FTWRL.
unlock tables;
-# Switching to connection 'default'.
+connection default;
delete from t3_trans;
set debug_sync= "RESET";
#
@@ -1308,36 +1311,37 @@ unlock tables;
# Check that XA non-COMMIT statements are not and COMMIT is
# blocked by active FTWRL in another connection
#
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
xa start 'test1';
-# Switching to connection 'con1'.
+connection con1;
unlock tables;
-# Switching to connection 'default'.
+connection default;
insert into t3_trans values (1);
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
xa end 'test1';
xa prepare 'test1';
xa rollback 'test1';
-# Switching to connection 'con1'.
+connection con1;
unlock tables;
-# Switching to connection 'default'.
+connection default;
xa start 'test1';
insert into t3_trans values (1);
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
+connection default;
xa end 'test1';
xa prepare 'test1';
# Send:
xa commit 'test1';;
-# Switching to connection 'con1'.
+connection con1;
# Wait until XA COMMIT is blocked.
unlock tables;
-# Switching to connection 'default'.
+connection default;
# Reap XA COMMIT.
delete from t3_trans;
#
@@ -1349,18 +1353,18 @@ xa prepare 'test1';
set debug_sync='RESET';
set debug_sync='trans_xa_commit_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
xa commit 'test1';
-# Switching to connection 'con1'.
+connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
-# Switching to connection 'con2'.
+connection con2;
# Wait until FTWRL is blocked.
set debug_sync='now SIGNAL go';
-# Switching to connection 'default'.
+connection default;
# Reap XA COMMIT.
-# Switching to connection 'con1'.
+connection con1;
# Reap FTWRL.
unlock tables;
-# Switching to connection 'default'.
+connection default;
delete from t3_trans;
set debug_sync= "RESET";
#
@@ -1413,14 +1417,14 @@ Table Op Msg_type Msg_text
test.t3_trans analyze status OK
unlock tables;
#
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
analyze table t3_trans;
-# Switching to connection 'con1'.
+connection con1;
# Check that ANALYZE TABLE is blocked.
unlock tables;
-# Switching to connection 'default'.
+connection default;
# Reap ANALYZE TABLE
Table Op Msg_type Msg_text
test.t3_trans analyze status OK
@@ -1478,28 +1482,28 @@ Success: Was able to run FTWRL while 'alter table t3_temp_trans add column c1 in
begin;
insert into t3_trans values (1);
#
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
check table t1_base;
-# Switching to connection 'con1'.
+connection con1;
# Check that CHECK TABLE is blocked.
unlock tables;
-# Switching to connection 'default'.
+connection default;
# Reap CHECK TABLE
Table Op Msg_type Msg_text
test.t1_base check status OK
begin;
delete from t3_trans;
#
-# Switching to connection 'con1'.
+connection con1;
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
alter table t1_temp add column c1 int;
-# Switching to connection 'con1'.
+connection con1;
# Check that ALTER TABLE is blocked.
unlock tables;
-# Switching to connection 'default'.
+connection default;
# Reap ALTER TABLE
alter table t1_temp drop column c1;
#
@@ -1512,10 +1516,10 @@ alter table t1_temp drop column c1;
begin;
insert into t1_base values (1);
insert into t3_trans values (1);
-# Switching to connection 'con1'.
+connection con1;
# The below FTWRL should not be blocked by transaction in 'default'.
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
# Transaction still is able to read even with FTWRL active in another
# connection.
select * from t1_base;
@@ -1526,9 +1530,9 @@ j
select * from t3_trans;
i
1
-# Switching to connection 'con1'.
+connection con1;
unlock tables;
-# Switching to connection 'default'.
+connection default;
commit;
delete from t1_base;
delete from t3_trans;
@@ -1541,25 +1545,25 @@ delete from t3_trans;
set debug_sync='RESET';
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
insert into t1_base values (1);
-# Switching to connection 'con1'.
+connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
-# Switching to connection 'con2'.
+connection con2;
# Wait until FTWRL is blocked.
# Try to run another INSERT and see that it is blocked.
insert into t2_base values (1);;
-# Switching to connection 'con3'.
+connection con3;
# Wait until new INSERT is blocked.
# Unblock INSERT in the first connection.
set debug_sync='now SIGNAL go';
-# Switching to connection 'default'.
+connection default;
# Reap first INSERT.
-# Switching to connection 'con1'.
+connection con1;
# Reap FTWRL.
unlock tables;
-# Switching to connection 'con2'.
+connection con2;
# Reap second INSERT.
-# Switching to connection 'default'.
+connection default;
set debug_sync= "RESET";
delete from t1_base;
delete from t2_base;
@@ -1573,23 +1577,23 @@ delete from t2_base;
# only taken when there were such modifications.
flush tables with read lock;
-# Switching to connection 'con1'.
+connection con1;
# The below FTWRL should not be blocked by transaction in 'default'.
flush tables with read lock;
-# Switching to connection 'default'.
+connection default;
select * from t1_base;
i
select * from t3_trans;
i
commit;
-# Switching to connection 'con1'.
+connection con1;
select * from t1_base;
i
select * from t3_trans;
i
commit;
unlock tables;
-# Switching to connection 'default'.
+connection default;
unlock tables;
#
# Check how FLUSH TABLE WITH READ LOCK is handled for MERGE tables.
@@ -1669,4 +1673,7 @@ 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;
diff --git a/mysql-test/r/flush_read_lock_kill.result b/mysql-test/r/flush_read_lock_kill.result
index 8453d26cbea..05836b04524 100644
--- a/mysql-test/r/flush_read_lock_kill.result
+++ b/mysql-test/r/flush_read_lock_kill.result
@@ -1,8 +1,11 @@
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
DROP TABLE IF EXISTS t1;
SET DEBUG_SYNC= 'RESET';
CREATE TABLE t1 (kill_id INT) engine = InnoDB;
INSERT INTO t1 VALUES(connection_id());
-# Switching to connection 'default'.
+connection default;
# Start transaction.
BEGIN;
INSERT INTO t1 VALUES(connection_id());
@@ -11,13 +14,13 @@ INSERT INTO t1 VALUES(connection_id());
SET DEBUG_SYNC='ha_commit_trans_after_acquire_commit_lock SIGNAL acquired WAIT_FOR go';
# Sending:
COMMIT;
-# Switching to 'con1'.
+connection con1;
# Wait till COMMIT acquires protection against global read
# lock and pauses.
SET DEBUG_SYNC='now WAIT_FOR acquired';
# Sending:
FLUSH TABLES WITH READ LOCK;
-# Switching to 'con2'.
+connection con2;
SELECT ((@id := kill_id) - kill_id) FROM t1 LIMIT 1;
((@id := kill_id) - kill_id)
0
@@ -25,14 +28,15 @@ SELECT ((@id := kill_id) - kill_id) FROM t1 LIMIT 1;
# to active COMMIT
# Kill connection 'con1'.
KILL CONNECTION @id;
-# Switching to 'con1'.
+connection con1;
# Try to reap FLUSH TABLES WITH READ LOCK,
# it fail due to killed statement and connection.
Got one of the listed errors
-# Switching to 'con2'.
+connection con2;
# Resume COMMIT.
SET DEBUG_SYNC='now SIGNAL go';
-# Switching to 'default'.
+connection default;
# Reaping COMMIT.
+disconnect con2;
DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/r/flush_table.result b/mysql-test/r/flush_table.result
index 2b0ee1cb205..c56d63bd849 100644
--- a/mysql-test/r/flush_table.result
+++ b/mysql-test/r/flush_table.result
@@ -12,25 +12,35 @@ Table Op Msg_type Msg_text
test.t1 check status OK
unlock tables;
lock table t1 write;
+connect locker,localhost,root,,test;
+connection locker;
lock table t1 read;
+connection default;
flush table t1;
select * from t1;
a
1
unlock tables;
+connection locker;
unlock tables;
+connection default;
lock table t1 write;
+connection locker;
lock table t1 write;
+connection default;
flush table t1;
select * from t1;
a
1
unlock tables;
+connection locker;
unlock tables;
select * from t1;
a
1
+connection default;
drop table t1;
+disconnect locker;
create table t1(table_id char(20) primary key);
create table t2(table_id char(20) primary key);
insert into t1 values ('test.t1');
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index df484363acc..6ca2c5c0aac 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -249,7 +249,7 @@ show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ticket` int(11) DEFAULT NULL,
- `inhalt` text,
+ `inhalt` text DEFAULT NULL,
KEY `tig` (`ticket`),
FULLTEXT KEY `tix` (`inhalt`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -379,6 +379,7 @@ t collation(t)
SELECT t, collation(t),FORMAT(MATCH t AGAINST ('Osnabruck'),6) FROM t1 WHERE MATCH t AGAINST ('Osnabruck');
t collation(t) FORMAT(MATCH t AGAINST ('Osnabruck'),6)
aus Osnabrück utf8_general_ci 1.591140
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 modify t varchar(200) collate latin1_german2_ci not null;
Warnings:
Warning 1366 Incorrect string value: '\xD0\xAD\xD1\x82\xD0\xBE...' for column 't' at row 3
@@ -759,7 +760,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select <expr_cache><'foo'>(<in_optimizer>('foo',<exists>(select `test`.`t1`.`f` from `test`.`t1` where ((<cache>(convert('foo' using latin1)) = `test`.`t1`.`f`) or isnull(`test`.`t1`.`f`)) having <is_not_null_test>(`test`.`t1`.`f`)))) AS `f1`,(match `test`.`t1`.`f` against ('qux' in boolean mode)) AS `f2` from `test`.`t1`
+Note 1003 select <expr_cache><'foo'>(<in_optimizer>('foo',<exists>(select `test`.`t1`.`f` from `test`.`t1` where <cache>(convert('foo' using latin1)) = `test`.`t1`.`f` or `test`.`t1`.`f` is null having `test`.`t1`.`f` is null))) AS `f1`,(match `test`.`t1`.`f` against ('qux' in boolean mode)) AS `f2` from `test`.`t1`
drop table t1;
#
# End of 5.5 tests
diff --git a/mysql-test/r/fulltext_distinct.result b/mysql-test/r/fulltext_distinct.result
index 7fd42fab646..de0668ff28c 100644
--- a/mysql-test/r/fulltext_distinct.result
+++ b/mysql-test/r/fulltext_distinct.result
@@ -8,8 +8,6 @@ KEY kt(tag),
KEY kv(value(15)),
FULLTEXT KEY kvf(value)
) ENGINE=MyISAM;
-Warnings:
-Warning 1101 BLOB/TEXT column 'value' can't have a default value
CREATE TABLE t2 (
id_t2 mediumint unsigned NOT NULL default '0',
id_t1 mediumint unsigned NOT NULL default '0',
diff --git a/mysql-test/r/fulltext_update.result b/mysql-test/r/fulltext_update.result
index 4a615c88fdd..5d3f95b318c 100644
--- a/mysql-test/r/fulltext_update.result
+++ b/mysql-test/r/fulltext_update.result
@@ -9,8 +9,6 @@ name VARCHAR(80) DEFAULT '' NOT NULL,
FULLTEXT(url,description,shortdesc,longdesc),
PRIMARY KEY(gnr)
);
-Warnings:
-Warning 1101 BLOB/TEXT column 'longdesc' can't have a default value
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
diff --git a/mysql-test/r/func_analyse.result b/mysql-test/r/func_analyse.result
index 2c300559a32..1e78e603bca 100644
--- a/mysql-test/r/func_analyse.result
+++ b/mysql-test/r/func_analyse.result
@@ -19,7 +19,7 @@ test.t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
create table t2 select * from t1 procedure analyse();
-ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'procedure analyse()' at line 1
drop table t1;
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
ERROR HY000: Incorrect usage of PROCEDURE and subquery
@@ -120,7 +120,7 @@ CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1),(2);
# should not crash
CREATE TABLE t2 SELECT 1 FROM t1, t1 t3 GROUP BY t3.a PROCEDURE ANALYSE();
-ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE()' at line 1
DROP TABLE t1;
End of 5.0 tests
#
@@ -149,3 +149,25 @@ Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_
test.t2.f2 1 1 1 1 0 0 1.0000 0.0000 ENUM('1') NOT NULL
DROP TABLE t1, t2;
End of 5.1 tests
+#
+# Start of 10.2 tests
+#
+(SELECT 1 FROM DUAL PROCEDURE ANALYSE());
+Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
+1 1 1 1 1 0 0 1.0000 0.0000 ENUM('1') NOT NULL
+((SELECT 1 FROM DUAL PROCEDURE ANALYSE()));
+Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
+1 1 1 1 1 0 0 1.0000 0.0000 ENUM('1') NOT NULL
+SELECT * FROM t1 UNION SELECT * FROM t1 PROCEDURE analyse();
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE analyse()' at line 1
+#
+# MDEV-10030 sql_yacc.yy: Split table_expression and remove PROCEDURE from create_select, select_paren_derived, select_derived2, query_specification
+#
+SELECT * FROM (SELECT * FROM t1 PROCEDURE ANALYSE());
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE())' at line 1
+SELECT * FROM t1 NATURAL JOIN (SELECT * FROM t2 PROCEDURE ANALYSE());
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE())' at line 1
+SELECT (SELECT 1 FROM t1 PROCEDURE ANALYSE()) FROM t2;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE()) FROM t2' at line 1
+SELECT ((SELECT 1 FROM t1 PROCEDURE ANALYSE())) FROM t2;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE())) FROM t2' at line 1
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result
index 1f15c74ff0d..6857813559f 100644
--- a/mysql-test/r/func_compress.result
+++ b/mysql-test/r/func_compress.result
@@ -1,4 +1,6 @@
set global max_allowed_packet=1048576;
+connect conn1,localhost,root,,;
+connection conn1;
select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
@test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa '
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -12,7 +14,7 @@ explain extended select uncompress(compress(@test_compress_string));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select uncompress(compress((@`test_compress_string`))) AS `uncompress(compress(@test_compress_string))`
+Note 1003 select uncompress(compress(@`test_compress_string`)) AS `uncompress(compress(@test_compress_string))`
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
1
@@ -20,7 +22,7 @@ explain extended select uncompressed_length(compress(@test_compress_string))=len
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select (uncompressed_length(compress((@`test_compress_string`))) = length((@`test_compress_string`))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
+Note 1003 select uncompressed_length(compress(@`test_compress_string`)) = length(@`test_compress_string`) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
select uncompressed_length(compress(@test_compress_string));
uncompressed_length(compress(@test_compress_string))
117
@@ -70,12 +72,15 @@ Warning 1259 ZLIB: Input data corrupted
Warning 1256 Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted)
drop table t1;
set @@global.max_allowed_packet=1048576*100;
+connect newconn, localhost, root,,;
select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null;
compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: XXX
Warning 1292 Truncated incorrect DOUBLE value: XXX
+disconnect newconn;
+connection default;
set @@global.max_allowed_packet=default;
create table t1(a blob);
insert into t1 values(NULL), (compress('a'));
@@ -156,6 +161,8 @@ UNCOMPRESS(CAST(0 AS BINARY(5)))
NULL
Warnings:
Warning 1259 ZLIB: Input data corrupted
+disconnect conn1;
+connection default;
set global max_allowed_packet=default;
#
# End of 5.5 tests
@@ -184,3 +191,26 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-10134 Add full support for DEFAULT
+#
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text DEFAULT NULL,
+ `b` blob DEFAULT compress(`a`),
+ `bl` int(11) DEFAULT uncompressed_length(`b`),
+ `a1` text DEFAULT uncompress(`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (REPEAT('a',100));
+SELECT bl, a1 FROM t1;
+bl a1
+100 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/func_crypt.result b/mysql-test/r/func_crypt.result
index 2be8ab6c5dd..aaa6aa61eae 100644
--- a/mysql-test/r/func_crypt.result
+++ b/mysql-test/r/func_crypt.result
@@ -105,7 +105,7 @@ SELECT OLD_PASSWORD(c1), PASSWORD(c1) FROM t1;
OLD_PASSWORD(c1) PASSWORD(c1)
77023ffe214c04ff *82E58A2C08AAFE72C8EB523069CD8ADB33F78F58
DROP TABLE t1;
-End of 5.0 tests
+# End of 5.0 tests
#
# Start of 10.0 tests
#
@@ -201,6 +201,16 @@ f1
TEST
test
DROP TABLE t1;
-#
-# End of 10.1 tests
-#
+# Start of 10.2 tests
+CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(30) DEFAULT ENCRYPT(a,123));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(30) DEFAULT encrypt(`a`,123)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('hello');
+SELECT * FROM t1;
+a b
+hello 12NKz5XM5JeKI
+DROP TABLE t1;
diff --git a/mysql-test/r/func_date_add.result b/mysql-test/r/func_date_add.result
index 0258267b5ec..a6201a3c23f 100644
--- a/mysql-test/r/func_date_add.result
+++ b/mysql-test/r/func_date_add.result
@@ -153,3 +153,50 @@ c20 NULL
#
# End of 10.1 tests
#
+create or replace view v1 as select 3 & 20010101 + interval 2 day as x;
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 3 & 20010101 + interval 2 day AS `x` latin1 latin1_swedish_ci
+select 3 & 20010101 + interval 2 day, x from v1;
+3 & 20010101 + interval 2 day x
+3 3
+create or replace view v1 as select (3 & 20010101) + interval 2 day as x;
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (3 & 20010101) + interval 2 day AS `x` latin1 latin1_swedish_ci
+select (3 & 20010101) + interval 2 day, x from v1;
+(3 & 20010101) + interval 2 day x
+NULL NULL
+Warnings:
+Warning 1292 Incorrect datetime value: '1'
+Warning 1292 Incorrect datetime value: '1'
+create or replace view v1 as select 3 & (20010101 + interval 2 day) as x;
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 3 & 20010101 + interval 2 day AS `x` latin1 latin1_swedish_ci
+select 3 & (20010101 + interval 2 day), x from v1;
+3 & (20010101 + interval 2 day) x
+3 3
+create or replace view v1 as select 30 + 20010101 + interval 2 day as x;
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 30 + 20010101 + interval 2 day AS `x` latin1 latin1_swedish_ci
+select 30 + 20010101 + interval 2 day, x from v1;
+30 + 20010101 + interval 2 day x
+2001-02-02 2001-02-02
+create or replace view v1 as select (30 + 20010101) + interval 2 day as x;
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 30 + 20010101 + interval 2 day AS `x` latin1 latin1_swedish_ci
+select (30 + 20010101) + interval 2 day, x from v1;
+(30 + 20010101) + interval 2 day x
+2001-02-02 2001-02-02
+create or replace view v1 as select 30 + (20010101 + interval 2 day) as x;
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 30 + (20010101 + interval 2 day) AS `x` latin1 latin1_swedish_ci
+select 30 + (20010101 + interval 2 day), x from v1;
+30 + (20010101 + interval 2 day) x
+20010133 20010133
+drop view v1;
+End of 10.2 tests
diff --git a/mysql-test/r/func_default.result b/mysql-test/r/func_default.result
index 8f486d87d47..535be10da86 100644
--- a/mysql-test/r/func_default.result
+++ b/mysql-test/r/func_default.result
@@ -21,3 +21,14 @@ INSERT INTO t1 VALUES (1, 'one'), (2, 'two'), (3, 'three');
SELECT s, 32 AS mi FROM t1 GROUP BY s HAVING DEFAULT(mi) IS NULL;
ERROR HY000: Field 'mi' doesn't have a default value
DROP TABLE t1;
+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;
+default(a) default(b) default(c) default(d) default(e) default(f)
+1 2 foo bar 2001-01-01 10:20:30 2001-01-01 10:20:30.120000
+1 11 foo bar 2001-01-01 10:20:30 2001-01-01 10:20:30.120000
+drop table t1;
diff --git a/mysql-test/r/func_digest.result b/mysql-test/r/func_digest.result
index 6821c84d8d8..374d16ac687 100644
--- a/mysql-test/r/func_digest.result
+++ b/mysql-test/r/func_digest.result
@@ -1411,19 +1411,19 @@ LENGTH(SHA2( 'computed', 512 )) / 2 * 8 = 512
SET NAMES binary;
SELECT sha2('1',224);
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def sha2('1',224) 253 56 56 Y 128 31 63
+def sha2('1',224) 253 56 56 Y 128 39 63
sha2('1',224)
e25388fde8290dc286a6164fa2d97e551b53498dcbf7bc378eb1f178
SET NAMES utf8;
SELECT sha2('1',224);
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def sha2('1',224) 253 168 56 Y 0 31 33
+def sha2('1',224) 253 168 56 Y 0 39 33
sha2('1',224)
e25388fde8290dc286a6164fa2d97e551b53498dcbf7bc378eb1f178
SET NAMES latin1;
SELECT sha2('1',224);
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def sha2('1',224) 253 56 56 Y 0 31 8
+def sha2('1',224) 253 56 56 Y 0 39 8
sha2('1',224)
e25388fde8290dc286a6164fa2d97e551b53498dcbf7bc378eb1f178
#
@@ -1456,5 +1456,28 @@ SHA2(CONVERT('foo' USING latin1), 224)
0808f64e60d58979fcb676c96ec938270dea42445aeefcd3a4e6f8db
DEALLOCATE PREPARE stmt;
#
-# End of 10.1 tests
+# Start of 10.2 tests
+#
+#
+# MDEV-10134 Add full support for DEFAULT
+#
+CREATE TABLE t1 (
+a VARCHAR(30),
+b TEXT DEFAULT SHA(a),
+c TEXT DEFAULT SHA2(a,224)
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(30) DEFAULT NULL,
+ `b` text DEFAULT sha(`a`),
+ `c` text DEFAULT sha2(`a`,224)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('abc');
+SELECT * FROM t1;
+a b c
+abc a9993e364706816aba3e25717850c26c9cd0d89d 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7
+DROP TABLE t1;
+#
+# End of 10.2 tests
#
diff --git a/mysql-test/r/func_encrypt.result b/mysql-test/r/func_encrypt.result
index f5e03a90327..68c44231e43 100644
--- a/mysql-test/r/func_encrypt.result
+++ b/mysql-test/r/func_encrypt.result
@@ -203,8 +203,34 @@ SELECT * FROM t1 WHERE a=1 AND DES_ENCRYPT('test',a)=_latin1 'abc' COLLATE latin
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and (des_encrypt('test',`test`.`t1`.`a`) = 'abc'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and des_encrypt('test',`test`.`t1`.`a`) = 'abc'
DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-10134 Add full support for DEFAULT
+#
+CREATE TABLE t1 (
+a VARCHAR(30),
+b BLOB DEFAULT DES_ENCRYPT(a, 'passwd'),
+c TEXT DEFAULT DES_DECRYPT(b, 'passwd')
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(30) DEFAULT NULL,
+ `b` blob DEFAULT des_encrypt(`a`,'passwd'),
+ `c` text DEFAULT des_decrypt(`b`,'passwd')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('test');
+SELECT c FROM t1;
+c
+test
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index 9014450bef3..0c3d649a6bb 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -473,9 +473,9 @@ select collation(group_concat(a,_koi8r'test')) from t1;
collation(group_concat(a,_koi8r'test'))
cp1250_general_ci
select collation(group_concat(a,_koi8r 0xC1C2)) from t1;
-ERROR HY000: Illegal mix of collations (cp1250_general_ci,IMPLICIT) and (koi8r_general_ci,COERCIBLE) for operation 'group_concat'
+ERROR HY000: Illegal mix of collations (cp1250_general_ci,IMPLICIT) and (koi8r_general_ci,COERCIBLE) for operation 'group_concat('
select collation(group_concat(a,b)) from t1;
-ERROR HY000: Illegal mix of collations (cp1250_general_ci,IMPLICIT) and (koi8r_general_ci,IMPLICIT) for operation 'group_concat'
+ERROR HY000: Illegal mix of collations (cp1250_general_ci,IMPLICIT) and (koi8r_general_ci,IMPLICIT) for operation 'group_concat('
drop table t1;
drop table t2;
CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp850);
@@ -810,7 +810,7 @@ LENGTH( GROUP_CONCAT( DISTINCT a ) )
CREATE TABLE t3( a TEXT, b INT );
INSERT INTO t3 VALUES( REPEAT( 'a', 65534 ), 1 );
INSERT INTO t3 VALUES( REPEAT( 'a', 65535 ), 2 );
-INSERT INTO t3 VALUES( REPEAT( 'a', 65536 ), 3 );
+INSERT IGNORE INTO t3 VALUES( REPEAT( 'a', 65536 ), 3 );
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 1;
@@ -834,7 +834,7 @@ id group_concat(b.name)
2 óra,óra
drop table t1;
create table t1(a bit not null);
-insert into t1 values (), (), ();
+insert ignore into t1 values (), (), ();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select group_concat(distinct a) from t1;
@@ -1044,7 +1044,7 @@ DROP TABLE t1;
CREATE TABLE t1(f1 int);
INSERT INTO t1 values (0),(0);
SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t GROUP BY t.f1 ) d));
-ERROR 22007: Illegal non geometric '(select 1 from (select (1 = group_concat(`test`.`t1`.`f1` separator ',')) AS `1 IN (GROUP_CONCAT(t1.f1))` from `test`.`t1` join `test`.`t1` `t` group by `test`.`t`.`f1`) `d`)' value found during parsing
+ERROR 22007: Illegal non geometric '(select 1 from (select 1 = group_concat(`test`.`t1`.`f1` separator ',') AS `1 IN (GROUP_CONCAT(t1.f1))` from `test`.`t1` join `test`.`t1` `t` group by `test`.`t`.`f1`) `d`)' value found during parsing
DROP TABLE t1;
#
# Bug#58396 group_concat and explain extended are still crashy
@@ -1154,17 +1154,17 @@ CREATE TABLE t2 SELECT GROUP_CONCAT(f1 order by f2) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `GROUP_CONCAT(f1 order by f2)` mediumtext
+ `GROUP_CONCAT(f1 order by f2)` mediumtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 SELECT GROUP_CONCAT(UPPER(f1) ORDER BY f2) FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `GROUP_CONCAT(UPPER(f1) ORDER BY f2)` mediumtext
+ `GROUP_CONCAT(UPPER(f1) ORDER BY f2)` mediumtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-SET group_concat_max_len= DEFAULT;
+SET group_concat_max_len= 1024;
SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1;
LENGTH(GROUP_CONCAT(f1 ORDER BY f2))
1024
@@ -1200,3 +1200,57 @@ Warning 1260 Row 3 was cut by GROUP_CONCAT()
Warning 1260 Row 5 was cut by GROUP_CONCAT()
DROP TABLE t1;
SET group_concat_max_len= DEFAULT;
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-10124 Incorrect usage of CUBE/ROLLUP and ORDER BY with GROUP_CONCAT(a ORDER BY a)
+#
+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;
+a GROUP_CONCAT(a ORDER BY a)
+10 10
+20 20
+30 30
+NULL 10,20,30
+CREATE VIEW v1 AS
+SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP;
+SELECT * FROM v1;
+a GROUP_CONCAT(a ORDER BY a)
+10 10
+20 20
+30 30
+NULL 10,20,30
+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';
+a GROUP_CONCAT(a ORDER BY a)
+NULL 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;
+a GROUP_CONCAT(a ORDER BY a)
+NULL 10,20,30
+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;
+a GROUP_CONCAT(a ORDER BY a)
+NULL 10,20,30
+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;
+a GROUP_CONCAT(a ORDER BY a)
+NULL 10,20,30
+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');
+(SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30')
+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;
+Name_exp_1
+10,20,30
+DROP VIEW v1;
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index e0e870d1573..c4e991e8cbe 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1409,7 +1409,7 @@ EXPLAIN EXTENDED SELECT y FROM v1 GROUP BY v1.y;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort
Warnings:
-Note 1003 select (`test`.`t1`.`a` + 1) AS `y` from `test`.`t1` group by (`test`.`t1`.`a` + 1)
+Note 1003 select `test`.`t1`.`a` + 1 AS `y` from `test`.`t1` group by `test`.`t1`.`a` + 1
DROP VIEW v1;
DROP TABLE t1;
SET SQL_MODE=DEFAULT;
@@ -1519,7 +1519,7 @@ SELECT MAX(pk) as max, i
FROM t1
ORDER BY max;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
# Only 11 is correct for collumn i in this result
SELECT MAX(pk) as max, i
@@ -1860,7 +1860,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 range a a 4 NULL 4 100.00 Using where; Using index; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`a` = 1) and (`test`.`t2`.`b` = 2) and (`test`.`t1`.`a` < 10))
+Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`a` = 1 and `test`.`t2`.`b` = 2 and `test`.`t1`.`a` < 10
SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT a,b FROM t2 WHERE b<5) and a<10;
MAX(a)
NULL
@@ -1869,7 +1869,7 @@ SELECT MAX(a) FROM t1 WHERE RAND()*0<>0 AND a<10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 4 NULL 4 100.00 Using where; Using index
Warnings:
-Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` where (((rand() * 0) <> 0) and (`test`.`t1`.`a` < 10))
+Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` where rand() * 0 <> 0 and `test`.`t1`.`a` < 10
SELECT MAX(a) FROM t1 WHERE RAND()*0<>0 AND a<10;
MAX(a)
NULL
@@ -1891,7 +1891,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1276 Field or reference 'test.t3.b' of SELECT #2 was resolved in SELECT #1
-Note 1003 select <expr_cache><`test`.`t3`.`b`>((select min(1) from dual where (10 = `test`.`t3`.`b`))) AS `(SELECT MIN(t1.a) FROM t1,t2 WHERE t2.a = t3.b)` from `test`.`t3`
+Note 1003 select <expr_cache><`test`.`t3`.`b`>((select min(1) from dual where 10 = `test`.`t3`.`b`)) AS `(SELECT MIN(t1.a) FROM t1,t2 WHERE t2.a = t3.b)` from `test`.`t3`
SELECT (SELECT MIN(t1.a) FROM t1,t2 WHERE t2.a = t3.b) FROM t3;
(SELECT MIN(t1.a) FROM t1,t2 WHERE t2.a = t3.b)
NULL
@@ -2220,11 +2220,15 @@ INSERT INTO `t1` (b) VALUES ('2013-07-06 23:59:59');
EXPLAIN SELECT MIN(b) FROM t1 WHERE b <= '2013-11-06 23:59:59';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+connect con1,localhost,root,,;
+connection con1;
set names utf8;
# Should be the same as above:
EXPLAIN SELECT MIN(b) FROM t1 WHERE b <= '2013-11-06 23:59:59';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+connection default;
+disconnect con1;
DROP TABLE t1;
CREATE TABLE `t1` (
`a` int(11) NOT NULL AUTO_INCREMENT,
@@ -2394,7 +2398,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t10.b' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t10`.`a` AS `a` from `test`.`t10` where ((`test`.`t10`.`c` < 3) or <expr_cache><`test`.`t10`.`a`,`test`.`t10`.`b`>(<in_optimizer>(`test`.`t10`.`a`,<exists>(select `test`.`t12`.`c` from `test`.`t12` where (<cache>(`test`.`t10`.`a`) = `test`.`t12`.`c`) union select max(`test`.`t10`.`b`) from `test`.`t11` group by `test`.`t11`.`c` having (<cache>(`test`.`t10`.`a`) = <ref_null_helper>(max(`test`.`t10`.`b`)))))))
+Note 1003 select `test`.`t10`.`a` AS `a` from `test`.`t10` where `test`.`t10`.`c` < 3 or <expr_cache><`test`.`t10`.`a`,`test`.`t10`.`b`>(<in_optimizer>(`test`.`t10`.`a`,<exists>(select `test`.`t12`.`c` from `test`.`t12` where <cache>(`test`.`t10`.`a`) = `test`.`t12`.`c` union select max(`test`.`t10`.`b`) from `test`.`t11` group by `test`.`t11`.`c` having <cache>(`test`.`t10`.`a`) = <ref_null_helper>(max(`test`.`t10`.`b`)))))
drop table t10,t11,t12;
#
# MDEV-10017: Get unexpected `Empty Set` for correlated subquery
@@ -2425,7 +2429,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY tt system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1276 Field or reference 'test.t1.c1' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` having (`test`.`t1`.`c1` >= <expr_cache><`test`.`t1`.`c1`>((select 2 AS `c` from dual order by (select min((`test`.`t1`.`c1` + 2)) from dual))))
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` having `test`.`t1`.`c1` >= <expr_cache><`test`.`t1`.`c1`>((select 2 AS `c` from dual order by (select min(`test`.`t1`.`c1` + 2) from dual)))
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));
c1
2
@@ -2443,3 +2447,12 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# MDEV-13064: assertion `n < m_size' fails in Item::split_sum_func2()
+#
+create table t1 (i int) engine=MyISAM;
+insert into t1 value (1),(2);
+select count(*)+sleep(0) from t1;
+count(*)+sleep(0)
+2
+drop table t1;
diff --git a/mysql-test/r/func_hybrid_type.result b/mysql-test/r/func_hybrid_type.result
index eeaa79e7dce..324db452f9b 100644
--- a/mysql-test/r/func_hybrid_type.result
+++ b/mysql-test/r/func_hybrid_type.result
@@ -209,6 +209,7 @@ t2 CREATE TABLE `t2` (
`greatest_b_b` int(10) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 AS
SELECT
CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b,
@@ -416,6 +417,7 @@ t2 CREATE TABLE `t2` (
`greatest_b_b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 AS
SELECT
CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b,
@@ -623,6 +625,7 @@ t2 CREATE TABLE `t2` (
`greatest_b_b` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 AS
SELECT
CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b,
@@ -830,6 +833,7 @@ t2 CREATE TABLE `t2` (
`greatest_b_b` bigint(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 AS
SELECT
CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b,
@@ -1006,6 +1010,7 @@ t2 CREATE TABLE `t2` (
`greatest_b_b` int(8) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 AS
SELECT
CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b,
@@ -1182,6 +1187,7 @@ t2 CREATE TABLE `t2` (
`greatest_b_b` int(8) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 AS
SELECT
CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b,
@@ -1358,6 +1364,7 @@ t2 CREATE TABLE `t2` (
`greatest_b_b` int(8) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 AS
SELECT
CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b,
@@ -1534,6 +1541,7 @@ t2 CREATE TABLE `t2` (
`greatest_b_b` int(6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 AS
SELECT
CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b,
@@ -1592,21 +1600,21 @@ GREATEST(b, b) AS greatest_b_b
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 a ___________a 253 10 1 Y 0 0 8
-def case_______a 253 10 1 Y 0 31 8
-def case_____a_a 253 10 1 Y 0 31 8
-def coalesce___a 253 10 1 Y 0 31 8
-def coalesce_a_a 253 10 1 Y 0 31 8
-def if_______a_a 253 10 1 Y 0 31 8
-def ifnull___a_a 253 10 1 Y 0 31 8
-def least____a_a 253 10 1 Y 0 31 8
-def greatest_a_a 253 10 1 Y 0 31 8
+def case_______a 253 10 1 Y 0 39 8
+def case_____a_a 253 10 1 Y 0 39 8
+def coalesce___a 253 10 1 Y 0 39 8
+def coalesce_a_a 253 10 1 Y 0 39 8
+def if_______a_a 253 10 1 Y 0 39 8
+def ifnull___a_a 253 10 1 Y 0 39 8
+def least____a_a 253 10 1 Y 0 39 8
+def greatest_a_a 253 10 1 Y 0 39 8
def test t1 t1 b ___________b 254 1 1 Y 256 0 8
-def case_______b 254 1 1 Y 0 31 8
-def case_____b_b 254 1 1 Y 0 31 8
-def coalesce___b 254 1 1 Y 0 31 8
-def coalesce_b_b 254 1 1 Y 0 31 8
-def if_______b_b 254 1 1 Y 0 31 8
-def ifnull___b_b 254 1 1 Y 0 31 8
+def case_______b 254 1 1 Y 0 39 8
+def case_____b_b 254 1 1 Y 0 39 8
+def coalesce___b 254 1 1 Y 0 39 8
+def coalesce_b_b 254 1 1 Y 0 39 8
+def if_______b_b 254 1 1 Y 0 39 8
+def ifnull___b_b 254 1 1 Y 0 39 8
def least____b_b 254 1 1 Y 0 0 8
def greatest_b_b 254 1 1 Y 0 0 8
___________a a
@@ -1642,18 +1650,18 @@ GREATEST(a, b) AS greatest_a_b,
GREATEST(b, a) AS greatest_b_a
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def case_____a_b 253 10 1 Y 0 31 8
-def case_____b_a 253 10 1 Y 0 31 8
-def coalesce_a_b 253 10 1 Y 0 31 8
-def coalesce_b_a 253 10 1 Y 0 31 8
-def if_______a_b 253 10 1 Y 0 31 8
-def if_______b_a 253 10 1 Y 0 31 8
-def ifnull___a_b 253 10 1 Y 0 31 8
-def ifnull___b_a 253 10 1 Y 0 31 8
-def least____a_b 253 10 1 Y 0 31 8
-def least____b_a 253 10 1 Y 0 31 8
-def greatest_a_b 253 10 1 Y 0 31 8
-def greatest_b_a 253 10 1 Y 0 31 8
+def case_____a_b 253 10 1 Y 0 39 8
+def case_____b_a 253 10 1 Y 0 39 8
+def coalesce_a_b 253 10 1 Y 0 39 8
+def coalesce_b_a 253 10 1 Y 0 39 8
+def if_______a_b 253 10 1 Y 0 39 8
+def if_______b_a 253 10 1 Y 0 39 8
+def ifnull___a_b 253 10 1 Y 0 39 8
+def ifnull___b_a 253 10 1 Y 0 39 8
+def least____a_b 253 10 1 Y 0 39 8
+def least____b_a 253 10 1 Y 0 39 8
+def greatest_a_b 253 10 1 Y 0 39 8
+def greatest_b_a 253 10 1 Y 0 39 8
case_____a_b a
case_____b_a b
coalesce_a_b a
@@ -1710,6 +1718,7 @@ t2 CREATE TABLE `t2` (
`greatest_b_b` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 AS
SELECT
CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b,
@@ -1886,6 +1895,7 @@ t2 CREATE TABLE `t2` (
`greatest_b_b` int(4) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 AS
SELECT
CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b,
@@ -2062,6 +2072,7 @@ t2 CREATE TABLE `t2` (
`greatest_b_b` int(4) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 AS
SELECT
CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b,
@@ -2239,6 +2250,7 @@ t2 CREATE TABLE `t2` (
`greatest_b_b` time DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 AS
SELECT
CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b,
@@ -2397,7 +2409,7 @@ FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `___________a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `___________a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`case_______a` timestamp NULL DEFAULT NULL,
`case_____a_a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`coalesce___a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -2417,6 +2429,7 @@ t2 CREATE TABLE `t2` (
`greatest_b_b` time DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 AS
SELECT
CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b,
@@ -2595,6 +2608,7 @@ t2 CREATE TABLE `t2` (
`greatest_b_b` time DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 AS
SELECT
CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b,
@@ -2773,6 +2787,7 @@ t2 CREATE TABLE `t2` (
`greatest_b_b` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 AS
SELECT
CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b,
@@ -2843,14 +2858,14 @@ def ifnull___a_a 3 11 11 Y 32896 0 63
def least____a_a 3 11 11 Y 32896 0 63
def greatest_a_a 3 11 11 Y 32896 0 63
def test t1 t1 b ___________b 253 10 4 Y 0 0 8
-def case_______b 253 10 4 Y 0 31 8
-def case_____b_b 253 10 4 Y 0 31 8
-def coalesce___b 253 10 4 Y 0 31 8
-def coalesce_b_b 253 10 4 Y 0 31 8
-def if_______b_b 253 10 4 Y 0 31 8
-def ifnull___b_b 253 10 4 Y 0 31 8
-def least____b_b 253 10 4 Y 0 31 8
-def greatest_b_b 253 10 4 Y 0 31 8
+def case_______b 253 10 4 Y 0 39 8
+def case_____b_b 253 10 4 Y 0 39 8
+def coalesce___b 253 10 4 Y 0 39 8
+def coalesce_b_b 253 10 4 Y 0 39 8
+def if_______b_b 253 10 4 Y 0 39 8
+def ifnull___b_b 253 10 4 Y 0 39 8
+def least____b_b 253 10 4 Y 0 39 8
+def greatest_b_b 253 10 4 Y 0 39 8
___________a -2147483648
case_______a -2147483648
case_____a_a -2147483648
@@ -2884,14 +2899,14 @@ GREATEST(a, b) AS greatest_a_b,
GREATEST(b, a) AS greatest_b_a
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def case_____a_b 253 11 11 Y 0 31 8
-def case_____b_a 253 11 4 Y 0 31 8
-def coalesce_a_b 253 11 11 Y 0 31 8
-def coalesce_b_a 253 11 4 Y 0 31 8
-def if_______a_b 253 11 4 Y 0 31 8
-def if_______b_a 253 11 11 Y 0 31 8
-def ifnull___a_b 253 11 11 Y 0 31 8
-def ifnull___b_a 253 11 4 Y 0 31 8
+def case_____a_b 253 11 11 Y 0 39 8
+def case_____b_a 253 11 4 Y 0 39 8
+def coalesce_a_b 253 11 11 Y 0 39 8
+def coalesce_b_a 253 11 4 Y 0 39 8
+def if_______a_b 253 11 4 Y 0 39 8
+def if_______b_a 253 11 11 Y 0 39 8
+def ifnull___a_b 253 11 11 Y 0 39 8
+def ifnull___b_a 253 11 4 Y 0 39 8
def least____a_b 5 23 11 Y 32896 31 63
def least____b_a 5 23 11 Y 32896 31 63
def greatest_a_b 5 23 3 Y 32896 31 63
@@ -2965,6 +2980,7 @@ t2 CREATE TABLE `t2` (
`greatest_b_b` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 AS
SELECT
CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b,
@@ -3073,9 +3089,9 @@ SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c1` varbinary(255) DEFAULT NULL,
- `c2` mediumblob,
- `c3` blob,
- `c4` longblob
+ `c2` mediumblob DEFAULT NULL,
+ `c3` blob DEFAULT NULL,
+ `c4` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT
MAX(COALESCE(c1)) AS c1,
@@ -3084,10 +3100,10 @@ MAX(COALESCE(c3)) AS c3,
MAX(COALESCE(c4)) AS c4
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def c1 253 255 0 Y 128 31 63
-def c2 250 16777215 0 Y 128 31 63
-def c3 252 65535 0 Y 128 31 63
-def c4 251 4294967295 0 Y 128 31 63
+def c1 253 255 0 Y 128 39 63
+def c2 250 16777215 0 Y 128 39 63
+def c3 252 65535 0 Y 128 39 63
+def c4 251 4294967295 0 Y 128 39 63
c1 c2 c3 c4
NULL NULL NULL NULL
DROP TABLE t2;
@@ -3109,8 +3125,8 @@ MAX(COALESCE(c1)) AS c1,
MAX(COALESCE(c2)) AS c2
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def c1 253 1 0 Y 0 31 8
-def c2 253 255 0 Y 0 31 8
+def c1 253 1 0 Y 0 39 8
+def c2 253 255 0 Y 0 39 8
c1 c2
NULL NULL
DROP TABLE t2;
@@ -3132,8 +3148,8 @@ MAX(COALESCE(c1)) AS c1,
MAX(COALESCE(c2)) AS c2
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def c1 253 1 0 Y 0 31 8
-def c2 253 255 0 Y 0 31 8
+def c1 253 1 0 Y 0 39 8
+def c2 253 255 0 Y 0 39 8
c1 c2
NULL NULL
DROP TABLE t2;
@@ -3150,7 +3166,7 @@ Table Create Table
t2 CREATE TABLE `t2` (
`c1` varchar(1) DEFAULT NULL,
`c2` varchar(255) DEFAULT NULL,
- `c3` text
+ `c3` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT
MAX(COALESCE(c1)) AS c1,
@@ -3158,9 +3174,9 @@ MAX(COALESCE(c2)) AS c2,
MAX(COALESCE(c3)) AS c3
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def c1 253 1 0 Y 0 31 8
-def c2 253 255 0 Y 0 31 8
-def c3 252 20000 0 Y 0 31 8
+def c1 253 1 0 Y 0 39 8
+def c2 253 255 0 Y 0 39 8
+def c3 252 20000 0 Y 0 39 8
c1 c2 c3
NULL NULL NULL
DROP TABLE t2;
@@ -3177,7 +3193,7 @@ Table Create Table
t2 CREATE TABLE `t2` (
`c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL,
`c2` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
- `c3` text CHARACTER SET utf8
+ `c3` text CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT
MAX(COALESCE(c1)) AS c1,
@@ -3185,9 +3201,9 @@ MAX(COALESCE(c2)) AS c2,
MAX(COALESCE(c3)) AS c3
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def c1 253 1 0 Y 0 31 8
-def c2 253 255 0 Y 0 31 8
-def c3 252 60000 0 Y 0 31 8
+def c1 253 1 0 Y 0 39 8
+def c2 253 255 0 Y 0 39 8
+def c3 252 60000 0 Y 0 39 8
c1 c2 c3
NULL NULL NULL
DROP TABLE t2;
@@ -3206,7 +3222,7 @@ SELECT
MAX(COALESCE(c1)) AS c1
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def c1 253 1 0 Y 0 31 8
+def c1 253 1 0 Y 0 39 8
c1
NULL
DROP TABLE t2;
@@ -3225,7 +3241,7 @@ SELECT
MAX(COALESCE(c1)) AS c1
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def c1 253 1 0 Y 0 31 8
+def c1 253 1 0 Y 0 39 8
c1
NULL
DROP TABLE t2;
@@ -3245,9 +3261,9 @@ SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c1` varbinary(255) DEFAULT NULL,
- `c2` blob,
- `c3` mediumblob,
- `c4` longblob
+ `c2` blob DEFAULT NULL,
+ `c3` mediumblob DEFAULT NULL,
+ `c4` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT
@c1:=c1 AS c1,
@@ -3256,10 +3272,10 @@ SELECT
@c4:=c4 AS c4
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def c1 253 255 0 Y 128 31 63
-def c2 252 65535 0 Y 128 31 63
-def c3 250 16777215 0 Y 128 31 63
-def c4 251 4294967295 0 Y 128 31 63
+def c1 253 255 0 Y 128 39 63
+def c2 252 65535 0 Y 128 39 63
+def c3 250 16777215 0 Y 128 39 63
+def c4 251 4294967295 0 Y 128 39 63
c1 c2 c3 c4
DROP TABLE t2;
DROP TABLE t1;
@@ -3280,8 +3296,8 @@ SELECT
@c2:=c2 AS c2
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def c1 253 1 0 Y 0 31 8
-def c2 253 255 0 Y 0 31 8
+def c1 253 1 0 Y 0 39 8
+def c2 253 255 0 Y 0 39 8
c1 c2
DROP TABLE t2;
DROP TABLE t1;
@@ -3302,8 +3318,8 @@ SELECT
@c2:=c2 AS c2
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def c1 253 1 0 Y 0 31 8
-def c2 253 255 0 Y 0 31 8
+def c1 253 1 0 Y 0 39 8
+def c2 253 255 0 Y 0 39 8
c1 c2
DROP TABLE t2;
DROP TABLE t1;
@@ -3319,7 +3335,7 @@ Table Create Table
t2 CREATE TABLE `t2` (
`c1` varchar(1) DEFAULT NULL,
`c2` varchar(255) DEFAULT NULL,
- `c3` text
+ `c3` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT
@c:=c1 AS c1,
@@ -3327,9 +3343,9 @@ SELECT
@c:=c3 AS c3
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def c1 253 1 0 Y 0 31 8
-def c2 253 255 0 Y 0 31 8
-def c3 252 20000 0 Y 0 31 8
+def c1 253 1 0 Y 0 39 8
+def c2 253 255 0 Y 0 39 8
+def c3 252 20000 0 Y 0 39 8
c1 c2 c3
DROP TABLE t2;
DROP TABLE t1;
@@ -3345,7 +3361,7 @@ Table Create Table
t2 CREATE TABLE `t2` (
`c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL,
`c2` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
- `c3` text CHARACTER SET utf8
+ `c3` text CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT
@c:=c1 AS c1,
@@ -3353,9 +3369,9 @@ SELECT
@c:=c3 AS c3
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def c1 253 1 0 Y 0 31 8
-def c2 253 255 0 Y 0 31 8
-def c3 252 60000 0 Y 0 31 8
+def c1 253 1 0 Y 0 39 8
+def c2 253 255 0 Y 0 39 8
+def c3 252 60000 0 Y 0 39 8
c1 c2 c3
DROP TABLE t2;
DROP TABLE t1;
diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result
index 637fd8cd2a2..09eb85d9fb6 100644
--- a/mysql-test/r/func_if.result
+++ b/mysql-test/r/func_if.result
@@ -43,7 +43,7 @@ explain extended select if(u=1,st,binary st) s from t1 where st like "%a%" order
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 Using where; Using filesort
Warnings:
-Note 1003 select if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary)) AS `s` from `test`.`t1` where (`test`.`t1`.`st` like '%a%') order by if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary))
+Note 1003 select if(`test`.`t1`.`u` = 1,`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary)) AS `s` from `test`.`t1` where `test`.`t1`.`st` like '%a%' order by if(`test`.`t1`.`u` = 1,`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary))
select nullif(u, 1) from t1;
nullif(u, 1)
NULL
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index c80ea5d13e1..996ec98da75 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -121,9 +121,9 @@ insert into t1 values ('a','c','c');
select * from t1 where a in (b);
ERROR HY000: Illegal mix of collations (latin1_general_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='
select * from t1 where a in (b,c);
-ERROR HY000: Illegal mix of collations (latin1_general_ci,IMPLICIT), (latin1_swedish_ci,IMPLICIT), (latin1_danish_ci,IMPLICIT) for operation ' IN '
+ERROR HY000: Illegal mix of collations (latin1_general_ci,IMPLICIT), (latin1_swedish_ci,IMPLICIT), (latin1_danish_ci,IMPLICIT) for operation 'in'
select * from t1 where 'a' in (a,b,c);
-ERROR HY000: Illegal mix of collations for operation ' IN '
+ERROR HY000: Illegal mix of collations for operation 'in'
select * from t1 where 'a' in (a);
a b c
A B C
@@ -146,7 +146,7 @@ explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ('a' in (`test`.`t1`.`a`,`test`.`t1`.`b`,(`test`.`t1`.`c` collate latin1_bin)))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where 'a' in (`test`.`t1`.`a`,`test`.`t1`.`b`,`test`.`t1`.`c` collate latin1_bin)
drop table t1;
set names utf8;
create table t1 (a char(10) character set utf8 not null);
@@ -226,7 +226,7 @@ a
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a NOT IN (45);
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` <> 45) latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where `t1`.`a` <> 45 latin1 latin1_swedish_ci
SELECT * FROM v1;
a
44
@@ -487,6 +487,8 @@ CREATE TABLE t1 (id int not null);
INSERT INTO t1 VALUES (1),(2);
SELECT id FROM t1 WHERE id IN(4564, (SELECT IF(1=0,1,1/0)) );
id
+Warnings:
+Warning 1365 Division by 0
DROP TABLE t1;
End of 5.0 tests
create table t1(f1 char(1));
@@ -627,9 +629,9 @@ 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 INTO t1 (c_int) VALUES (1), (2), (3), (4), (5);
-INSERT INTO t1 (c_int) SELECT 0 FROM t1;
-INSERT INTO t1 (c_int) SELECT 0 FROM t1;
+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;
EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c_int c_int 4 NULL 3 Using index condition
@@ -849,17 +851,17 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND a IN (1,2,3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 1)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1
# 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');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 1)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1
# 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');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and (`test`.`t1`.`a` in (1,2,'3')))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and `test`.`t1`.`a` in (1,2,'3')
DROP TABLE t1;
diff --git a/mysql-test/r/func_isnull.result b/mysql-test/r/func_isnull.result
index 88c5bfd5468..15d87997e29 100644
--- a/mysql-test/r/func_isnull.result
+++ b/mysql-test/r/func_isnull.result
@@ -44,7 +44,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE d1 IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`d1` AS `d1` from `test`.`t1` where (`test`.`t1`.`d1` = 0)
+Note 1003 select `test`.`t1`.`d1` AS `d1` from `test`.`t1` where `test`.`t1`.`d1` = 0
SELECT count(*) FROM t1 WHERE d1 IS NULL;
count(*)
2
@@ -62,7 +62,7 @@ EXPLAIN EXTENDED SELECT * FROM v1 WHERE d1 IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`d1` AS `d1` from `test`.`t1` where (`test`.`t1`.`d1` = 0)
+Note 1003 select `test`.`t1`.`d1` AS `d1` from `test`.`t1` where `test`.`t1`.`d1` = 0
SELECT count(*) FROM v1 WHERE d1 IS NULL;
count(*)
2
@@ -90,7 +90,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`d1` AS `d1`,`test`.`t1`.`d1` AS `d1` from `test`.`t2` left join `test`.`t1` on((`test`.`t1`.`d1` = `test`.`t2`.`d1`)) where ((`test`.`t1`.`d1` = 0) or isnull(`test`.`t1`.`d1`))
+Note 1003 select `test`.`t2`.`d1` AS `d1`,`test`.`t1`.`d1` AS `d1` from `test`.`t2` left join `test`.`t1` on(`test`.`t1`.`d1` = `test`.`t2`.`d1`) where `test`.`t1`.`d1` = 0 or `test`.`t1`.`d1` is null
SELECT * FROM t2 LEFT JOIN v1 ON t2.d1=v1.d1 WHERE v1.d1 IS NULL;
d1 d1
0000-00-00 00:00:00 0000-00-00 00:00:00
@@ -102,7 +102,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`d1` AS `d1`,`test`.`t1`.`d1` AS `d1` from `test`.`t2` left join (`test`.`t1`) on((`test`.`t1`.`d1` = `test`.`t2`.`d1`)) where ((`test`.`t1`.`d1` = 0) or isnull(`test`.`t1`.`d1`))
+Note 1003 select `test`.`t2`.`d1` AS `d1`,`test`.`t1`.`d1` AS `d1` from `test`.`t2` left join (`test`.`t1`) on(`test`.`t1`.`d1` = `test`.`t2`.`d1`) where `test`.`t1`.`d1` = 0 or `test`.`t1`.`d1` is null
DROP VIEW v1;
DROP TABLE t1,t2;
#
diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result
new file mode 100644
index 00000000000..2ffeb83b0de
--- /dev/null
+++ b/mysql-test/r/func_json.result
@@ -0,0 +1,741 @@
+select json_valid('[1, 2]');
+json_valid('[1, 2]')
+1
+select json_valid('"string"}');
+json_valid('"string"}')
+0
+select json_valid('{"key1":1, "key2":[2,3]}');
+json_valid('{"key1":1, "key2":[2,3]}')
+1
+select json_valid('[false, true, null]');
+json_valid('[false, true, null]')
+1
+select json_valid(repeat('[', 1000));
+json_valid(repeat('[', 1000))
+0
+select json_valid(repeat('{"a":', 1000));
+json_valid(repeat('{"a":', 1000))
+0
+select json_value('{"key1":123}', '$.key2');
+json_value('{"key1":123}', '$.key2')
+NULL
+select json_value('{"key1":123}', '$.key1');
+json_value('{"key1":123}', '$.key1')
+123
+select json_value('{"key1":[1,2,3]}', '$.key1');
+json_value('{"key1":[1,2,3]}', '$.key1')
+NULL
+select json_value('{"key1": [1,2,3], "key1":123}', '$.key1');
+json_value('{"key1": [1,2,3], "key1":123}', '$.key1')
+123
+select JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z');
+JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z')
+Mon"t"y
+select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2');
+json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2')
+NULL
+select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key1');
+json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key1')
+{"a":1, "b":[1,2]}
+select json_query('{"key1": 1}', '$.key1');
+json_query('{"key1": 1}', '$.key1')
+NULL
+select json_query('{"key1":123, "key1": [1,2,3]}', '$.key1');
+json_query('{"key1":123, "key1": [1,2,3]}', '$.key1')
+[1,2,3]
+select json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000)));
+json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000)))
+NULL
+select json_array();
+json_array()
+[]
+select json_array(1);
+json_array(1)
+[1]
+select json_array(1, "text", false, null);
+json_array(1, "text", false, null)
+[1, "text", false, null]
+select json_array_append('["a", "b"]', '$', FALSE);
+json_array_append('["a", "b"]', '$', FALSE)
+["a", "b", false]
+select json_array_append('{"k1":1, "k2":["a", "b"]}', '$.k2', 2);
+json_array_append('{"k1":1, "k2":["a", "b"]}', '$.k2', 2)
+{"k1": 1, "k2": ["a", "b", 2]}
+select json_array_append('["a", ["b", "c"], "d"]', '$[0]', 2);
+json_array_append('["a", ["b", "c"], "d"]', '$[0]', 2)
+[["a", 2], ["b", "c"], "d"]
+select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1]', 'x');
+json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1]', 'x')
+["a", "x", {"b": [1, 2]}, [3, 4]]
+select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2]', 'x');
+json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2]', 'x')
+["a", {"b": [1, 2]}, "x", [3, 4]]
+select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[3]', 'x');
+json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[3]', 'x')
+["a", {"b": [1, 2]}, [3, 4], "x"]
+select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[4]', 'x');
+json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[4]', 'x')
+["a", {"b": [1, 2]}, [3, 4], "x"]
+select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x');
+json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x')
+["a", {"b": ["x", 1, 2]}, [3, 4]]
+select json_array_insert('true', '$', 1);
+json_array_insert('true', '$', 1)
+NULL
+select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y');
+json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y')
+["a", {"b": [1, 2]}, [3, "y", 4]]
+select json_contains('{"k1":123, "k2":345}', '123', '$.k1');
+json_contains('{"k1":123, "k2":345}', '123', '$.k1')
+1
+select json_contains('"you"', '"you"');
+json_contains('"you"', '"you"')
+1
+select json_contains('"youth"', '"you"');
+json_contains('"youth"', '"you"')
+0
+select json_contains('[1]', '[1]', '$', '$[0]');
+ERROR 42000: Incorrect parameter count in the call to native function 'json_contains'
+select json_contains('', '', '$');
+json_contains('', '', '$')
+NULL
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_contains'
+select json_contains('null', 'null', '$');
+json_contains('null', 'null', '$')
+1
+select json_contains('"10"', '"10"', '$');
+json_contains('"10"', '"10"', '$')
+1
+select json_contains('"10"', '10', '$');
+json_contains('"10"', '10', '$')
+0
+select json_contains('10.1', '10', '$');
+json_contains('10.1', '10', '$')
+0
+select json_contains('10.0', '10', '$');
+json_contains('10.0', '10', '$')
+1
+select json_contains('[1]', '1');
+json_contains('[1]', '1')
+1
+select json_contains('[2, 1]', '1');
+json_contains('[2, 1]', '1')
+1
+select json_contains('[2, [2, 3], 1]', '1');
+json_contains('[2, [2, 3], 1]', '1')
+1
+select json_contains('[4, [2, 3], 1]', '2');
+json_contains('[4, [2, 3], 1]', '2')
+1
+select json_contains('[2, 1]', '[1, 2]');
+json_contains('[2, 1]', '[1, 2]')
+1
+select json_contains('[2, 1]', '[1, 0, 2]');
+json_contains('[2, 1]', '[1, 0, 2]')
+0
+select json_contains('[2, 0, 3, 1]', '[1, 2]');
+json_contains('[2, 0, 3, 1]', '[1, 2]')
+1
+select json_contains('{"b":[1,2], "a":1}', '{"a":1, "b":2}');
+json_contains('{"b":[1,2], "a":1}', '{"a":1, "b":2}')
+1
+select json_contains('{"a":1}', '{}');
+json_contains('{"a":1}', '{}')
+1
+select json_contains('[1, {"a":1}]', '{}');
+json_contains('[1, {"a":1}]', '{}')
+1
+select json_contains('[1, {"a":1}]', '{"a":1}');
+json_contains('[1, {"a":1}]', '{"a":1}')
+1
+select json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]');
+json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]')
+0
+select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]');
+json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]')
+1
+select json_contains('[{"a":"b"},{"c":"d"}]','{"c":"d"}');
+json_contains('[{"a":"b"},{"c":"d"}]','{"c":"d"}')
+1
+select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]");
+json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]")
+1
+select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]");
+json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]")
+0
+select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.ma");
+json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.ma")
+0
+select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1");
+json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1")
+1
+select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma");
+json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma")
+1
+select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma");
+json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma")
+0
+select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2");
+json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2")
+1
+select json_contains_path('{ "a": true }', NULL, '$.a' );
+json_contains_path('{ "a": true }', NULL, '$.a' )
+NULL
+select json_contains_path('{ "a": true }', 'all', NULL );
+json_contains_path('{ "a": true }', 'all', NULL )
+NULL
+select json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*');
+json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*')
+1
+select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1");
+json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1")
+"asd"
+select json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY");
+json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY")
+NULL
+select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1", "$.key2");
+json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1", "$.key2")
+["asd", [2, 3]]
+select json_extract('{"key1":5, "key2":[2,3]}', "$.key1", "$.key2");
+json_extract('{"key1":5, "key2":[2,3]}', "$.key1", "$.key2")
+[5, [2, 3]]
+select json_extract('{"key0":true, "key1":"qwe"}', "$.key1");
+json_extract('{"key0":true, "key1":"qwe"}', "$.key1")
+"qwe"
+select json_extract(json_object('foo', 'foobar'),'$');
+json_extract(json_object('foo', 'foobar'),'$')
+{"foo": "foobar"}
+select json_extract('[10, 20, [30, 40]]', '$[2][*]');
+json_extract('[10, 20, [30, 40]]', '$[2][*]')
+[30, 40]
+select json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]');
+json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]')
+[{"a": 3}, 30, 40]
+select json_extract('1', '$');
+json_extract('1', '$')
+1
+select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]');
+json_extract('[10, 20, [30, 40], 1, 10]', '$[1]')
+20
+select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]');
+json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]')
+[20]
+select json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a');
+json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a')
+[[3, 4]]
+select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word');
+json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word')
+{"a": 1, "b": {"c": 1, "k1": "word"}, "d": [1, 2]}
+select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3);
+json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3)
+{"a": 1, "b": {"c": 1}, "d": [1, 2, 3]}
+select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2);
+json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2)
+{"a": [1, 2], "b": {"c": 1}, "d": [1, 2]}
+select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word');
+json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word')
+{"a": 1, "b": {"c": 1}, "d": [1, 2]}
+select json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]');
+json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]')
+{"a": 10, "b": [2, 3], "c": "[true, false]"}
+select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]');
+json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]')
+{"a": 10, "b": [2, 3]}
+select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]');
+json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]')
+{"a": 10, "b": "[true, false]"}
+set @j = '["a", ["b", "c"], "d"]';
+select json_remove(@j, '$[0]');
+json_remove(@j, '$[0]')
+[["b", "c"], "d"]
+select json_remove(@j, '$[1]');
+json_remove(@j, '$[1]')
+["a", "d"]
+select json_remove(@j, '$[2]');
+json_remove(@j, '$[2]')
+["a", ["b", "c"]]
+set @j = '{"a": 1, "b": [2, 3]}';
+select json_remove(@j, '$.b');
+json_remove(@j, '$.b')
+{"a": 1}
+select json_remove(@j, '$.a');
+json_remove(@j, '$.a')
+{"b": [2, 3]}
+select json_object();
+json_object()
+{}
+select json_object("ki", 1, "mi", "ya");
+json_object("ki", 1, "mi", "ya")
+{"ki": 1, "mi": "ya"}
+create table t1 as select json_object('id', 87, 'name', 'carrot') as f;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f` varchar(32) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+f
+{"id": 87, "name": "carrot"}
+drop table t1;
+select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2");
+json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2")
+1
+select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]");
+json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]")
+1
+select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]");
+json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]")
+0
+select json_quote('"string"');
+json_quote('"string"')
+"\"string\""
+create table t1 as select json_quote('foo');
+select * from t1;
+json_quote('foo')
+"foo"
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `json_quote('foo')` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select json_merge('string');
+ERROR 42000: Incorrect parameter count in the call to native function 'json_merge'
+select json_merge('string', 123);
+json_merge('string', 123)
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_merge' at position 1
+select json_merge('"string"', 123);
+json_merge('"string"', 123)
+["string", 123]
+select json_merge('[1, 2]', '[true, false]');
+json_merge('[1, 2]', '[true, false]')
+[1, 2, true, false]
+select json_merge('{"1": 2}', '{"true": false}');
+json_merge('{"1": 2}', '{"true": false}')
+{"1": 2, "true": false}
+select json_merge('{"1": 2}', '{"true": false}', '{"3": 4}');
+json_merge('{"1": 2}', '{"true": false}', '{"3": 4}')
+{"1": 2, "true": false, "3": 4}
+select json_merge(NULL,json_object('foo', 1));
+json_merge(NULL,json_object('foo', 1))
+NULL
+select json_merge('a','b');
+json_merge('a','b')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_merge' at position 1
+select json_merge('{"a":"b"}','{"c":"d"}');
+json_merge('{"a":"b"}','{"c":"d"}')
+{"a": "b", "c": "d"}
+SELECT JSON_MERGE('[1, 2]', '{"id": 47}');
+JSON_MERGE('[1, 2]', '{"id": 47}')
+[1, 2, {"id": 47}]
+select json_type('{"k1":123, "k2":345}');
+json_type('{"k1":123, "k2":345}')
+OBJECT
+select json_type('[123, "k2", 345]');
+json_type('[123, "k2", 345]')
+ARRAY
+select json_type("true");
+json_type("true")
+BOOLEAN
+select json_type('123');
+json_type('123')
+INTEGER
+select json_type('123.12');
+json_type('123.12')
+DOUBLE
+select json_keys('{"a":{"c":1, "d":2}, "b":2}');
+json_keys('{"a":{"c":1, "d":2}, "b":2}')
+["a", "b"]
+select json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.a");
+json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.a")
+["c", "d"]
+select json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.b");
+json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.b")
+NULL
+select json_keys('foo');
+json_keys('foo')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_keys' at position 1
+select json_keys('{"a":{"c":1, "d":2}, "b":2, "c":1, "a":3, "b":1, "c":2}');
+json_keys('{"a":{"c":1, "d":2}, "b":2, "c":1, "a":3, "b":1, "c":2}')
+["a", "b", "c"]
+select json_keys('{"c1": "value 1", "c1": "value 2"}');
+json_keys('{"c1": "value 1", "c1": "value 2"}')
+["c1"]
+SET @j = '["abc", [{"k": "10"}, "def"], {"x":"abc"}, {"y":"bcd"}]';
+select json_search(@j, 'one', 'abc');
+json_search(@j, 'one', 'abc')
+"$[0]"
+select json_search(@j, 'all', 'abc');
+json_search(@j, 'all', 'abc')
+["$[0]", "$[2].x"]
+select json_search(@j, 'all', 'abc', NULL, '$[2]');
+json_search(@j, 'all', 'abc', NULL, '$[2]')
+"$[2].x"
+select json_search(@j, 'all', 'abc', NULL, '$');
+json_search(@j, 'all', 'abc', NULL, '$')
+["$[0]", "$[2].x"]
+select json_search(@j, 'all', '10', NULL, '$');
+json_search(@j, 'all', '10', NULL, '$')
+"$[1][0].k"
+select json_search(@j, 'all', '10', NULL, '$[*]');
+json_search(@j, 'all', '10', NULL, '$[*]')
+"$[1][0].k"
+select json_search(@j, 'all', '10', NULL, '$[*][0].k');
+json_search(@j, 'all', '10', NULL, '$[*][0].k')
+"$[1][0].k"
+select json_search(@j, 'all', '10', NULL, '$**.k');
+json_search(@j, 'all', '10', NULL, '$**.k')
+"$[1][0].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;
+json_search( json_col, 'all', 'foot' )
+NULL
+"$.c[1]"
+drop table t1;
+select json_unquote('"abc"');
+json_unquote('"abc"')
+abc
+select json_unquote('abc');
+json_unquote('abc')
+abc
+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;
+fld
+{"foo": "{\"bar\": \"abc\"}", "qux": "abc"}
+{"foo": "{\"bar\": \"def\"}", "qux": "def"}
+drop table t1;
+select json_object("a", json_object("b", "abcd"));
+json_object("a", json_object("b", "abcd"))
+{"a": {"b": "abcd"}}
+select json_object("a", '{"b": "abcd"}');
+json_object("a", '{"b": "abcd"}')
+{"a": "{\"b\": \"abcd\"}"}
+select json_object("a", json_compact('{"b": "abcd"}'));
+json_object("a", json_compact('{"b": "abcd"}'))
+{"a": {"b": "abcd"}}
+select json_compact(NULL);
+json_compact(NULL)
+NULL
+select json_depth(json_compact(NULL));
+json_depth(json_compact(NULL))
+NULL
+select json_depth('[[], {}]');
+json_depth('[[], {}]')
+2
+select json_depth('[[[1,2,3],"s"], {}, []]');
+json_depth('[[[1,2,3],"s"], {}, []]')
+4
+select json_depth('[10, {"a": 20}]');
+json_depth('[10, {"a": 20}]')
+3
+select json_length('');
+json_length('')
+NULL
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_length'
+select json_length('{}');
+json_length('{}')
+0
+select json_length('[1, 2, {"a": 3}]');
+json_length('[1, 2, {"a": 3}]')
+3
+select json_length('{"a": 1, "b": {"c": 30}}', '$.b');
+json_length('{"a": 1, "b": {"c": 30}}', '$.b')
+1
+select json_length('{"a": 1, "b": {"c": 30}}');
+json_length('{"a": 1, "b": {"c": 30}}')
+2
+select json_length('{}{');
+json_length('{}{')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_length' at position 3
+create table json (j INT);
+show create table json;
+Table Create Table
+json CREATE TABLE `json` (
+ `j` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table json;
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' );
+json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' )
+1
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' );
+json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' )
+1
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0]' );
+json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0]' )
+1
+select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0][0]' );
+json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0][0]' )
+1
+select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2]' );
+json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2]' )
+2
+select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0]' );
+json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0]' )
+2
+select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0]' );
+json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0]' )
+2
+select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0][0]' );
+json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0][0]' )
+2
+select json_length( '{"a":{"b":{"d":1}}, "a":{"c":{"d":1, "j":2}}}', '$.a[0][0][0].c' );
+json_length( '{"a":{"b":{"d":1}}, "a":{"c":{"d":1, "j":2}}}', '$.a[0][0][0].c' )
+2
+select json_set('1', '$[0]', 100);
+json_set('1', '$[0]', 100)
+100
+select json_set('1', '$[0][0]', 100);
+json_set('1', '$[0][0]', 100)
+100
+select json_set('1', '$[1]', 100);
+json_set('1', '$[1]', 100)
+[1, 100]
+select json_set('{"a":12}', '$[0]', 100);
+json_set('{"a":12}', '$[0]', 100)
+100
+select json_set('{"a":12}', '$[0].a', 100);
+json_set('{"a":12}', '$[0].a', 100)
+{"a": 100}
+select json_set('{"a":12}', '$[0][0].a', 100);
+json_set('{"a":12}', '$[0][0].a', 100)
+{"a": 100}
+select json_set('{"a":12}', '$[0][1].a', 100);
+json_set('{"a":12}', '$[0][1].a', 100)
+{"a": 12}
+select json_value('{"\\"key1":123}', '$."\\"key1"');
+json_value('{"\\"key1":123}', '$."\\"key1"')
+123
+select json_value('{"\\"key1\\"":123}', '$."\\"key1\\""');
+json_value('{"\\"key1\\"":123}', '$."\\"key1\\""')
+123
+select json_value('{"key 1":123}', '$."key 1"');
+json_value('{"key 1":123}', '$."key 1"')
+123
+select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[2]");
+json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[2]")
+1
+select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[3]");
+json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[3]")
+0
+select json_extract( '[1]', '$[0][0]' );
+json_extract( '[1]', '$[0][0]' )
+1
+select json_extract( '[1]', '$[1][0]' );
+json_extract( '[1]', '$[1][0]' )
+NULL
+select json_extract( '[1]', '$**[0]' );
+json_extract( '[1]', '$**[0]' )
+[1]
+select json_extract( '[1]', '$**[0][0]' );
+json_extract( '[1]', '$**[0][0]' )
+[1]
+select json_insert('1', '$[0]', 4);
+json_insert('1', '$[0]', 4)
+1
+select json_replace('1', '$[0]', 4);
+json_replace('1', '$[0]', 4)
+4
+select json_set('1', '$[0]', 4);
+json_set('1', '$[0]', 4)
+4
+select json_set('1', '$[1]', 4);
+json_set('1', '$[1]', 4)
+[1, 4]
+select json_replace('1', '$[1]', 4);
+json_replace('1', '$[1]', 4)
+1
+SELECT json_insert('[]', '$[0][0]', 100);
+json_insert('[]', '$[0][0]', 100)
+[]
+SELECT json_insert('1', '$[0][0]', 100);
+json_insert('1', '$[0][0]', 100)
+1
+SELECT json_replace('1', '$[0][0]', 100);
+json_replace('1', '$[0][0]', 100)
+100
+SELECT json_replace('[]', '$[0][0]', 100);
+json_replace('[]', '$[0][0]', 100)
+[]
+SELECT json_set('[]', '$[0][0]', 100);
+json_set('[]', '$[0][0]', 100)
+[]
+SELECT json_set('[]', '$[0][0][0]', 100);
+json_set('[]', '$[0][0][0]', 100)
+[]
+SELECT JSON_search( '{"": "a"}', "one", 'a');
+JSON_search( '{"": "a"}', "one", 'a')
+"$."
+select json_merge('{"a":"b"}', '{"a":"c"}') ;
+json_merge('{"a":"b"}', '{"a":"c"}')
+{"a": ["b", "c"]}
+select json_merge('{"a":{"x":"b"}}', '{"a":"c"}') ;
+json_merge('{"a":{"x":"b"}}', '{"a":"c"}')
+{"a": [{"x": "b"}, "c"]}
+select json_merge('{"a":{"u":12, "x":"b"}}', '{"a":{"x":"c"}}') ;
+json_merge('{"a":{"u":12, "x":"b"}}', '{"a":{"x":"c"}}')
+{"a": {"u": 12, "x": ["b", "c"]}}
+select json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}') ;
+json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}')
+{"a": {"u": 12, "x": ["b", "c"], "r": [1, 2]}}
+select json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
+json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}')
+{"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"}}');
+json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}')
+{"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"}}');
+json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}')
+{
+ "a": 1,
+ "b":
+ [
+ 1,
+ 2,
+ 3
+ ],
+ "c":
+ {
+ "aa": "v1",
+ "bb": "v2"
+ }
+}
+SELECT JSON_search( '{"x": "\\""}', "one", '"');
+JSON_search( '{"x": "\\""}', "one", '"')
+"$.x"
+SELECT JSON_search( '{"x": "\\""}', "one", '\\"');
+JSON_search( '{"x": "\\""}', "one", '\\"')
+"$.x"
+set @@global.net_buffer_length=1024;
+set @@global.max_allowed_packet=2048;
+connect newconn, localhost, root,,;
+show variables like 'net_buffer_length';
+Variable_name Value
+net_buffer_length 1024
+show variables like 'max_allowed_packet';
+Variable_name Value
+max_allowed_packet 2048
+select json_array(repeat('a',1024),repeat('a',1024));
+json_array(repeat('a',1024),repeat('a',1024))
+NULL
+Warnings:
+Warning 1301 Result of json_array() was larger than max_allowed_packet (2048) - truncated
+select json_object("a", repeat('a',1024),"b", repeat('a',1024));
+json_object("a", repeat('a',1024),"b", repeat('a',1024))
+NULL
+Warnings:
+Warning 1301 Result of json_object() was larger than max_allowed_packet (2048) - truncated
+connection default;
+set @@global.max_allowed_packet = default;
+set @@global.net_buffer_length = default;
+disconnect newconn;
+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;
+j p json_remove(j, p)
+{"a":1,"b":2,"c":3} $.a {"b": 2, "c": 3}
+{"a":1,"b":2,"c":3} $.b {"a": 1, "c": 3}
+{"a":1,"b":2,"c":3} $.c {"a": 1, "b": 2}
+drop table t1;
+SET @str = 'bar', @path = '$';
+SELECT JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path);
+JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path)
+"$.foo"
+SELECT JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]');
+JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]')
+bar
+CREATE TABLE t1 (f INT NOT NULL);
+INSERT INTO t1 VALUES (0);
+SELECT JSON_KEYS(f) FROM t1 ORDER BY 1;
+JSON_KEYS(f)
+NULL
+DROP TABLE t1;
+SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*].*' );
+JSON_EXTRACT( '{"foo":"bar"}', '$[*].*' )
+NULL
+SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*]' );
+JSON_EXTRACT( '{"foo":"bar"}', '$[*]' )
+NULL
+select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value';
+JSON_EXTRACT('{"name":"value"}', '$.name') = 'value'
+1
+select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = true;
+JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = true
+1
+select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false;
+JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false
+0
+select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1;
+JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1
+1
+select JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"');
+JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"')
+"\u00f6"
+select JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo');
+JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 15
+SELECT JSON_OBJECT('foo', '`');
+JSON_OBJECT('foo', '`')
+{"foo": "`"}
+SELECT JSON_OBJECT("foo", "bar`bar");
+JSON_OBJECT("foo", "bar`bar")
+{"foo": "bar`bar"}
+SELECT JSON_SET('{}', '$.age', 87);
+JSON_SET('{}', '$.age', 87)
+{"age": 87}
+SELECT JSON_MERGE('[]', '{"c":"d"}');
+JSON_MERGE('[]', '{"c":"d"}')
+[{"c": "d"}]
+SET @str = "{\"\\u00e4\\u00f6\":\"yes\"}";
+SET @path = "$.\"\\u00e4\\u00f6\"";
+select @str, @path, JSON_EXTRACT(@str, @path);
+@str @path JSON_EXTRACT(@str, @path)
+{"\u00e4\u00f6":"yes"} $."\u00e4\u00f6" "yes"
+SET @str = "{\"\\u00e4\":\"yes\"}";
+SET @path = "$.\"\\u00e4\"";
+select @str, @path, JSON_EXTRACT(@str, @path);
+@str @path JSON_EXTRACT(@str, @path)
+{"\u00e4":"yes"} $."\u00e4" "yes"
+select json_array(5,json_query('[1,2]','$'));
+json_array(5,json_query('[1,2]','$'))
+[5, [1,2]]
+SELECT JSON_ARRAY('1. Ä› 2. Å¡ 3. Ä 4. Å™ 5. ž 6. ý 7. á 8. í 9. é 10. ů 11. ú') AS json_data;
+json_data
+["1. Ä› 2. Å¡ 3. Ä 4. Å™ 5. ž 6. ý 7. á 8. í 9. é 10. ů 11. ú"]
+SELECT JSON_OBJECT("user","Jožko MrkviÄká") as json_data;
+json_data
+{"user": "Jožko MrkviÄká"}
+select json_contains_path('{"foo":"bar"}', 'one', '$[]');
+json_contains_path('{"foo":"bar"}', 'one', '$[]')
+NULL
+Warnings:
+Warning 4042 Syntax error in JSON path in argument 3 to function 'json_contains_path' at position 3
+select JSON_VALID(0x36f0c8dccd83c5eac156da);
+JSON_VALID(0x36f0c8dccd83c5eac156da)
+0
+create table t1(a double not null);
+insert into t1 values (2),(1);
+select 1 from t1 where json_extract(a,'$','$[81]');
+1
+drop table t1;
+select json_extract('{"test":8.437e-5}','$.test');
+json_extract('{"test":8.437e-5}','$.test')
+8.437e-5
diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result
index 9c8e9727d16..0ba8e41f164 100644
--- a/mysql-test/r/func_like.result
+++ b/mysql-test/r/func_like.result
@@ -5,12 +5,12 @@ explain extended select * from t1 where a like 'abc%';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index a a 13 NULL 5 20.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like 'abc%')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` like 'abc%'
explain extended select * from t1 where a like concat('abc','%');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index a a 13 NULL 5 20.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like <cache>(concat('abc','%')))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` like <cache>(concat('abc','%'))
select * from t1 where a like "abc%";
a
abc
@@ -175,7 +175,7 @@ End of 4.1 tests
#
CREATE TABLE t1(a SET('a') NOT NULL, UNIQUE KEY(a));
CREATE TABLE t2(b INT PRIMARY KEY);
-INSERT INTO t1 VALUES ();
+INSERT IGNORE INTO t1 VALUES ();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
INSERT INTO t2 VALUES (1), (2), (3);
@@ -224,7 +224,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10.0 AND a LIKE 10.00;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 10.0) and (`test`.`t1`.`a` like 10.00))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 10.0 and `test`.`t1`.`a` like 10.00
DROP TABLE t1;
#
# MDEV-8599 "WHERE varchar_field LIKE temporal_const" does not use range optimizer
@@ -254,3 +254,38 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
+create view v1 as select 'foo!' like 'foo!!', 'foo!' like 'foo!!' escape '!';
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'foo!' like 'foo!!' AS `'foo!' like 'foo!!'`,'foo!' like 'foo!!' escape '!' AS `'foo!' like 'foo!!' escape '!'` koi8r koi8r_general_ci
+select * from v1;
+'foo!' like 'foo!!' 'foo!' like 'foo!!' escape '!'
+0 1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(100) DEFAULT NULL,
+ `b` int(11) DEFAULT (`a` like '%f\\_'),
+ `c` int(11) DEFAULT (`a` like '%f\\_' escape ''),
+ `d` int(11) DEFAULT (`a` like '%f\\_' escape '\\')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+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;
+a b c d
+1 f_ 1 0 1
+1 f\_ 0 1 0
+2 f_ 1 0 1
+2 f\_ 0 1 0
+3 f_ 1 0 1
+3 f\_ 0 1 0
+drop table t1;
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index f694d25cb04..ff2e929cffc 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -6,7 +6,7 @@ explain extended select floor(5.5),floor(-5.5);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select floor(5.5) AS `floor(5.5)`,floor(-(5.5)) AS `floor(-5.5)`
+Note 1003 select floor(5.5) AS `floor(5.5)`,floor(-5.5) AS `floor(-5.5)`
select ceiling(5.5),ceiling(-5.5);
ceiling(5.5) ceiling(-5.5)
6 -5
@@ -14,7 +14,7 @@ explain extended select ceiling(5.5),ceiling(-5.5);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select ceiling(5.5) AS `ceiling(5.5)`,ceiling(-(5.5)) AS `ceiling(-5.5)`
+Note 1003 select ceiling(5.5) AS `ceiling(5.5)`,ceiling(-5.5) AS `ceiling(-5.5)`
select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
truncate(52.64,1) truncate(52.64,2) truncate(52.64,-1) truncate(52.64,-2) truncate(-52.64,1) truncate(-52.64,-1)
52.6 52.64 50 0 -52.6 -50
@@ -22,7 +22,7 @@ explain extended select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),t
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select truncate(52.64,1) AS `truncate(52.64,1)`,truncate(52.64,2) AS `truncate(52.64,2)`,truncate(52.64,-(1)) AS `truncate(52.64,-1)`,truncate(52.64,-(2)) AS `truncate(52.64,-2)`,truncate(-(52.64),1) AS `truncate(-52.64,1)`,truncate(-(52.64),-(1)) AS `truncate(-52.64,-1)`
+Note 1003 select truncate(52.64,1) AS `truncate(52.64,1)`,truncate(52.64,2) AS `truncate(52.64,2)`,truncate(52.64,-1) AS `truncate(52.64,-1)`,truncate(52.64,-2) AS `truncate(52.64,-2)`,truncate(-52.64,1) AS `truncate(-52.64,1)`,truncate(-52.64,-1) AS `truncate(-52.64,-1)`
select round(5.5),round(-5.5);
round(5.5) round(-5.5)
6 -6
@@ -30,7 +30,7 @@ explain extended select round(5.5),round(-5.5);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select round(5.5,0) AS `round(5.5)`,round(-(5.5),0) AS `round(-5.5)`
+Note 1003 select round(5.5,0) AS `round(5.5)`,round(-5.5,0) AS `round(-5.5)`
select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
round(5.64,1) round(5.64,2) round(5.64,-1) round(5.64,-2)
5.6 5.64 10 0
@@ -41,39 +41,52 @@ explain extended select abs(-10), sign(-5), sign(5), sign(0);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select abs(-(10)) AS `abs(-10)`,sign(-(5)) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)`
+Note 1003 select abs(-10) AS `abs(-10)`,sign(-5) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)`
select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
log(exp(10)) exp(log(sqrt(10))*2) log(-1) log(NULL) log(1,1) log(3,9) log(-1,2) log(NULL,2)
10 10.000000000000002 NULL NULL NULL 2 NULL NULL
+Warnings:
+Warning 1365 Division by 0
+Warning 1365 Division by 0
+Warning 1365 Division by 0
explain extended select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select log(exp(10)) AS `log(exp(10))`,exp((log(sqrt(10)) * 2)) AS `exp(log(sqrt(10))*2)`,log(-(1)) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-(1),2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)`
+Note 1003 select log(exp(10)) AS `log(exp(10))`,exp(log(sqrt(10)) * 2) AS `exp(log(sqrt(10))*2)`,log(-1) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-1,2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)`
select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
ln(exp(10)) exp(ln(sqrt(10))*2) ln(-1) ln(0) ln(NULL)
10 10.000000000000002 NULL NULL NULL
+Warnings:
+Warning 1365 Division by 0
+Warning 1365 Division by 0
explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
+Note 1003 select ln(exp(10)) AS `ln(exp(10))`,exp(ln(sqrt(10)) * 2) AS `exp(ln(sqrt(10))*2)`,ln(-1) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
log2(8) log2(15) log2(-2) log2(0) log2(NULL)
3 3.9068905956085187 NULL NULL NULL
+Warnings:
+Warning 1365 Division by 0
+Warning 1365 Division by 0
explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
+Note 1003 select log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-2) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
log10(100) log10(18) log10(-4) log10(0) log10(NULL)
2 1.255272505103306 NULL NULL NULL
+Warnings:
+Warning 1365 Division by 0
+Warning 1365 Division by 0
explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select log10(100) AS `log10(100)`,log10(18) AS `log10(18)`,log10(-(4)) AS `log10(-4)`,log10(0) AS `log10(0)`,log10(NULL) AS `log10(NULL)`
+Note 1003 select log10(100) AS `log10(100)`,log10(18) AS `log10(18)`,log10(-4) AS `log10(-4)`,log10(0) AS `log10(0)`,log10(NULL) AS `log10(NULL)`
select pow(10,log10(10)),power(2,4);
pow(10,log10(10)) power(2,4)
10 16
@@ -98,7 +111,7 @@ explain extended select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select pi() AS `pi()`,format(sin((pi() / 2)),6) AS `format(sin(pi()/2),6)`,format(cos((pi() / 2)),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format(cot(1),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)`
+Note 1003 select pi() AS `pi()`,format(sin(pi() / 2),6) AS `format(sin(pi()/2),6)`,format(cos(pi() / 2),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format(cot(1),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)`
select degrees(pi()),radians(360);
degrees(pi()) radians(360)
180 6.283185307179586
@@ -356,28 +369,28 @@ round(1.12e1, 4294967296) truncate(1.12e1, 4294967296)
11.2 11.2
select round(1.5, 2147483640), truncate(1.5, 2147483640);
round(1.5, 2147483640) truncate(1.5, 2147483640)
-1.500000000000000000000000000000 1.500000000000000000000000000000
+1.50000000000000000000000000000000000000 1.50000000000000000000000000000000000000
select round(1.5, -2147483649), round(1.5, 2147483648);
round(1.5, -2147483649) round(1.5, 2147483648)
-0 1.500000000000000000000000000000
+0 1.50000000000000000000000000000000000000
select truncate(1.5, -2147483649), truncate(1.5, 2147483648);
truncate(1.5, -2147483649) truncate(1.5, 2147483648)
-0 1.500000000000000000000000000000
+0 1.50000000000000000000000000000000000000
select round(1.5, -4294967296), round(1.5, 4294967296);
round(1.5, -4294967296) round(1.5, 4294967296)
-0 1.500000000000000000000000000000
+0 1.50000000000000000000000000000000000000
select truncate(1.5, -4294967296), truncate(1.5, 4294967296);
truncate(1.5, -4294967296) truncate(1.5, 4294967296)
-0 1.500000000000000000000000000000
+0 1.50000000000000000000000000000000000000
select round(1.5, -9223372036854775808), round(1.5, 9223372036854775808);
round(1.5, -9223372036854775808) round(1.5, 9223372036854775808)
-0 1.500000000000000000000000000000
+0 1.50000000000000000000000000000000000000
select truncate(1.5, -9223372036854775808), truncate(1.5, 9223372036854775808);
truncate(1.5, -9223372036854775808) truncate(1.5, 9223372036854775808)
-0 1.500000000000000000000000000000
+0 1.50000000000000000000000000000000000000
select round(1.5, 18446744073709551615), truncate(1.5, 18446744073709551615);
round(1.5, 18446744073709551615) truncate(1.5, 18446744073709551615)
-1.500000000000000000000000000000 1.500000000000000000000000000000
+1.50000000000000000000000000000000000000 1.50000000000000000000000000000000000000
select round(18446744073709551614, -1), truncate(18446744073709551614, -1);
round(18446744073709551614, -1) truncate(18446744073709551614, -1)
18446744073709551610 18446744073709551610
@@ -486,13 +499,13 @@ Warning 1292 Truncated incorrect INTEGER value: 'a'
DROP TABLE t1;
End of 5.0 tests
SELECT 1e308 + 1e308;
-ERROR 22003: DOUBLE value is out of range in '(1e308 + 1e308)'
+ERROR 22003: DOUBLE value is out of range in '1e308 + 1e308'
SELECT -1e308 - 1e308;
-ERROR 22003: DOUBLE value is out of range in '(-(1e308) - 1e308)'
+ERROR 22003: DOUBLE value is out of range in '-1e308 - 1e308'
SELECT 1e300 * 1e300;
-ERROR 22003: DOUBLE value is out of range in '(1e300 * 1e300)'
+ERROR 22003: DOUBLE value is out of range in '1e300 * 1e300'
SELECT 1e300 / 1e-300;
-ERROR 22003: DOUBLE value is out of range in '(1e300 / 1e-300)'
+ERROR 22003: DOUBLE value is out of range in '1e300 / 1e-300'
SELECT EXP(750);
ERROR 22003: DOUBLE value is out of range in 'exp(750)'
SELECT POW(10, 309);
@@ -519,9 +532,9 @@ DROP TABLE t1;
# Bug#57477 SIGFPE when dividing a huge number a negative number
#
SELECT -9999999999999999991 DIV -1;
-ERROR 22003: BIGINT value is out of range in '(-(9999999999999999991) DIV -(1))'
+ERROR 22003: BIGINT value is out of range in '-9999999999999999991 DIV -1'
SELECT -9223372036854775808 DIV -1;
-ERROR 22003: BIGINT value is out of range in '(-(9223372036854775808) DIV -(1))'
+ERROR 22003: BIGINT value is out of range in '-9223372036854775808 DIV -1'
SELECT -9223372036854775808 MOD -1;
-9223372036854775808 MOD -1
0
@@ -529,13 +542,13 @@ SELECT -9223372036854775808999 MOD -1;
-9223372036854775808999 MOD -1
0
select 123456789012345678901234567890.123456789012345678901234567890 div 1 as x;
-ERROR 22003: BIGINT value is out of range in '(123456789012345678901234567890.123456789012345678901234567890 DIV 1)'
+ERROR 22003: BIGINT value is out of range in '123456789012345678901234567890.123456789012345678901234567890 DIV 1'
select "123456789012345678901234567890.123456789012345678901234567890" div 1 as x;
-ERROR 22003: BIGINT value is out of range in '('123456789012345678901234567890.123456789012345678901234567890' DIV 1)'
+ERROR 22003: BIGINT value is out of range in ''123456789012345678901234567890.123456789012345678901234567890' DIV 1'
SHOW WARNINGS;
Level Code Message
-Warning 1916 Got overflow when converting '123456789012345678901234567890' to INT. Value truncated.
-Error 1690 BIGINT value is out of range in '('123456789012345678901234567890.123456789012345678901234567890' DIV 1)'
+Warning 1916 Got overflow when converting '123456789012345678901234567890' to INT. Value truncated
+Error 1690 BIGINT value is out of range in ''123456789012345678901234567890.123456789012345678901234567890' DIV 1'
#
# Bug#57810 case/when/then : Assertion failed: length || !scale
#
@@ -589,13 +602,13 @@ End of 5.1 tests
# Bug #8433: Overflow must be an error
#
SELECT 1e308 + 1e308;
-ERROR 22003: DOUBLE value is out of range in '(1e308 + 1e308)'
+ERROR 22003: DOUBLE value is out of range in '1e308 + 1e308'
SELECT -1e308 - 1e308;
-ERROR 22003: DOUBLE value is out of range in '(-(1e308) - 1e308)'
+ERROR 22003: DOUBLE value is out of range in '-1e308 - 1e308'
SELECT 1e300 * 1e300;
-ERROR 22003: DOUBLE value is out of range in '(1e300 * 1e300)'
+ERROR 22003: DOUBLE value is out of range in '1e300 * 1e300'
SELECT 1e300 / 1e-300;
-ERROR 22003: DOUBLE value is out of range in '(1e300 / 1e-300)'
+ERROR 22003: DOUBLE value is out of range in '1e300 / 1e-300'
SELECT EXP(750);
ERROR 22003: DOUBLE value is out of range in 'exp(750)'
SELECT POW(10, 309);
@@ -605,89 +618,91 @@ ERROR 22003: DOUBLE value is out of range in 'cot(0)'
SELECT DEGREES(1e307);
ERROR 22003: DOUBLE value is out of range in 'degrees(1e307)'
SELECT 9223372036854775808 + 9223372036854775808;
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(9223372036854775808 + 9223372036854775808)'
+ERROR 22003: BIGINT UNSIGNED value is out of range in '9223372036854775808 + 9223372036854775808'
SELECT 18446744073709551615 + 1;
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 + 1)'
+ERROR 22003: BIGINT UNSIGNED value is out of range in '18446744073709551615 + 1'
SELECT 1 + 18446744073709551615;
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(1 + 18446744073709551615)'
+ERROR 22003: BIGINT UNSIGNED value is out of range in '1 + 18446744073709551615'
SELECT -2 + CAST(1 AS UNSIGNED);
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(-(2) + cast(1 as unsigned))'
+ERROR 22003: BIGINT UNSIGNED value is out of range in '-2 + cast(1 as unsigned)'
SELECT CAST(1 AS UNSIGNED) + -2;
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(cast(1 as unsigned) + -(2))'
+ERROR 22003: BIGINT UNSIGNED value is out of range in 'cast(1 as unsigned) + -2'
SELECT -9223372036854775808 + -9223372036854775808;
-ERROR 22003: BIGINT value is out of range in '(-(9223372036854775808) + -(9223372036854775808))'
+ERROR 22003: BIGINT value is out of range in '-9223372036854775808 + -9223372036854775808'
SELECT 9223372036854775807 + 9223372036854775807;
-ERROR 22003: BIGINT value is out of range in '(9223372036854775807 + 9223372036854775807)'
+ERROR 22003: BIGINT value is out of range in '9223372036854775807 + 9223372036854775807'
SELECT CAST(0 AS UNSIGNED) - 9223372036854775809;
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(cast(0 as unsigned) - 9223372036854775809)'
+ERROR 22003: BIGINT UNSIGNED value is out of range in 'cast(0 as unsigned) - 9223372036854775809'
SELECT 9223372036854775808 - 9223372036854775809;
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(9223372036854775808 - 9223372036854775809)'
+ERROR 22003: BIGINT UNSIGNED value is out of range in '9223372036854775808 - 9223372036854775809'
SELECT CAST(1 AS UNSIGNED) - 2;
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(cast(1 as unsigned) - 2)'
+ERROR 22003: BIGINT UNSIGNED value is out of range in 'cast(1 as unsigned) - 2'
SELECT 18446744073709551615 - (-1);
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 - -(1))'
+ERROR 22003: BIGINT UNSIGNED value is out of range in '18446744073709551615 - -1'
SELECT -1 - 9223372036854775808;
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(-(1) - 9223372036854775808)'
+ERROR 22003: BIGINT UNSIGNED value is out of range in '-1 - 9223372036854775808'
SELECT -1 - CAST(1 AS UNSIGNED);
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(-(1) - cast(1 as unsigned))'
+ERROR 22003: BIGINT UNSIGNED value is out of range in '-1 - cast(1 as unsigned)'
SELECT -9223372036854775808 - 1;
-ERROR 22003: BIGINT value is out of range in '(-(9223372036854775808) - 1)'
+ERROR 22003: BIGINT value is out of range in '-9223372036854775808 - 1'
SELECT 9223372036854775807 - -9223372036854775808;
-ERROR 22003: BIGINT value is out of range in '(9223372036854775807 - -(9223372036854775808))'
+ERROR 22003: BIGINT value is out of range in '9223372036854775807 - -9223372036854775808'
set SQL_MODE='NO_UNSIGNED_SUBTRACTION';
SELECT 18446744073709551615 - 1;
-ERROR 22003: BIGINT value is out of range in '(18446744073709551615 - 1)'
+ERROR 22003: BIGINT value is out of range in '18446744073709551615 - 1'
SELECT 18446744073709551615 - CAST(1 AS UNSIGNED);
-ERROR 22003: BIGINT value is out of range in '(18446744073709551615 - cast(1 as unsigned))'
+ERROR 22003: BIGINT value is out of range in '18446744073709551615 - cast(1 as unsigned)'
SELECT 18446744073709551614 - (-1);
-ERROR 22003: BIGINT value is out of range in '(18446744073709551614 - -(1))'
+ERROR 22003: BIGINT value is out of range in '18446744073709551614 - -1'
SELECT 9223372036854775807 - -1;
-ERROR 22003: BIGINT value is out of range in '(9223372036854775807 - -(1))'
+ERROR 22003: BIGINT value is out of range in '9223372036854775807 - -1'
set SQL_MODE=default;
SELECT 4294967296 * 4294967296;
-ERROR 22003: BIGINT value is out of range in '(4294967296 * 4294967296)'
+ERROR 22003: BIGINT value is out of range in '4294967296 * 4294967296'
SELECT 9223372036854775808 * 2;
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(9223372036854775808 * 2)'
+ERROR 22003: BIGINT UNSIGNED value is out of range in '9223372036854775808 * 2'
SELECT 9223372036854775808 * 2;
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(9223372036854775808 * 2)'
+ERROR 22003: BIGINT UNSIGNED value is out of range in '9223372036854775808 * 2'
SELECT 7158278827 * 3221225472;
-ERROR 22003: BIGINT value is out of range in '(7158278827 * 3221225472)'
+ERROR 22003: BIGINT value is out of range in '7158278827 * 3221225472'
SELECT 9223372036854775807 * (-2);
-ERROR 22003: BIGINT value is out of range in '(9223372036854775807 * -(2))'
+ERROR 22003: BIGINT value is out of range in '9223372036854775807 * -2'
SELECT CAST(1 as UNSIGNED) * (-1);
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(cast(1 as unsigned) * -(1))'
+ERROR 22003: BIGINT UNSIGNED value is out of range in 'cast(1 as unsigned) * -1'
SELECT 9223372036854775807 * 2;
-ERROR 22003: BIGINT value is out of range in '(9223372036854775807 * 2)'
+ERROR 22003: BIGINT value is out of range in '9223372036854775807 * 2'
SELECT ABS(-9223372036854775808);
-ERROR 22003: BIGINT value is out of range in 'abs(-(9223372036854775808))'
+ERROR 22003: BIGINT value is out of range in 'abs(-9223372036854775808)'
SELECT -9223372036854775808 DIV -1;
-ERROR 22003: BIGINT value is out of range in '(-(9223372036854775808) DIV -(1))'
+ERROR 22003: BIGINT value is out of range in '-9223372036854775808 DIV -1'
SELECT 18446744073709551615 DIV -1;
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 DIV -(1))'
+ERROR 22003: BIGINT UNSIGNED value is out of range in '18446744073709551615 DIV -1'
CREATE TABLE t1(a BIGINT, b BIGINT UNSIGNED);
INSERT INTO t1 VALUES(-9223372036854775808, 9223372036854775809);
SELECT -a FROM t1;
-ERROR 22003: BIGINT value is out of range in '-(`test`.`t1`.`a`)'
+ERROR 22003: BIGINT value is out of range in '-`test`.`t1`.`a`'
SELECT -b FROM t1;
-ERROR 22003: BIGINT value is out of range in '-(`test`.`t1`.`b`)'
+ERROR 22003: BIGINT value is out of range in '-`test`.`t1`.`b`'
INSERT INTO t1 VALUES(0,0);
SELECT -a FROM t1;
-ERROR 22003: BIGINT value is out of range in '-(`test`.`t1`.`a`)'
+ERROR 22003: BIGINT value is out of range in '-`test`.`t1`.`a`'
SELECT -b FROM t1;
-ERROR 22003: BIGINT value is out of range in '-(`test`.`t1`.`b`)'
+ERROR 22003: BIGINT value is out of range in '-`test`.`t1`.`b`'
DROP TABLE t1;
SET @a:=999999999999999999999999999999999999999999999999999999999999999999999999999999999;
SELECT @a + @a;
-ERROR 22003: DECIMAL value is out of range in '((@`a`) + (@`a`))'
+ERROR 22003: DECIMAL value is out of range in '@`a` + @`a`'
SELECT @a * @a;
-ERROR 22003: DECIMAL value is out of range in '((@`a`) * (@`a`))'
+ERROR 22003: DECIMAL value is out of range in '@`a` * @`a`'
SELECT -@a - @a;
-ERROR 22003: DECIMAL value is out of range in '(-((@`a`)) - (@`a`))'
+ERROR 22003: DECIMAL value is out of range in '-@`a` - @`a`'
SELECT @a / 0.5;
-ERROR 22003: DECIMAL value is out of range in '((@`a`) / 0.5)'
+ERROR 22003: DECIMAL value is out of range in '@`a` / 0.5'
SELECT COT(1/0);
COT(1/0)
NULL
+Warnings:
+Warning 1365 Division by 0
SELECT -1 + 9223372036854775808;
-1 + 9223372036854775808
9223372036854775807
@@ -697,6 +712,9 @@ SELECT 2 DIV -2;
SELECT -(1 DIV 0);
-(1 DIV 0)
NULL
+Warnings:
+Warning 1365 Division by 0
+Warning 1365 Division by 0
SELECT -9223372036854775808 MOD -1;
-9223372036854775808 MOD -1
0
@@ -715,7 +733,7 @@ Warning 1292 Truncated incorrect DOUBLE value: '179,769,313,486,231,570,000,000,
# my_gcvt: Assertion `width > 0 && to != ((void *)0)' failed
#
CREATE TABLE t1(a char(0));
-INSERT INTO t1 (SELECT -pi());
+INSERT IGNORE INTO t1 (SELECT -pi());
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
DROP TABLE t1;
@@ -728,6 +746,7 @@ SELECT ((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa')));
NULL
Warnings:
Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1365 Division by 0
#
# Bug #59498 div function broken in mysql-trunk
#
@@ -741,7 +760,7 @@ select (1.175494351E-37 div 1.7976931348623157E+308);
(1.175494351E-37 div 1.7976931348623157E+308)
0
Warnings:
-Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated.
+Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
#
# Bug#12744991 - DECIMAL_ROUND(X,D) GIVES WRONG RESULTS WHEN D == N*(-9)
#
@@ -767,6 +786,8 @@ foo
select 999999999999999999999999999999999999999999999999999999999999999999999999999999999 % 0.0 as foo;
foo
NULL
+Warnings:
+Warning 1365 Division by 0
#
# Bug#12711164 - 61676:
# RESULT OF DIV WITH DECIMAL AND INTEGER DOES NOT MAKE SENSE
@@ -805,5 +826,20 @@ SELECT STDDEV_POP(ROUND(0,@A:=2009)) FROM (SELECT 1 UNION SELECT 2) fake_table;
STDDEV_POP(ROUND(0,@A:=2009))
0.0000
#
-# End of 10.0 tests
+# Start of 10.2 tests
+#
+# Test zero
+select 0=0, 0=-0, 0.0= -0.0, 0.0 = -(0.0), 0.0E1=-0.0E1, 0.0E1=-(0.0E1);
+0=0 0=-0 0.0= -0.0 0.0 = -(0.0) 0.0E1=-0.0E1 0.0E1=-(0.0E1)
+1 1 1 1 1 1
+#
+# CRC32 tests
#
+select CRC32(NULL), CRC32(''), CRC32('MySQL'), CRC32('mysql'), CRC32('01234567'), CRC32('012345678');
+CRC32(NULL) CRC32('') CRC32('MySQL') CRC32('mysql') CRC32('01234567') CRC32('012345678')
+NULL 0 3259397556 2501908538 763378421 939184570
+explain extended select (3-2)+1, (3/2)*1, 3-(2+1), 3/(2*1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select 3 - 2 + 1 AS `(3-2)+1`,3 / 2 * 1 AS `(3/2)*1`,3 - (2 + 1) AS `3-(2+1)`,3 / (2 * 1) AS `3/(2*1)`
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index 1f9aa212740..c3c03242caf 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -62,6 +62,7 @@ INSERT INTO t1 VALUES ('default', CONNECTION_ID());
SELECT GET_LOCK('bug16501',600);
GET_LOCK('bug16501',600)
1
+connect con1,localhost,root,,;
INSERT INTO t1 VALUES ('con1', CONNECTION_ID());
SELECT IS_USED_LOCK('bug16501') = connection_id
FROM t1
@@ -69,19 +70,23 @@ WHERE conn = 'default';
IS_USED_LOCK('bug16501') = connection_id
1
SELECT GET_LOCK('bug16501',600);
+connection default;
SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
IS_USED_LOCK('bug16501') = CONNECTION_ID()
1
SELECT RELEASE_LOCK('bug16501');
RELEASE_LOCK('bug16501')
1
+connection con1;
GET_LOCK('bug16501',600)
1
+connection default;
SELECT IS_USED_LOCK('bug16501') = connection_id
FROM t1
WHERE conn = 'con1';
IS_USED_LOCK('bug16501') = connection_id
1
+connection con1;
SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
IS_USED_LOCK('bug16501') = CONNECTION_ID()
1
@@ -91,6 +96,8 @@ RELEASE_LOCK('bug16501')
SELECT IS_USED_LOCK('bug16501');
IS_USED_LOCK('bug16501')
NULL
+disconnect con1;
+connection default;
DROP TABLE t1;
select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
export_set(3, _latin1'foo', _utf8'bar', ',', 4)
@@ -100,8 +107,8 @@ create table t1 as select uuid(), length(uuid());
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `uuid()` varchar(36) CHARACTER SET utf8 NOT NULL,
- `length(uuid())` int(10) NOT NULL
+ `uuid()` varchar(36) CHARACTER SET utf8 DEFAULT NULL,
+ `length(uuid())` int(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 select INET_ATON('255.255.0.1') as `a`;
@@ -347,7 +354,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY tv ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join)
2 DEPENDENT SUBQUERY tv system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on((`test`.`tv`.`e` = `test`.`t1`.`a`)) where (not(<expr_cache><last_value(NULL,`test`.`tv`.`e`)>(<in_optimizer>(last_value(NULL,`test`.`tv`.`e`),<exists>(select last_value(NULL,'1') from dual where trigcond((<cache>(last_value(NULL,`test`.`tv`.`e`)) = last_value(NULL,'1'))))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on(`test`.`tv`.`e` = `test`.`t1`.`a`) where !<expr_cache><last_value(NULL,`test`.`tv`.`e`)>(<in_optimizer>(last_value(NULL,`test`.`tv`.`e`),<exists>(select last_value(NULL,'1') from dual where trigcond(<cache>(last_value(NULL,`test`.`tv`.`e`)) = last_value(NULL,'1')))))
explain extended
select a from t1 left join v_merge on (a=e) where e not in (select last_value(NULL,e) from vm);
id select_type table type possible_keys key key_len ref rows filtered Extra
@@ -355,7 +362,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY tv ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join)
2 DEPENDENT SUBQUERY tv system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on((`test`.`tv`.`e` = `test`.`t1`.`a`)) where (not(<expr_cache><`test`.`tv`.`e`>(<in_optimizer>(`test`.`tv`.`e`,<exists>(select last_value(NULL,'1') from dual where trigcond((<cache>(`test`.`tv`.`e`) = last_value(NULL,'1'))))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on(`test`.`tv`.`e` = `test`.`t1`.`a`) where !<expr_cache><`test`.`tv`.`e`>(<in_optimizer>(`test`.`tv`.`e`,<exists>(select last_value(NULL,'1') from dual where trigcond(<cache>(`test`.`tv`.`e`) = last_value(NULL,'1')))))
set optimizer_switch=@optimizer_switch_save;
drop view v_merge, vm;
drop table t1,tv;
@@ -613,7 +620,8 @@ is_free_lock('test')
select is_used_lock('test') = connection_id();
is_used_lock('test') = connection_id()
1
-# -> Switching to connection 'con1'
+connect con1,localhost,root,,;
+connection con1;
# IS_USED_LOCK, IS_FREE_LOCK: the lock is acquired in another
# connection
select is_used_lock('test') = connection_id();
@@ -630,7 +638,7 @@ get_lock('test', 0)
select release_lock('test');
release_lock('test')
0
-# -> Switching to connection 'default'
+connection default;
# RELEASE_LOCK returns 1 if it successfully releases a lock
select release_lock('test');
release_lock('test')
@@ -643,18 +651,18 @@ NULL
select get_lock('test', 0);
get_lock('test', 0)
1
-# -> Switching to connection 'con1'
+connection con1;
create table t1 select connection_id() as id;
select get_lock('test', 7200);
-# -> Switching to connection 'default'
+connection default;
select (@id := id) - id from t1;
(@id := id) - id
0
kill query @id;
-# -> Switching to connection 'con1'
+connection con1;
get_lock('test', 7200)
NULL
-# -> Switching to connection 'default'
+connection default;
# GET_LOCK() works recursively
select get_lock('test', 0);
get_lock('test', 0)
@@ -703,18 +711,18 @@ release_lock('test3')
select get_lock('test1', 0);
get_lock('test1', 0)
1
-# -> Switching to connection 'con1'
+connection con1;
select get_lock('test2', 0);
get_lock('test2', 0)
1
select get_lock('test1', 7200);
-# -> Switching to connection 'default'
+connection default;
select get_lock('test2', 7200);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
select release_lock('test1');
release_lock('test1')
1
-# -> Switching to connection 'con1'
+connection con1;
get_lock('test1', 7200)
1
select release_lock('test2');
@@ -723,7 +731,7 @@ release_lock('test2')
select release_lock('test1');
release_lock('test1')
1
-# -> Switching to connection 'default'
+connection default;
# LOCK/UNLOCK TABLES works fine with a user lock.
lock table t1 write;
select get_lock('test', 0);
@@ -773,16 +781,16 @@ release_lock('test2')
select get_lock('test', 0);
get_lock('test', 0)
1
-# -> Switching to connection 'con1'
+connection con1;
lock table t1 write;
select get_lock('test', 7200);
-# -> Switching to connection 'default'
+connection default;
lock table t1 read;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
select release_lock('test');
release_lock('test')
1
-# -> Switching to connection 'con1'
+connection con1;
get_lock('test', 7200)
1
select release_lock('test');
@@ -790,6 +798,8 @@ release_lock('test')
1
unlock tables;
# cleanup
+disconnect con1;
+connection default;
drop table t1;
# check too long identifier names
select get_lock(repeat('a', 192), 0);
@@ -1400,7 +1410,7 @@ DROP TABLE t2;
#
# MDEV-4018 : Microseconds in GET_LOCK()
#
-# -> Switching to connection 'default'
+connection default;
select is_used_lock('test') = connection_id();
is_used_lock('test') = connection_id()
NULL
@@ -1408,7 +1418,8 @@ NULL
select get_lock('test', 0);
get_lock('test', 0)
1
-# -> Switching to connection 'con1'
+connect con1,localhost,root,,;
+connection con1;
select is_used_lock('test') = connection_id();
is_used_lock('test') = connection_id()
0
@@ -1430,7 +1441,7 @@ get_lock('test', 0.000001)
select get_lock('test', 0.0000000000000001);
get_lock('test', 0.0000000000000001)
0
-# -> Switching to connection 'default'
+connection default;
select is_used_lock('test') = connection_id();
is_used_lock('test') = connection_id()
1
@@ -1471,3 +1482,72 @@ CALL p1();
ip_full_addr
2000::
DROP PROCEDURE p1;
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-10134 Add full support for DEFAULT
+#
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(30) DEFAULT NULL,
+ `b` bigint(20) DEFAULT inet_aton(`a`),
+ `a1` varchar(30) DEFAULT inet_ntoa(`b`),
+ `c` int(11) DEFAULT is_ipv4(`a`),
+ `d` int(11) DEFAULT is_ipv6(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('192.168.001.001'),('::1'),('xxx');
+SELECT * FROM t1;
+a b a1 c d
+192.168.001.001 3232235777 192.168.1.1 1 0
+::1 NULL NULL 0 1
+xxx NULL NULL 0 0
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `str` varchar(128) DEFAULT NULL,
+ `addr` varbinary(16) DEFAULT inet6_aton(`str`),
+ `str1` varchar(128) DEFAULT inet6_ntoa(`addr`),
+ `b` int(11) DEFAULT is_ipv4_compat(`addr`),
+ `c` int(11) DEFAULT is_ipv4_mapped(`addr`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (str) VALUES ('::FFFF:192.168.0.1'),('::10.0.5.9');
+SELECT str, str1, b,c FROM t1;
+str str1 b c
+::FFFF:192.168.0.1 ::ffff:192.168.0.1 0 1
+::10.0.5.9 ::10.0.5.9 1 0
+DROP TABLE t1;
+#
+# MDEV-14613: Assertion `fixed == 0' failed in Item_func::fix_fields
+#
+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');
+numgtfmt
+DROP VIEW v1;
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/func_op.result b/mysql-test/r/func_op.result
index ce755e86b4c..685aba1075f 100644
--- a/mysql-test/r/func_op.result
+++ b/mysql-test/r/func_op.result
@@ -5,7 +5,7 @@ explain extended select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select (1 + 1) AS `1+1`,(1 - 1) AS `1-1`,(1 + (1 * 2)) AS `1+1*2`,(8 / 5) AS `8/5`,(8 % 5) AS `8%5`,(8 % 5) AS `mod(8,5)`,((8 % 5) | 0) AS `mod(8,5)|0`,(-((1 + 1)) * -(2)) AS `-(1+1)*-2`
+Note 1003 select 1 + 1 AS `1+1`,1 - 1 AS `1-1`,1 + 1 * 2 AS `1+1*2`,8 / 5 AS `8/5`,8 % 5 AS `8%5`,8 % 5 AS `mod(8,5)`,8 % 5 | 0 AS `mod(8,5)|0`,-(1 + 1) * -2 AS `-(1+1)*-2`
select 1 | (1+1),5 & 3,bit_count(7) ;
1 | (1+1) 5 & 3 bit_count(7)
3 1 3
@@ -13,7 +13,7 @@ explain extended select 1 | (1+1),5 & 3,bit_count(7) ;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select (1 | (1 + 1)) AS `1 | (1+1)`,(5 & 3) AS `5 & 3`,bit_count(7) AS `bit_count(7)`
+Note 1003 select 1 | 1 + 1 AS `1 | (1+1)`,5 & 3 AS `5 & 3`,bit_count(7) AS `bit_count(7)`
select 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60;
1 << 32 1 << 63 1 << 64 4 >> 2 4 >> 63 1<< 63 >> 60
4294967296 9223372036854775808 0 1 0 8
diff --git a/mysql-test/r/func_regexp_pcre.result b/mysql-test/r/func_regexp_pcre.result
index cda1c2e7e69..e030df99756 100644
--- a/mysql-test/r/func_regexp_pcre.result
+++ b/mysql-test/r/func_regexp_pcre.result
@@ -436,7 +436,7 @@ CREATE TABLE t1 AS SELECT REGEXP_REPLACE('abc','b','x');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `REGEXP_REPLACE('abc','b','x')` longtext CHARACTER SET utf8 NOT NULL
+ `REGEXP_REPLACE('abc','b','x')` longtext CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
EXPLAIN EXTENDED SELECT REGEXP_REPLACE('abc','b','x');
@@ -444,6 +444,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select regexp_replace('abc','b','x') AS `REGEXP_REPLACE('abc','b','x')`
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t1 AS SELECT REGEXP_REPLACE('abc','b','x')+0;
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'axc'
@@ -738,7 +739,7 @@ CREATE TABLE t1 AS SELECT REGEXP_SUBSTR('abc','b');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `REGEXP_SUBSTR('abc','b')` varchar(3) CHARACTER SET utf8 NOT NULL
+ `REGEXP_SUBSTR('abc','b')` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
EXPLAIN EXTENDED SELECT REGEXP_SUBSTR('abc','b');
@@ -746,6 +747,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select regexp_substr('abc','b') AS `REGEXP_SUBSTR('abc','b')`
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t1 AS SELECT REGEXP_SUBSTR('abc','b')+0;
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'b'
@@ -924,3 +926,5 @@ REGEXP_INSTR('a_kollision', '(oll)')
SELECT REGEXP_INSTR('a_kollision', 'o([lm])\\1');
REGEXP_INSTR('a_kollision', 'o([lm])\\1')
4
+SELECT a FROM (SELECT "aa" a) t WHERE a REGEXP '[0-9]';
+a
diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result
index 23931bde1b5..73e121f5f2b 100644
--- a/mysql-test/r/func_set.result
+++ b/mysql-test/r/func_set.result
@@ -5,7 +5,7 @@ explain extended select INTERVAL(55,10,20,30,40,50,60,70,80,90,100),interval(3,1
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select interval(55,10,20,30,40,50,60,70,80,90,100) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval(3,1,(1 + 1),(((1 + 1) + 1) + 1)) AS `interval(3,1,1+1,1+1+1+1)`,field('IBM','NCA','ICL','SUN','IBM','DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field('A','B','C') AS `field("A","B","C")`,elt(2,'ONE','TWO','THREE') AS `elt(2,"ONE","TWO","THREE")`,interval(0,1,2,3,4) AS `interval(0,1,2,3,4)`,(elt(1,1,2,3) | 0) AS `elt(1,1,2,3)|0`,(elt(1,1.1,1.2,1.3) + 0) AS `elt(1,1.1,1.2,1.3)+0`
+Note 1003 select interval(55,10,20,30,40,50,60,70,80,90,100) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval(3,1,1 + 1,1 + 1 + 1 + 1) AS `interval(3,1,1+1,1+1+1+1)`,field('IBM','NCA','ICL','SUN','IBM','DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field('A','B','C') AS `field("A","B","C")`,elt(2,'ONE','TWO','THREE') AS `elt(2,"ONE","TWO","THREE")`,interval(0,1,2,3,4) AS `interval(0,1,2,3,4)`,elt(1,1,2,3) | 0 AS `elt(1,1,2,3)|0`,elt(1,1.1,1.2,1.3) + 0 AS `elt(1,1.1,1.2,1.3)+0`
SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56);
INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56)
1
@@ -148,7 +148,7 @@ NULL
drop table t1;
CREATE TABLE t1( a SET('a', 'b', 'c') );
CREATE TABLE t2( a SET('a', 'b', 'c') );
-INSERT INTO t1 VALUES ('d');
+INSERT IGNORE INTO t1 VALUES ('d');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
INSERT INTO t2 VALUES ('');
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 3d9c9bc15d9..5334cc055d1 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -1,5 +1,7 @@
drop table if exists t1,t2;
set global max_allowed_packet=1048576;
+connect conn1,localhost,root,,;
+connection conn1;
set names latin1;
select 'hello',"'hello'",'""hello""','''h''e''l''l''o''',"hel""lo",'hel\'lo';
hello 'hello' ""hello"" 'h'e'l'l'o' hel"lo hel'lo
@@ -316,6 +318,8 @@ quote(concat('abc\'', '\\cba'))
select quote(1/0), quote('\0\Z');
quote(1/0) quote('\0\Z')
NULL '\0\Z'
+Warnings:
+Warning 1365 Division by 0
select length(quote(concat(char(0),"test")));
length(quote(concat(char(0),"test")))
8
@@ -585,15 +589,15 @@ select _latin1'B' in (_latin1'a',_latin1'b' collate latin1_bin);
_latin1'B' in (_latin1'a',_latin1'b' collate latin1_bin)
0
select _latin2'B' in (_latin1'a',_latin1'b');
-ERROR HY000: Illegal mix of collations (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation ' IN '
+ERROR HY000: Illegal mix of collations (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation 'in'
select _latin1'B' in (_latin2'a',_latin1'b');
-ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation ' IN '
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation 'in'
select _latin1'B' in (_latin1'a',_latin2'b');
-ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE) for operation ' IN '
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE) for operation 'in'
select _latin1'B' COLLATE latin1_general_ci in (_latin1'a' COLLATE latin1_bin,_latin1'b');
-ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_bin,EXPLICIT), (latin1_swedish_ci,COERCIBLE) for operation ' IN '
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_bin,EXPLICIT), (latin1_swedish_ci,COERCIBLE) for operation 'in'
select _latin1'B' COLLATE latin1_general_ci in (_latin1'a',_latin1'b' COLLATE latin1_bin);
-ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_swedish_ci,COERCIBLE), (latin1_bin,EXPLICIT) for operation ' IN '
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_swedish_ci,COERCIBLE), (latin1_bin,EXPLICIT) for operation 'in'
select collation(bin(130)), coercibility(bin(130));
collation(bin(130)) coercibility(bin(130))
latin1_swedish_ci 4
@@ -727,34 +731,34 @@ t1 CREATE TABLE `t1` (
`bin(130)` varchar(64) DEFAULT NULL,
`oct(130)` varchar(64) DEFAULT NULL,
`conv(130,16,10)` varchar(64) DEFAULT NULL,
- `hex(130)` varchar(6) NOT NULL,
- `char(130)` varbinary(4) NOT NULL,
- `format(130,10)` varchar(37) NOT NULL,
- `left(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL,
- `right(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL,
- `lcase(_latin2'a')` varchar(1) CHARACTER SET latin2 NOT NULL,
- `ucase(_latin2'a')` varchar(1) CHARACTER SET latin2 NOT NULL,
- `substring(_latin2'a',1,1)` varchar(1) CHARACTER SET latin2 NOT NULL,
- `concat(_latin2'a',_latin2'b')` varchar(2) CHARACTER SET latin2 NOT NULL,
- `lpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 NOT NULL,
- `rpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 NOT NULL,
- `concat_ws(_latin2'a',_latin2'b')` varchar(1) CHARACTER SET latin2 NOT NULL,
- `make_set(255,_latin2'a',_latin2'b',_latin2'c')` varchar(5) CHARACTER SET latin2 NOT NULL,
- `export_set(255,_latin2'y',_latin2'n',_latin2' ')` varchar(127) CHARACTER SET latin2 NOT NULL,
- `trim(_latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL,
- `ltrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL,
- `rtrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL,
- `trim(LEADING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL,
- `trim(TRAILING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL,
- `trim(BOTH _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL,
- `repeat(_latin2'a',10)` varchar(10) CHARACTER SET latin2 NOT NULL,
- `reverse(_latin2'ab')` varchar(2) CHARACTER SET latin2 NOT NULL,
- `quote(_latin2'ab')` varchar(6) CHARACTER SET latin2 NOT NULL,
- `soundex(_latin2'ab')` varchar(4) CHARACTER SET latin2 NOT NULL,
- `substring(_latin2'ab',1)` varchar(2) CHARACTER SET latin2 NOT NULL,
- `insert(_latin2'abcd',2,3,_latin2'ef')` varchar(6) CHARACTER SET latin2 NOT NULL,
- `replace(_latin2'abcd',_latin2'b',_latin2'B')` varchar(4) CHARACTER SET latin2 NOT NULL,
- `encode('abcd','ab')` varbinary(4) NOT NULL
+ `hex(130)` varchar(6) DEFAULT NULL,
+ `char(130)` varbinary(4) DEFAULT NULL,
+ `format(130,10)` varchar(45) DEFAULT NULL,
+ `left(_latin2'a',1)` varchar(1) CHARACTER SET latin2 DEFAULT NULL,
+ `right(_latin2'a',1)` varchar(1) CHARACTER SET latin2 DEFAULT NULL,
+ `lcase(_latin2'a')` varchar(1) CHARACTER SET latin2 DEFAULT NULL,
+ `ucase(_latin2'a')` varchar(1) CHARACTER SET latin2 DEFAULT NULL,
+ `substring(_latin2'a',1,1)` varchar(1) CHARACTER SET latin2 DEFAULT NULL,
+ `concat(_latin2'a',_latin2'b')` varchar(2) CHARACTER SET latin2 DEFAULT NULL,
+ `lpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 DEFAULT NULL,
+ `rpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 DEFAULT NULL,
+ `concat_ws(_latin2'a',_latin2'b')` varchar(1) CHARACTER SET latin2 DEFAULT NULL,
+ `make_set(255,_latin2'a',_latin2'b',_latin2'c')` varchar(5) CHARACTER SET latin2 DEFAULT NULL,
+ `export_set(255,_latin2'y',_latin2'n',_latin2' ')` varchar(127) CHARACTER SET latin2 DEFAULT NULL,
+ `trim(_latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL,
+ `ltrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL,
+ `rtrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL,
+ `trim(LEADING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL,
+ `trim(TRAILING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL,
+ `trim(BOTH _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL,
+ `repeat(_latin2'a',10)` varchar(10) CHARACTER SET latin2 DEFAULT NULL,
+ `reverse(_latin2'ab')` varchar(2) CHARACTER SET latin2 DEFAULT NULL,
+ `quote(_latin2'ab')` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `soundex(_latin2'ab')` varchar(4) CHARACTER SET latin2 DEFAULT NULL,
+ `substring(_latin2'ab',1)` varchar(2) CHARACTER SET latin2 DEFAULT NULL,
+ `insert(_latin2'abcd',2,3,_latin2'ef')` varchar(6) CHARACTER SET latin2 DEFAULT NULL,
+ `replace(_latin2'abcd',_latin2'b',_latin2'B')` varchar(4) CHARACTER SET latin2 DEFAULT NULL,
+ `encode('abcd','ab')` varbinary(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a char character set latin2);
@@ -839,7 +843,7 @@ explain extended select 'mood' sounds like 'mud';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select (soundex('mood') = soundex('mud')) AS `'mood' sounds like 'mud'`
+Note 1003 select soundex('mood') = soundex('mud') AS `'mood' sounds like 'mud'`
explain extended select aes_decrypt(aes_encrypt('abc','1'),'1');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
@@ -919,7 +923,7 @@ explain extended select FIELD('b' COLLATE latin1_bin,'A','B');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select field(('b' collate latin1_bin),'A','B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`
+Note 1003 select field('b' collate latin1_bin,'A','B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`
explain extended select FIND_IN_SET(_latin1'B', _latin1'a,b,c,d');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
@@ -974,7 +978,7 @@ explain extended select quote(1/0);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select quote((1 / 0)) AS `quote(1/0)`
+Note 1003 select quote(1 / 0) AS `quote(1/0)`
explain extended select crc32("123");
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
@@ -1060,11 +1064,11 @@ aaaaaaaaaaccccc
bbbbbbbbbbddddd
drop table t1, t2;
create table t1 (c1 INT, c2 INT UNSIGNED);
-insert into t1 values ('21474836461','21474836461');
+insert ignore into t1 values ('21474836461','21474836461');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
Warning 1264 Out of range value for column 'c2' at row 1
-insert into t1 values ('-21474836461','-21474836461');
+insert ignore into t1 values ('-21474836461','-21474836461');
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
Warning 1264 Out of range value for column 'c2' at row 1
@@ -1235,13 +1239,13 @@ create table t1 (i int);
insert into t1 values (1000000000),(1);
select lpad(i, 7, ' ') as t from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def t 253 7 7 Y 0 31 8
+def t 253 7 7 Y 0 39 8
t
1000000
1
select rpad(i, 7, ' ') as t from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def t 253 7 7 Y 0 31 8
+def t 253 7 7 Y 0 39 8
t
1000000
1
@@ -1288,27 +1292,27 @@ EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(s) > 'ab';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(`test`.`t1`.`s`) > 'ab')
+Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(`test`.`t1`.`s`) > 'ab'
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM('y' FROM s) > 'ab';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both 'y' from `test`.`t1`.`s`) > 'ab')
+Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(both 'y' from `test`.`t1`.`s`) > 'ab'
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(LEADING 'y' FROM s) > 'ab';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(leading 'y' from `test`.`t1`.`s`) > 'ab')
+Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(leading 'y' from `test`.`t1`.`s`) > 'ab'
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(TRAILING 'y' FROM s) > 'ab';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(trailing 'y' from `test`.`t1`.`s`) > 'ab')
+Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(trailing 'y' from `test`.`t1`.`s`) > 'ab'
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(BOTH 'y' FROM s) > 'ab';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both 'y' from `test`.`t1`.`s`) > 'ab')
+Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(both 'y' from `test`.`t1`.`s`) > 'ab'
DROP TABLE t1;
create table t1(f1 varchar(4));
explain extended select encode(f1,'zxcv') as 'enc' from t1;
@@ -1398,7 +1402,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 const PRIMARY PRIMARY 12 const 1 100.00 Using index
1 SIMPLE t1 ref code code 13 const 3 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`code` AS `code`,'a12' AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = 'a12') and (length(`test`.`t1`.`code`) = 5))
+Note 1003 select `test`.`t1`.`code` AS `code`,'a12' AS `id` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`code` = 'a12' and length(`test`.`t1`.`code`) = 5
DROP TABLE t1,t2;
select encode(NULL, NULL);
encode(NULL, NULL)
@@ -1543,7 +1547,7 @@ select locate('lo','hello',-18446744073709551615);
locate('lo','hello',-18446744073709551615)
0
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
select locate('lo','hello',18446744073709551615);
locate('lo','hello',18446744073709551615)
0
@@ -1551,22 +1555,22 @@ select locate('lo','hello',-18446744073709551616);
locate('lo','hello',-18446744073709551616)
0
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
select locate('lo','hello',18446744073709551616);
locate('lo','hello',18446744073709551616)
0
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
select locate('lo','hello',-18446744073709551617);
locate('lo','hello',-18446744073709551617)
0
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
select locate('lo','hello',18446744073709551617);
locate('lo','hello',18446744073709551617)
0
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
select left('hello', 10);
left('hello', 10)
hello
@@ -1598,8 +1602,8 @@ select left('hello', -18446744073709551615);
left('hello', -18446744073709551615)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
select left('hello', 18446744073709551615);
left('hello', 18446744073709551615)
hello
@@ -1607,26 +1611,26 @@ select left('hello', -18446744073709551616);
left('hello', -18446744073709551616)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
select left('hello', 18446744073709551616);
left('hello', 18446744073709551616)
hello
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
select left('hello', -18446744073709551617);
left('hello', -18446744073709551617)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
select left('hello', 18446744073709551617);
left('hello', 18446744073709551617)
hello
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
select right('hello', 10);
right('hello', 10)
hello
@@ -1658,8 +1662,8 @@ select right('hello', -18446744073709551615);
right('hello', -18446744073709551615)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
select right('hello', 18446744073709551615);
right('hello', 18446744073709551615)
hello
@@ -1667,26 +1671,26 @@ select right('hello', -18446744073709551616);
right('hello', -18446744073709551616)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
select right('hello', 18446744073709551616);
right('hello', 18446744073709551616)
hello
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
select right('hello', -18446744073709551617);
right('hello', -18446744073709551617)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
select right('hello', 18446744073709551617);
right('hello', 18446744073709551617)
hello
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
select substring('hello', 2, -1);
substring('hello', 2, -1)
@@ -1718,8 +1722,8 @@ select substring('hello', -18446744073709551615, 1);
substring('hello', -18446744073709551615, 1)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
select substring('hello', 18446744073709551615, 1);
substring('hello', 18446744073709551615, 1)
@@ -1727,26 +1731,26 @@ select substring('hello', -18446744073709551616, 1);
substring('hello', -18446744073709551616, 1)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
select substring('hello', 18446744073709551616, 1);
substring('hello', 18446744073709551616, 1)
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
select substring('hello', -18446744073709551617, 1);
substring('hello', -18446744073709551617, 1)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
select substring('hello', 18446744073709551617, 1);
substring('hello', 18446744073709551617, 1)
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
select substring('hello', 1, -1);
substring('hello', 1, -1)
@@ -1772,8 +1776,8 @@ select substring('hello', 1, -18446744073709551615);
substring('hello', 1, -18446744073709551615)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
select substring('hello', 1, 18446744073709551615);
substring('hello', 1, 18446744073709551615)
hello
@@ -1781,26 +1785,26 @@ select substring('hello', 1, -18446744073709551616);
substring('hello', 1, -18446744073709551616)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
select substring('hello', 1, 18446744073709551616);
substring('hello', 1, 18446744073709551616)
hello
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
select substring('hello', 1, -18446744073709551617);
substring('hello', 1, -18446744073709551617)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
select substring('hello', 1, 18446744073709551617);
substring('hello', 1, 18446744073709551617)
hello
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
select substring('hello', -1, -1);
substring('hello', -1, -1)
@@ -1826,10 +1830,10 @@ select substring('hello', -18446744073709551615, -18446744073709551615);
substring('hello', -18446744073709551615, -18446744073709551615)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
select substring('hello', 18446744073709551615, 18446744073709551615);
substring('hello', 18446744073709551615, 18446744073709551615)
@@ -1837,34 +1841,34 @@ select substring('hello', -18446744073709551616, -18446744073709551616);
substring('hello', -18446744073709551616, -18446744073709551616)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
select substring('hello', 18446744073709551616, 18446744073709551616);
substring('hello', 18446744073709551616, 18446744073709551616)
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
select substring('hello', -18446744073709551617, -18446744073709551617);
substring('hello', -18446744073709551617, -18446744073709551617)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
select substring('hello', 18446744073709551617, 18446744073709551617);
substring('hello', 18446744073709551617, 18446744073709551617)
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
select insert('hello', -1, 1, 'hi');
insert('hello', -1, 1, 'hi')
hello
@@ -1890,7 +1894,7 @@ select insert('hello', -18446744073709551615, 1, 'hi');
insert('hello', -18446744073709551615, 1, 'hi')
hello
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
select insert('hello', 18446744073709551615, 1, 'hi');
insert('hello', 18446744073709551615, 1, 'hi')
hello
@@ -1898,22 +1902,22 @@ select insert('hello', -18446744073709551616, 1, 'hi');
insert('hello', -18446744073709551616, 1, 'hi')
hello
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
select insert('hello', 18446744073709551616, 1, 'hi');
insert('hello', 18446744073709551616, 1, 'hi')
hello
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
select insert('hello', -18446744073709551617, 1, 'hi');
insert('hello', -18446744073709551617, 1, 'hi')
hello
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
select insert('hello', 18446744073709551617, 1, 'hi');
insert('hello', 18446744073709551617, 1, 'hi')
hello
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
select insert('hello', 1, -1, 'hi');
insert('hello', 1, -1, 'hi')
hi
@@ -1939,7 +1943,7 @@ select insert('hello', 1, -18446744073709551615, 'hi');
insert('hello', 1, -18446744073709551615, 'hi')
hi
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
select insert('hello', 1, 18446744073709551615, 'hi');
insert('hello', 1, 18446744073709551615, 'hi')
hi
@@ -1947,22 +1951,22 @@ select insert('hello', 1, -18446744073709551616, 'hi');
insert('hello', 1, -18446744073709551616, 'hi')
hi
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
select insert('hello', 1, 18446744073709551616, 'hi');
insert('hello', 1, 18446744073709551616, 'hi')
hi
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
select insert('hello', 1, -18446744073709551617, 'hi');
insert('hello', 1, -18446744073709551617, 'hi')
hi
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
select insert('hello', 1, 18446744073709551617, 'hi');
insert('hello', 1, 18446744073709551617, 'hi')
hi
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
select insert('hello', -1, -1, 'hi');
insert('hello', -1, -1, 'hi')
hello
@@ -1988,8 +1992,8 @@ select insert('hello', -18446744073709551615, -18446744073709551615, 'hi');
insert('hello', -18446744073709551615, -18446744073709551615, 'hi')
hello
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
select insert('hello', 18446744073709551615, 18446744073709551615, 'hi');
insert('hello', 18446744073709551615, 18446744073709551615, 'hi')
hello
@@ -1997,26 +2001,26 @@ select insert('hello', -18446744073709551616, -18446744073709551616, 'hi');
insert('hello', -18446744073709551616, -18446744073709551616, 'hi')
hello
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
select insert('hello', 18446744073709551616, 18446744073709551616, 'hi');
insert('hello', 18446744073709551616, 18446744073709551616, 'hi')
hello
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
select insert('hello', -18446744073709551617, -18446744073709551617, 'hi');
insert('hello', -18446744073709551617, -18446744073709551617, 'hi')
hello
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
select insert('hello', 18446744073709551617, 18446744073709551617, 'hi');
insert('hello', 18446744073709551617, 18446744073709551617, 'hi')
hello
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
select repeat('hello', -1);
repeat('hello', -1)
@@ -2048,8 +2052,8 @@ select repeat('hello', -18446744073709551615);
repeat('hello', -18446744073709551615)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
select repeat('hello', 18446744073709551615);
repeat('hello', 18446744073709551615)
NULL
@@ -2059,27 +2063,27 @@ select repeat('hello', -18446744073709551616);
repeat('hello', -18446744073709551616)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
select repeat('hello', 18446744073709551616);
repeat('hello', 18446744073709551616)
NULL
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select repeat('hello', -18446744073709551617);
repeat('hello', -18446744073709551617)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
select repeat('hello', 18446744073709551617);
repeat('hello', 18446744073709551617)
NULL
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select space(-1);
space(-1)
@@ -2112,8 +2116,8 @@ select space(-18446744073709551615);
space(-18446744073709551615)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
select space(18446744073709551615);
space(18446744073709551615)
NULL
@@ -2123,27 +2127,27 @@ select space(-18446744073709551616);
space(-18446744073709551616)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
select space(18446744073709551616);
space(18446744073709551616)
NULL
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
Warning 1301 Result of space() was larger than max_allowed_packet (1048576) - truncated
select space(-18446744073709551617);
space(-18446744073709551617)
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
select space(18446744073709551617);
space(18446744073709551617)
NULL
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
Warning 1301 Result of space() was larger than max_allowed_packet (1048576) - truncated
select rpad('hello', -1, '1');
rpad('hello', -1, '1')
@@ -2176,8 +2180,8 @@ select rpad('hello', -18446744073709551615, '1');
rpad('hello', -18446744073709551615, '1')
NULL
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
select rpad('hello', 18446744073709551615, '1');
rpad('hello', 18446744073709551615, '1')
NULL
@@ -2187,27 +2191,27 @@ select rpad('hello', -18446744073709551616, '1');
rpad('hello', -18446744073709551616, '1')
NULL
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
select rpad('hello', 18446744073709551616, '1');
rpad('hello', 18446744073709551616, '1')
NULL
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
select rpad('hello', -18446744073709551617, '1');
rpad('hello', -18446744073709551617, '1')
NULL
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
select rpad('hello', 18446744073709551617, '1');
rpad('hello', 18446744073709551617, '1')
NULL
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
select lpad('hello', -1, '1');
lpad('hello', -1, '1')
@@ -2240,8 +2244,8 @@ select lpad('hello', -18446744073709551615, '1');
lpad('hello', -18446744073709551615, '1')
NULL
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated
select lpad('hello', 18446744073709551615, '1');
lpad('hello', 18446744073709551615, '1')
NULL
@@ -2251,27 +2255,27 @@ select lpad('hello', -18446744073709551616, '1');
lpad('hello', -18446744073709551616, '1')
NULL
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated
select lpad('hello', 18446744073709551616, '1');
lpad('hello', 18446744073709551616, '1')
NULL
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated
select lpad('hello', -18446744073709551617, '1');
lpad('hello', -18446744073709551617, '1')
NULL
Warnings:
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated
select lpad('hello', 18446744073709551617, '1');
lpad('hello', 18446744073709551617, '1')
NULL
Warnings:
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
-Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated.
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
+Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated
Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated
SET @orig_sql_mode = @@SQL_MODE;
SET SQL_MODE=traditional;
@@ -2525,7 +2529,7 @@ create table t1(a float);
insert into t1 values (1.33);
select format(a, 2) from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def format(a, 2) 253 49 4 Y 0 31 8
+def format(a, 2) 253 57 4 Y 0 39 8
format(a, 2)
1.33
drop table t1;
@@ -2853,7 +2857,7 @@ CREATE TABLE t1 AS SELECT format(123,2,'no_NO');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `format(123,2,'no_NO')` varchar(37) NOT NULL
+ `format(123,2,'no_NO')` varchar(45) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t1;
format(123,2,'no_NO')
@@ -2911,6 +2915,7 @@ SELECT @tmp_max:= @@global.max_allowed_packet;
@tmp_max:= @@global.max_allowed_packet
1048576
SET @@global.max_allowed_packet=1024*1024*1024;
+connect newconn, localhost, root,,;
SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
1073741824
@@ -2942,7 +2947,9 @@ Warning 1292 Truncated incorrect INTEGER value: '511993d3c99719e38a6779073019dac
Warning 1292 Truncated incorrect DECIMAL value: '[.DC2.]'
Warning 1292 Truncated incorrect INTEGER value: '511993d3c99719e38a6779073019dacd7178ddb9'
Warning 1292 Truncated incorrect DOUBLE value: '0.000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'
+connection conn1;
SET @@global.max_allowed_packet:= @tmp_max;
+disconnect newconn;
SELECT @tmp_max:= @@global.max_allowed_packet;
@tmp_max:= @@global.max_allowed_packet
1048576
@@ -2992,7 +2999,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',63)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(85) NOT NULL
+ `to_base64` varchar(85) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3014,7 +3021,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',62)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(85) NOT NULL
+ `to_base64` varchar(85) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3036,7 +3043,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',61)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(85) NOT NULL
+ `to_base64` varchar(85) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3058,7 +3065,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',60)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(81) NOT NULL
+ `to_base64` varchar(81) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3080,7 +3087,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',59)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(81) NOT NULL
+ `to_base64` varchar(81) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3102,7 +3109,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',58)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(81) NOT NULL
+ `to_base64` varchar(81) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3124,7 +3131,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',57)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(76) NOT NULL
+ `to_base64` varchar(76) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3145,7 +3152,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',56)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(76) NOT NULL
+ `to_base64` varchar(76) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3166,7 +3173,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',55)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(76) NOT NULL
+ `to_base64` varchar(76) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3187,7 +3194,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',54)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(72) NOT NULL
+ `to_base64` varchar(72) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3208,7 +3215,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',53)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(72) NOT NULL
+ `to_base64` varchar(72) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3229,7 +3236,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',52)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(72) NOT NULL
+ `to_base64` varchar(72) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3250,7 +3257,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',51)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(68) NOT NULL
+ `to_base64` varchar(68) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3271,7 +3278,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',50)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(68) NOT NULL
+ `to_base64` varchar(68) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3292,7 +3299,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',49)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(68) NOT NULL
+ `to_base64` varchar(68) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3313,7 +3320,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',48)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(64) NOT NULL
+ `to_base64` varchar(64) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3334,7 +3341,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',47)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(64) NOT NULL
+ `to_base64` varchar(64) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3355,7 +3362,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',46)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(64) NOT NULL
+ `to_base64` varchar(64) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3376,7 +3383,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',45)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(60) NOT NULL
+ `to_base64` varchar(60) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3397,7 +3404,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',44)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(60) NOT NULL
+ `to_base64` varchar(60) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3418,7 +3425,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',43)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(60) NOT NULL
+ `to_base64` varchar(60) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3439,7 +3446,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',42)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(56) NOT NULL
+ `to_base64` varchar(56) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3460,7 +3467,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',41)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(56) NOT NULL
+ `to_base64` varchar(56) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3481,7 +3488,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',40)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(56) NOT NULL
+ `to_base64` varchar(56) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3502,7 +3509,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',39)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(52) NOT NULL
+ `to_base64` varchar(52) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3523,7 +3530,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',38)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(52) NOT NULL
+ `to_base64` varchar(52) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3544,7 +3551,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',37)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(52) NOT NULL
+ `to_base64` varchar(52) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3565,7 +3572,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',36)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(48) NOT NULL
+ `to_base64` varchar(48) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3586,7 +3593,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',35)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(48) NOT NULL
+ `to_base64` varchar(48) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3607,7 +3614,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',34)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(48) NOT NULL
+ `to_base64` varchar(48) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3628,7 +3635,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',33)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(44) NOT NULL
+ `to_base64` varchar(44) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3649,7 +3656,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',32)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(44) NOT NULL
+ `to_base64` varchar(44) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3670,7 +3677,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',31)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(44) NOT NULL
+ `to_base64` varchar(44) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3691,7 +3698,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',30)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(40) NOT NULL
+ `to_base64` varchar(40) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3712,7 +3719,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',29)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(40) NOT NULL
+ `to_base64` varchar(40) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3733,7 +3740,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',28)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(40) NOT NULL
+ `to_base64` varchar(40) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3754,7 +3761,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',27)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(36) NOT NULL
+ `to_base64` varchar(36) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3775,7 +3782,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',26)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(36) NOT NULL
+ `to_base64` varchar(36) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3796,7 +3803,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',25)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(36) NOT NULL
+ `to_base64` varchar(36) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3817,7 +3824,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',24)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(32) NOT NULL
+ `to_base64` varchar(32) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3838,7 +3845,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',23)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(32) NOT NULL
+ `to_base64` varchar(32) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3859,7 +3866,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',22)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(32) NOT NULL
+ `to_base64` varchar(32) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3880,7 +3887,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',21)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(28) NOT NULL
+ `to_base64` varchar(28) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3901,7 +3908,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',20)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(28) NOT NULL
+ `to_base64` varchar(28) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3922,7 +3929,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',19)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(28) NOT NULL
+ `to_base64` varchar(28) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3943,7 +3950,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',18)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(24) NOT NULL
+ `to_base64` varchar(24) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3964,7 +3971,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',17)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(24) NOT NULL
+ `to_base64` varchar(24) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -3985,7 +3992,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',16)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(24) NOT NULL
+ `to_base64` varchar(24) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4006,7 +4013,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',15)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(20) NOT NULL
+ `to_base64` varchar(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4027,7 +4034,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',14)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(20) NOT NULL
+ `to_base64` varchar(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4048,7 +4055,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',13)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(20) NOT NULL
+ `to_base64` varchar(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4069,7 +4076,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',12)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(16) NOT NULL
+ `to_base64` varchar(16) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4090,7 +4097,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',11)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(16) NOT NULL
+ `to_base64` varchar(16) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4111,7 +4118,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',10)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(16) NOT NULL
+ `to_base64` varchar(16) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4132,7 +4139,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',9)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(12) NOT NULL
+ `to_base64` varchar(12) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4153,7 +4160,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',8)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(12) NOT NULL
+ `to_base64` varchar(12) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4174,7 +4181,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',7)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(12) NOT NULL
+ `to_base64` varchar(12) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4195,7 +4202,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',6)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(8) NOT NULL
+ `to_base64` varchar(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4216,7 +4223,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',5)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(8) NOT NULL
+ `to_base64` varchar(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4237,7 +4244,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',4)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(8) NOT NULL
+ `to_base64` varchar(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4258,7 +4265,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',3)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(4) NOT NULL
+ `to_base64` varchar(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4279,7 +4286,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',2)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(4) NOT NULL
+ `to_base64` varchar(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4300,7 +4307,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',1)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` varchar(4) NOT NULL
+ `to_base64` varchar(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4321,7 +4328,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',0)) AS to_base64;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `to_base64` char(0) NOT NULL
+ `to_base64` char(0) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT to_base64, LENGTH(to_base64) FROM t1;
to_base64 LENGTH(to_base64)
@@ -4542,6 +4549,8 @@ SET NAMES latin2;
EXECUTE stmt;
COLLATION(space(2))
latin2_general_ci
+disconnect conn1;
+connection default;
set global max_allowed_packet=default;
#
# End of 5.6 tests
@@ -4626,7 +4635,7 @@ SELECT * FROM t1 WHERE a=18446744073709551615 AND FORMAT(a,0)='18,446,744,073,70
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 18446744073709551615) and (format(`test`.`t1`.`a`,0) = '18,446,744,073,709,551,615'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 18446744073709551615 and format(`test`.`t1`.`a`,0) = '18,446,744,073,709,551,615'
DROP TABLE t1;
#
# Bug#58081 Duplicate entry error when doing GROUP BY
diff --git a/mysql-test/r/func_system.result b/mysql-test/r/func_system.result
index 2fc0a59f5d2..06fb7e44cf0 100644
--- a/mysql-test/r/func_system.result
+++ b/mysql-test/r/func_system.result
@@ -47,7 +47,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`database()` varchar(34) CHARACTER SET utf8 DEFAULT NULL,
- `user()` varchar(141) CHARACTER SET utf8 NOT NULL,
+ `user()` varchar(141) CHARACTER SET utf8 DEFAULT NULL,
`version` char(60) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -61,8 +61,8 @@ create table t1 select charset(_utf8'a'), collation(_utf8'a');
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `charset(_utf8'a')` varchar(64) CHARACTER SET utf8 NOT NULL,
- `collation(_utf8'a')` varchar(64) CHARACTER SET utf8 NOT NULL
+ `charset(_utf8'a')` varchar(64) CHARACTER SET utf8 DEFAULT NULL,
+ `collation(_utf8'a')` varchar(64) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select TRUE,FALSE,NULL;
diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result
index 387b8545f59..8f175a6805b 100644
--- a/mysql-test/r/func_test.result
+++ b/mysql-test/r/func_test.result
@@ -48,7 +48,7 @@ explain extended select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select (3 ^ 11) AS `3 ^ 11`,(1 ^ 1) AS `1 ^ 1`,(1 ^ 0) AS `1 ^ 0`,(1 ^ NULL) AS `1 ^ NULL`,(NULL ^ 1) AS `NULL ^ 1`
+Note 1003 select 3 ^ 11 AS `3 ^ 11`,1 ^ 1 AS `1 ^ 1`,1 ^ 0 AS `1 ^ 0`,1 ^ NULL AS `1 ^ NULL`,NULL ^ 1 AS `NULL ^ 1`
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
1 XOR 1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL
0 1 1 0 NULL NULL NULL
@@ -62,7 +62,7 @@ explain extended select 10 % 7, 10 mod 7, 10 div 3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select (10 % 7) AS `10 % 7`,(10 % 7) AS `10 mod 7`,(10 DIV 3) AS `10 div 3`
+Note 1003 select 10 % 7 AS `10 % 7`,10 % 7 AS `10 mod 7`,10 DIV 3 AS `10 div 3`
select 18446744073709551615, 18446744073709551615 DIV 1, 18446744073709551615 DIV 2;
18446744073709551615 18446744073709551615 DIV 1 18446744073709551615 DIV 2
18446744073709551615 18446744073709551615 9223372036854775807
@@ -70,7 +70,7 @@ explain extended select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select ((1 << 64) - 1) AS `(1 << 64)-1`,(((1 << 64) - 1) DIV 1) AS `((1 << 64)-1) DIV 1`,(((1 << 64) - 1) DIV 2) AS `((1 << 64)-1) DIV 2`
+Note 1003 select (1 << 64) - 1 AS `(1 << 64)-1`,((1 << 64) - 1) DIV 1 AS `((1 << 64)-1) DIV 1`,((1 << 64) - 1) DIV 2 AS `((1 << 64)-1) DIV 2`
create table t1 (a int);
insert t1 values (1);
select * from t1 where 1 xor 1;
@@ -87,7 +87,7 @@ explain extended select - a from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select -(1) AS `- a` from dual
+Note 1003 select -1 AS `- a` from dual
drop table t1;
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
@@ -108,7 +108,7 @@ explain extended select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select (_koi8r'a' = (_koi8r'A' collate koi8r_general_ci)) AS `_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci`
+Note 1003 select _koi8r'a' = _koi8r'A' collate koi8r_general_ci AS `_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci`
select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin;
_koi8r'a' = _koi8r'A' COLLATE koi8r_bin
0
@@ -185,12 +185,18 @@ select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3;
select (12%0) <=> null as '1';
1
1
+Warnings:
+Warning 1365 Division by 0
select (12%0) is null as '1';
1
1
+Warnings:
+Warning 1365 Division by 0
select 12%0 as 'NULL';
NULL
NULL
+Warnings:
+Warning 1365 Division by 0
select 12%2 as '0';
0
0
@@ -215,12 +221,18 @@ NULL
select (12 mod 0) <=> null as '1';
1
1
+Warnings:
+Warning 1365 Division by 0
select (12 mod 0) is null as '1';
1
1
+Warnings:
+Warning 1365 Division by 0
select 12 mod 0 as 'NULL';
NULL
NULL
+Warnings:
+Warning 1365 Division by 0
select 12 mod 2 as '0';
0
0
@@ -242,9 +254,13 @@ NULL
select mod(12.0, 0) as 'NULL';
NULL
NULL
+Warnings:
+Warning 1365 Division by 0
select mod(12, 0.0) as 'NULL';
NULL
NULL
+Warnings:
+Warning 1365 Division by 0
select mod(12, NULL) as 'NULL';
NULL
NULL
@@ -291,7 +307,7 @@ explain extended select not a from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00
Warnings:
-Note 1003 select (`test`.`t1`.`a` = 0) AS `not a` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` = 0 AS `not a` from `test`.`t1`
select * from t1 where not a;
a
0
@@ -299,7 +315,7 @@ explain extended select * from t1 where not a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 0)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0
select not (a+0) from t1;
not (a+0)
0
@@ -310,7 +326,7 @@ explain extended select not (a+0) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00
Warnings:
-Note 1003 select (not((`test`.`t1`.`a` + 0))) AS `not (a+0)` from `test`.`t1`
+Note 1003 select !(`test`.`t1`.`a` + 0) AS `not (a+0)` from `test`.`t1`
select * from t1 where not (a+0);
a
0
@@ -318,7 +334,10 @@ explain extended select * from t1 where not (a+0);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (not((`test`.`t1`.`a` + 0)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where !(`test`.`t1`.`a` + 0)
+select not 1, not null, not not null, 1 is not null;
+not 1 not null not not null 1 is not null
+0 NULL NULL 1
drop table t1;
#
# Start of 10.0 tests
@@ -333,7 +352,7 @@ EXPLAIN EXTENDED SELECT NOT NOT strcmp('a','b');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select (strcmp('a','b') <> 0) AS `NOT NOT strcmp('a','b')`
+Note 1003 select strcmp('a','b') <> 0 AS `NOT NOT strcmp('a','b')`
#
# End of 10.0 tests
#
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 2180ec2b83c..55c2c93eb56 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -874,7 +874,7 @@ explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_d
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select period_add('9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,'9404') AS `period_diff(199505,"9404")`,from_days(to_days('960101')) AS `from_days(to_days("960101"))`,dayofmonth('1997-01-02') AS `dayofmonth("1997-01-02")`,month('1997-01-02') AS `month("1997-01-02")`,monthname('1972-03-04') AS `monthname("1972-03-04")`,dayofyear('0000-00-00') AS `dayofyear("0000-00-00")`,hour('1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute('23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week('1998-03-03',@@default_week_format) AS `WEEK("1998-03-03")`,yearweek('2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year('98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname('1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec('0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format('1997-01-02 03:04:05','%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp('1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,('1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,('1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,('1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from '1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,('1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)`
+Note 1003 select period_add('9602',-12) AS `period_add("9602",-12)`,period_diff(199505,'9404') AS `period_diff(199505,"9404")`,from_days(to_days('960101')) AS `from_days(to_days("960101"))`,dayofmonth('1997-01-02') AS `dayofmonth("1997-01-02")`,month('1997-01-02') AS `month("1997-01-02")`,monthname('1972-03-04') AS `monthname("1972-03-04")`,dayofyear('0000-00-00') AS `dayofyear("0000-00-00")`,hour('1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute('23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week('1998-03-03') AS `WEEK("1998-03-03")`,yearweek('2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year('98-02-03') AS `year("98-02-03")`,weekday(curdate()) - weekday(current_timestamp()) AS `weekday(curdate())-weekday(now())`,dayname('1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time(time_to_sec('0:30:47') / 6.21) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format('1997-01-02 03:04:05','%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp('1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,'1997-12-31 23:59:59' + interval 1 second AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,'1998-01-01 00:00:00' - interval 1 second AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,'1997-12-31' + interval 1 day AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from '1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,'1997-12-31 23:59:59' + interval 1 second AS `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');
@@ -1031,7 +1031,7 @@ EXTRACT(HOUR FROM '10000:02:03')
Warnings:
Warning 1292 Truncated incorrect time value: '10000:02:03'
CREATE TABLE t1(f1 TIME);
-INSERT INTO t1 VALUES('916:00:00 a');
+INSERT IGNORE INTO t1 VALUES('916:00:00 a');
Warnings:
Warning 1265 Data truncated for column 'f1' at row 1
Warning 1264 Out of range value for column 'f1' at row 1
@@ -1976,7 +1976,7 @@ select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010')
microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010')
123456 10
select now(258);
-ERROR 42000: Too big precision 258 specified for 'now'. Maximum is 6.
+ERROR 42000: Too big precision 258 specified for 'current_timestamp'. Maximum is 6
SELECT 1 FROM DUAL WHERE YEAR(TIMEDIFF(NULL, '12:12:12'));
1
SELECT 1 FROM DUAL WHERE MONTH(TIMEDIFF(NULL, '12:12:12'));
@@ -2145,6 +2145,7 @@ f2
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
+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;
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
diff --git a/mysql-test/r/func_time_hires.result b/mysql-test/r/func_time_hires.result
index baa53b11fd6..0f822456724 100644
--- a/mysql-test/r/func_time_hires.result
+++ b/mysql-test/r/func_time_hires.result
@@ -24,9 +24,9 @@ select time_to_sec(sec_to_time(11111)), time_to_sec(sec_to_time(11111.22222));
time_to_sec(sec_to_time(11111)) 11111
time_to_sec(sec_to_time(11111.22222)) 11111.22222
select current_timestamp(7);
-ERROR 42000: Too big precision 7 specified for 'now'. Maximum is 6.
+ERROR 42000: Too big precision 7 specified for 'current_timestamp'. Maximum is 6
select curtime(7);
-ERROR 42000: Too big precision 7 specified for 'curtime'. Maximum is 6.
+ERROR 42000: Too big precision 7 specified for 'curtime'. Maximum is 6
drop table if exists t1;
create table t1 select sec_to_time(12345), sec_to_time(12345.6789),
sec_to_time(1234567e-2), now(), curtime(0),
@@ -156,12 +156,12 @@ explain extended select cast(cast(@a as datetime(4)) as time(0));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select cast(cast((@`a`) as datetime(4)) as time) AS `cast(cast(@a as datetime(4)) as time(0))`
+Note 1003 select cast(cast(@`a` as datetime(4)) as time) AS `cast(cast(@a as datetime(4)) as time(0))`
select cast(cast(@a as time(2)) as time(6));
cast(cast(@a as time(2)) as time(6))
12:13:14.120000
select CAST(@a AS DATETIME(7));
-ERROR 42000: Too big precision 7 specified for '(@`a`)'. Maximum is 6.
+ERROR 42000: Too big precision 7 specified for '@`a`'. Maximum is 6
SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00');
CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00')
2011-01-02 15:00:00
diff --git a/mysql-test/r/func_weight_string.result b/mysql-test/r/func_weight_string.result
index e63ee4267ea..04fd9962218 100644
--- a/mysql-test/r/func_weight_string.result
+++ b/mysql-test/r/func_weight_string.result
@@ -1,5 +1,7 @@
drop table if exists t1;
set global max_allowed_packet=1048576;
+connect conn1,localhost,root,,;
+connection conn1;
set names latin1;
select hex(weight_string(0x010203));
hex(weight_string(0x010203))
@@ -55,7 +57,7 @@ create table t1 select weight_string(repeat('t',66000)) as w;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `w` longblob
+ `w` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select weight_string(NULL);
@@ -91,6 +93,8 @@ NULL
Warnings:
Warning 1301 Result of cast_as_binary() was larger than max_allowed_packet (1048576) - truncated
Warning 1301 Result of weight_string() was larger than max_allowed_packet (1048576) - truncated
+disconnect conn1;
+connection default;
set global max_allowed_packet=default;
#
# Start of 10.1 tests
@@ -115,7 +119,7 @@ SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and isnull(weight_string(`test`.`t1`.`a`)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and weight_string(`test`.`t1`.`a`,0,0,1) is null
ALTER TABLE t1 MODIFY a DOUBLE ZEROFILL;
SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
a
@@ -125,7 +129,7 @@ SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and isnull(weight_string(`test`.`t1`.`a`)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and weight_string(`test`.`t1`.`a`,0,0,1) is null
ALTER TABLE t1 MODIFY a DECIMAL(10,1) ZEROFILL;
SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
a
@@ -135,8 +139,34 @@ SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and isnull(weight_string(`test`.`t1`.`a`)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and weight_string(`test`.`t1`.`a`,0,0,1) is null
DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-10134 Add full support for DEFAULT
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, b VARBINARY(10) DEFAULT WEIGHT_STRING(a AS CHAR(10)));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varbinary(10) DEFAULT weight_string(`a`,0,10,65)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('a');
+SELECT a, HEX(b) FROM t1;
+a HEX(b)
+a 41202020202020202020
+DROP TABLE t1;
+create view v1 as select weight_string("MySQL" as char(4));
+select * from v1;
+weight_string("MySQL" as char(4))
+MYSQ
+drop view v1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/function_defaults.result b/mysql-test/r/function_defaults.result
index b8f42b86c1f..62422752e17 100644
--- a/mysql-test/r/function_defaults.result
+++ b/mysql-test/r/function_defaults.result
@@ -9,50 +9,40 @@ SET TIME_ZONE = "+00:00";
# Test of errors for column data types that dont support function
# defaults.
#
-CREATE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
+drop table if exists t1;
#
# Test that the default clause behaves like NOW() regarding time zones.
#
@@ -493,7 +483,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
- `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+ `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c TIMESTAMP NULL );
@@ -501,7 +491,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE C
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`a` int(11) DEFAULT NULL,
`c` timestamp NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -511,7 +501,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE C
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -537,7 +527,7 @@ CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE N
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
`b` int(11) DEFAULT NULL,
`c` timestamp NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -546,7 +536,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
- `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`c` timestamp NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -556,7 +546,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` timestamp NULL DEFAULT NULL,
- `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -564,7 +554,7 @@ CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`b` int(11) DEFAULT NULL,
`c` timestamp NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -573,7 +563,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
- `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`c` timestamp NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -583,7 +573,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` timestamp NULL DEFAULT NULL,
- `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -596,7 +586,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
- `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+ `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
@@ -660,7 +650,7 @@ CREATE TABLE t2 SELECT a FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+ `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2;
a
@@ -669,7 +659,7 @@ CREATE TABLE t3 SELECT b FROM t1;
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+ `b` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t3;
b
@@ -678,7 +668,7 @@ CREATE TABLE t4 SELECT c FROM t1;
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP
+ `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t4;
c
@@ -705,7 +695,7 @@ CREATE TABLE t7 SELECT f FROM t1;
SHOW CREATE TABLE t7;
Table Create Table
t7 CREATE TABLE `t7` (
- `f` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+ `f` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t7;
f
@@ -714,7 +704,7 @@ CREATE TABLE t8 SELECT g FROM t1;
SHOW CREATE TABLE t8;
Table Create Table
t8 CREATE TABLE `t8` (
- `g` datetime DEFAULT CURRENT_TIMESTAMP
+ `g` datetime DEFAULT current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t8;
g
@@ -723,7 +713,7 @@ CREATE TABLE t9 SELECT h FROM t1;
SHOW CREATE TABLE t9;
Table Create Table
t9 CREATE TABLE `t9` (
- `h` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
+ `h` datetime DEFAULT NULL ON UPDATE current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t9;
h
@@ -763,25 +753,25 @@ SELECT * FROM t1;
SHOW CREATE TABLE t12;
Table Create Table
t12 CREATE TABLE `t12` (
- `k` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- `l` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- `m` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `n` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `k` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `l` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `m` timestamp NOT NULL DEFAULT current_timestamp(),
+ `n` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
`o` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00',
`p` timestamp NULL DEFAULT NULL,
- `q` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- `r` datetime DEFAULT CURRENT_TIMESTAMP,
- `s` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+ `q` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `r` datetime DEFAULT current_timestamp(),
+ `s` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`t` datetime DEFAULT NULL,
`u` datetime DEFAULT '1986-09-27 03:00:00',
- `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `b` timestamp NOT NULL DEFAULT current_timestamp(),
+ `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
`d` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00',
`e` timestamp NULL DEFAULT NULL,
- `f` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- `g` datetime DEFAULT CURRENT_TIMESTAMP,
- `h` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+ `f` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `g` datetime DEFAULT current_timestamp(),
+ `h` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`i` datetime DEFAULT NULL,
`j` datetime DEFAULT '1986-09-27 03:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -802,7 +792,7 @@ CREATE TABLE t2 SELECT a FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+ `a` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2;
a
@@ -811,7 +801,7 @@ CREATE TABLE t3 SELECT b FROM t1;
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `b` datetime DEFAULT CURRENT_TIMESTAMP
+ `b` datetime DEFAULT current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t3;
b
@@ -820,7 +810,7 @@ CREATE TABLE t4 SELECT c FROM t1;
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
+ `c` datetime DEFAULT NULL ON UPDATE current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t4;
c
@@ -857,15 +847,15 @@ CREATE TABLE t2 ( b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRE
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SET TIMESTAMP = 2000.876543;
INSERT INTO t2( a ) VALUES ( 3 );
SELECT * FROM t2;
b a
-0000-00-00 00:00:00 1
-0000-00-00 00:00:00 2
+1970-01-01 00:16:40 1
+1970-01-01 00:16:40 2
1970-01-01 00:33:20 3
DROP TABLE t1, t2;
#
@@ -1050,7 +1040,7 @@ FROM dual;
SELECT 1, 2 INTO OUTFILE 't5.dat' FROM dual;
# Mon Aug 1 15:11:19 2011 UTC
SET TIMESTAMP = 1312211479.918273;
-LOAD DATA INFILE 't3.dat' INTO TABLE t1;
+LOAD DATA INFILE 't3.dat' IGNORE INTO TABLE t1;
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1261 Row 1 doesn't contain data for all columns
@@ -1070,7 +1060,7 @@ f NULL
g NULL
h NULL
i NULL
-LOAD DATA INFILE 't4.dat' INTO TABLE t2;
+LOAD DATA INFILE 't4.dat' IGNORE INTO TABLE t2;
Warnings:
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'e' at row 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'f' at row 1
@@ -1120,7 +1110,7 @@ DELETE FROM t2;
# (read_fixed_length()) than under the LOAD ... INTO TABLE t1 command
# above. The code in this path is copy-pasted code from the path taken
# under the syntax used in the previous LOAD command.
-LOAD DATA INFILE 't3.dat' INTO TABLE t1
+LOAD DATA INFILE 't3.dat' IGNORE INTO TABLE t1
FIELDS TERMINATED BY '' ENCLOSED BY '';
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
@@ -1234,17 +1224,17 @@ t1 CREATE TABLE `t1` (
`dummy` int(11) DEFAULT NULL,
`a` datetime DEFAULT NULL,
`b` datetime DEFAULT '2011-11-18 00:00:00',
- `like_b` datetime DEFAULT CURRENT_TIMESTAMP,
+ `like_b` datetime DEFAULT current_timestamp(),
`c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00',
- `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `like_c` datetime NOT NULL DEFAULT current_timestamp(),
+ `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(),
`e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00',
- `f` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `f` timestamp NOT NULL DEFAULT current_timestamp(),
`g` timestamp NULL DEFAULT NULL,
`h` int(11) DEFAULT NULL,
- `i` int(11) NOT NULL DEFAULT '42'
+ `i` int(11) NOT NULL DEFAULT 42
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-LOAD DATA INFILE "file1.dat" INTO table t1;
+LOAD DATA INFILE "file1.dat" IGNORE INTO table t1;
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1261 Row 1 doesn't contain data for all columns
@@ -1286,17 +1276,17 @@ t1 CREATE TABLE `t1` (
`dummy` int(11) DEFAULT NULL,
`a` datetime DEFAULT NULL,
`b` datetime DEFAULT '2011-11-18 00:00:00',
- `like_b` datetime DEFAULT CURRENT_TIMESTAMP,
+ `like_b` datetime DEFAULT current_timestamp(),
`c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00',
- `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `like_c` datetime NOT NULL DEFAULT current_timestamp(),
+ `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(),
`e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00',
- `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ `f` timestamp NULL DEFAULT current_timestamp(),
`g` timestamp NULL DEFAULT NULL,
`h` int(11) DEFAULT NULL,
- `i` int(11) NOT NULL DEFAULT '42'
+ `i` int(11) NOT NULL DEFAULT 42
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-LOAD DATA INFILE "file1.dat" INTO table t1;
+LOAD DATA INFILE "file1.dat" IGNORE INTO table t1;
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1261 Row 1 doesn't contain data for all columns
@@ -1353,17 +1343,17 @@ t1 CREATE TABLE `t1` (
`dummy` int(11) DEFAULT NULL,
`a` datetime DEFAULT NULL,
`b` datetime DEFAULT '2011-11-18 00:00:00',
- `like_b` datetime DEFAULT CURRENT_TIMESTAMP,
+ `like_b` datetime DEFAULT current_timestamp(),
`c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00',
- `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `like_c` datetime NOT NULL DEFAULT current_timestamp(),
+ `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(),
`e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00',
- `f` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `f` timestamp NOT NULL DEFAULT current_timestamp(),
`g` timestamp NULL DEFAULT NULL,
`h` int(11) DEFAULT NULL,
- `i` int(11) NOT NULL DEFAULT '42'
+ `i` int(11) NOT NULL DEFAULT 42
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-LOAD DATA INFILE "file2.dat" INTO table t1;
+LOAD DATA INFILE "file2.dat" IGNORE INTO table t1;
Warnings:
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'like_c' at row 1
@@ -1391,17 +1381,17 @@ t1 CREATE TABLE `t1` (
`dummy` int(11) DEFAULT NULL,
`a` datetime DEFAULT NULL,
`b` datetime DEFAULT '2011-11-18 00:00:00',
- `like_b` datetime DEFAULT CURRENT_TIMESTAMP,
+ `like_b` datetime DEFAULT current_timestamp(),
`c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00',
- `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `like_c` datetime NOT NULL DEFAULT current_timestamp(),
+ `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(),
`e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00',
- `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ `f` timestamp NULL DEFAULT current_timestamp(),
`g` timestamp NULL DEFAULT NULL,
`h` int(11) DEFAULT NULL,
- `i` int(11) NOT NULL DEFAULT '42'
+ `i` int(11) NOT NULL DEFAULT 42
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-LOAD DATA INFILE "file2.dat" INTO table t1;
+LOAD DATA INFILE "file2.dat" IGNORE INTO table t1;
Warnings:
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'like_c' at row 1
@@ -1439,7 +1429,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
- `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+ `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 ( a ) VALUES ( 1 );
SELECT * FROM t1;
@@ -1453,7 +1443,7 @@ a b
# 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234;
UPDATE v1 SET a = 2;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM t1;
a b
1 1970-01-01 03:16:40
@@ -1476,7 +1466,7 @@ a c
1973-08-14 09:11:22 1
SET TIMESTAMP = 1.126789;
INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM v1;
a c
1973-08-14 09:11:22 1
@@ -1565,50 +1555,40 @@ SET TIME_ZONE = "+00:00";
# Test of errors for column data types that dont support function
# defaults.
#
-CREATE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
+drop table if exists t1;
#
# Test that the default clause behaves like NOW() regarding time zones.
#
@@ -2049,7 +2029,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
- `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
+ `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), c TIMESTAMP(6) NULL );
@@ -2057,7 +2037,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UP
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`a` int(11) DEFAULT NULL,
`c` timestamp(6) NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -2067,7 +2047,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UP
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -2093,7 +2073,7 @@ CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDAT
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6),
+ `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6),
`b` int(11) DEFAULT NULL,
`c` timestamp(6) NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -2102,7 +2082,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
- `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`c` timestamp(6) NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -2112,7 +2092,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` timestamp(6) NULL DEFAULT NULL,
- `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6),
+ `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6),
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -2120,7 +2100,7 @@ CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMES
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`b` int(11) DEFAULT NULL,
`c` timestamp(6) NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -2129,7 +2109,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
- `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`c` timestamp(6) NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -2139,7 +2119,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` timestamp(6) NULL DEFAULT NULL,
- `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -2152,7 +2132,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
- `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
+ `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
@@ -2216,7 +2196,7 @@ CREATE TABLE t2 SELECT a FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
+ `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2;
a
@@ -2225,7 +2205,7 @@ CREATE TABLE t3 SELECT b FROM t1;
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)
+ `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t3;
b
@@ -2234,7 +2214,7 @@ CREATE TABLE t4 SELECT c FROM t1;
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6)
+ `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t4;
c
@@ -2261,7 +2241,7 @@ CREATE TABLE t7 SELECT f FROM t1;
SHOW CREATE TABLE t7;
Table Create Table
t7 CREATE TABLE `t7` (
- `f` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
+ `f` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t7;
f
@@ -2270,7 +2250,7 @@ CREATE TABLE t8 SELECT g FROM t1;
SHOW CREATE TABLE t8;
Table Create Table
t8 CREATE TABLE `t8` (
- `g` datetime(6) DEFAULT CURRENT_TIMESTAMP(6)
+ `g` datetime(6) DEFAULT current_timestamp(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t8;
g
@@ -2279,7 +2259,7 @@ CREATE TABLE t9 SELECT h FROM t1;
SHOW CREATE TABLE t9;
Table Create Table
t9 CREATE TABLE `t9` (
- `h` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6)
+ `h` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t9;
h
@@ -2319,25 +2299,25 @@ SELECT * FROM t1;
SHOW CREATE TABLE t12;
Table Create Table
t12 CREATE TABLE `t12` (
- `k` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
- `l` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
- `m` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- `n` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6),
+ `k` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `l` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `m` timestamp(6) NOT NULL DEFAULT current_timestamp(6),
+ `n` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6),
`o` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765',
`p` timestamp(6) NULL DEFAULT NULL,
- `q` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
- `r` datetime(6) DEFAULT CURRENT_TIMESTAMP(6),
- `s` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6),
+ `q` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `r` datetime(6) DEFAULT current_timestamp(6),
+ `s` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6),
`t` datetime(6) DEFAULT NULL,
`u` datetime(6) DEFAULT '1986-09-27 03:00:00.098765',
- `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
- `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6),
+ `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6),
+ `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6),
`d` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765',
`e` timestamp(6) NULL DEFAULT NULL,
- `f` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
- `g` datetime(6) DEFAULT CURRENT_TIMESTAMP(6),
- `h` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6),
+ `f` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `g` datetime(6) DEFAULT current_timestamp(6),
+ `h` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6),
`i` datetime(6) DEFAULT NULL,
`j` datetime(6) DEFAULT '1986-09-27 03:00:00.098765'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -2358,7 +2338,7 @@ CREATE TABLE t2 SELECT a FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
+ `a` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2;
a
@@ -2367,7 +2347,7 @@ CREATE TABLE t3 SELECT b FROM t1;
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6)
+ `b` datetime(6) DEFAULT current_timestamp(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t3;
b
@@ -2376,7 +2356,7 @@ CREATE TABLE t4 SELECT c FROM t1;
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6)
+ `c` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t4;
c
@@ -2413,15 +2393,15 @@ CREATE TABLE t2 ( b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SET TIMESTAMP = 2000.876543;
INSERT INTO t2( a ) VALUES ( 3 );
SELECT * FROM t2;
b a
-0000-00-00 00:00:00.000000 1
-0000-00-00 00:00:00.000000 2
+1970-01-01 00:16:40.987654 1
+1970-01-01 00:16:40.987654 2
1970-01-01 00:33:20.876543 3
DROP TABLE t1, t2;
#
@@ -2606,7 +2586,7 @@ FROM dual;
SELECT 1, 2 INTO OUTFILE 't5.dat' FROM dual;
# Mon Aug 1 15:11:19 2011 UTC
SET TIMESTAMP = 1312211479.918273;
-LOAD DATA INFILE 't3.dat' INTO TABLE t1;
+LOAD DATA INFILE 't3.dat' IGNORE INTO TABLE t1;
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1261 Row 1 doesn't contain data for all columns
@@ -2626,7 +2606,7 @@ f NULL
g NULL
h NULL
i NULL
-LOAD DATA INFILE 't4.dat' INTO TABLE t2;
+LOAD DATA INFILE 't4.dat' IGNORE INTO TABLE t2;
Warnings:
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'e' at row 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'f' at row 1
@@ -2676,7 +2656,7 @@ DELETE FROM t2;
# (read_fixed_length()) than under the LOAD ... INTO TABLE t1 command
# above. The code in this path is copy-pasted code from the path taken
# under the syntax used in the previous LOAD command.
-LOAD DATA INFILE 't3.dat' INTO TABLE t1
+LOAD DATA INFILE 't3.dat' IGNORE INTO TABLE t1
FIELDS TERMINATED BY '' ENCLOSED BY '';
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
@@ -2790,17 +2770,17 @@ t1 CREATE TABLE `t1` (
`dummy` int(11) DEFAULT NULL,
`a` datetime(6) DEFAULT NULL,
`b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000',
- `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6),
+ `like_b` datetime(6) DEFAULT current_timestamp(6),
`c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000',
- `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6),
+ `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6),
+ `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6),
`e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000',
- `f` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
+ `f` timestamp(6) NOT NULL DEFAULT current_timestamp(6),
`g` timestamp(6) NULL DEFAULT NULL,
`h` int(11) DEFAULT NULL,
- `i` int(11) NOT NULL DEFAULT '42'
+ `i` int(11) NOT NULL DEFAULT 42
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-LOAD DATA INFILE "file1.dat" INTO table t1;
+LOAD DATA INFILE "file1.dat" IGNORE INTO table t1;
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1261 Row 1 doesn't contain data for all columns
@@ -2842,17 +2822,17 @@ t1 CREATE TABLE `t1` (
`dummy` int(11) DEFAULT NULL,
`a` datetime(6) DEFAULT NULL,
`b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000',
- `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6),
+ `like_b` datetime(6) DEFAULT current_timestamp(6),
`c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000',
- `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6),
+ `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6),
+ `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6),
`e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000',
- `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ `f` timestamp NULL DEFAULT current_timestamp(),
`g` timestamp(6) NULL DEFAULT NULL,
`h` int(11) DEFAULT NULL,
- `i` int(11) NOT NULL DEFAULT '42'
+ `i` int(11) NOT NULL DEFAULT 42
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-LOAD DATA INFILE "file1.dat" INTO table t1;
+LOAD DATA INFILE "file1.dat" IGNORE INTO table t1;
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1261 Row 1 doesn't contain data for all columns
@@ -2909,17 +2889,17 @@ t1 CREATE TABLE `t1` (
`dummy` int(11) DEFAULT NULL,
`a` datetime(6) DEFAULT NULL,
`b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000',
- `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6),
+ `like_b` datetime(6) DEFAULT current_timestamp(6),
`c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000',
- `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6),
+ `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6),
+ `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6),
`e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000',
- `f` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
+ `f` timestamp(6) NOT NULL DEFAULT current_timestamp(6),
`g` timestamp(6) NULL DEFAULT NULL,
`h` int(11) DEFAULT NULL,
- `i` int(11) NOT NULL DEFAULT '42'
+ `i` int(11) NOT NULL DEFAULT 42
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-LOAD DATA INFILE "file2.dat" INTO table t1;
+LOAD DATA INFILE "file2.dat" IGNORE INTO table t1;
Warnings:
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'like_c' at row 1
@@ -2947,17 +2927,17 @@ t1 CREATE TABLE `t1` (
`dummy` int(11) DEFAULT NULL,
`a` datetime(6) DEFAULT NULL,
`b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000',
- `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6),
+ `like_b` datetime(6) DEFAULT current_timestamp(6),
`c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000',
- `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6),
+ `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6),
+ `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6),
`e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000',
- `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ `f` timestamp NULL DEFAULT current_timestamp(),
`g` timestamp(6) NULL DEFAULT NULL,
`h` int(11) DEFAULT NULL,
- `i` int(11) NOT NULL DEFAULT '42'
+ `i` int(11) NOT NULL DEFAULT 42
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-LOAD DATA INFILE "file2.dat" INTO table t1;
+LOAD DATA INFILE "file2.dat" IGNORE INTO table t1;
Warnings:
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'like_c' at row 1
@@ -2995,7 +2975,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
- `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
+ `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 ( a ) VALUES ( 1 );
SELECT * FROM t1;
@@ -3009,7 +2989,7 @@ a b
# 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234;
UPDATE v1 SET a = 2;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM t1;
a b
1 1970-01-01 03:16:40.123456
@@ -3032,7 +3012,7 @@ a c
1973-08-14 09:11:22.089786 1
SET TIMESTAMP = 1.126789;
INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM v1;
a c
1973-08-14 09:11:22.089786 1
diff --git a/mysql-test/r/function_defaults_innodb.result b/mysql-test/r/function_defaults_innodb.result
index 2525d4e948a..dd769f8577a 100644
--- a/mysql-test/r/function_defaults_innodb.result
+++ b/mysql-test/r/function_defaults_innodb.result
@@ -10,50 +10,40 @@ SET TIME_ZONE = "+00:00";
# Test of errors for column data types that dont support function
# defaults.
#
-CREATE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP );
+CREATE OR REPLACE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
+drop table if exists t1;
#
# Test that the default clause behaves like NOW() regarding time zones.
#
@@ -494,7 +484,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
- `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+ `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c TIMESTAMP NULL );
@@ -502,7 +492,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE C
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`a` int(11) DEFAULT NULL,
`c` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -512,7 +502,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE C
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -538,7 +528,7 @@ CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE N
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
`b` int(11) DEFAULT NULL,
`c` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -547,7 +537,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
- `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`c` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -557,7 +547,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` timestamp NULL DEFAULT NULL,
- `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
`b` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -565,7 +555,7 @@ CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`b` int(11) DEFAULT NULL,
`c` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -574,7 +564,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
- `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`c` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -584,7 +574,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` timestamp NULL DEFAULT NULL,
- `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`b` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -597,7 +587,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
- `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+ `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
#
@@ -661,7 +651,7 @@ CREATE TABLE t2 SELECT a FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+ `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a
@@ -670,7 +660,7 @@ CREATE TABLE t3 SELECT b FROM t1;
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+ `b` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t3;
b
@@ -679,7 +669,7 @@ CREATE TABLE t4 SELECT c FROM t1;
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP
+ `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t4;
c
@@ -706,7 +696,7 @@ CREATE TABLE t7 SELECT f FROM t1;
SHOW CREATE TABLE t7;
Table Create Table
t7 CREATE TABLE `t7` (
- `f` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+ `f` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t7;
f
@@ -715,7 +705,7 @@ CREATE TABLE t8 SELECT g FROM t1;
SHOW CREATE TABLE t8;
Table Create Table
t8 CREATE TABLE `t8` (
- `g` datetime DEFAULT CURRENT_TIMESTAMP
+ `g` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t8;
g
@@ -724,7 +714,7 @@ CREATE TABLE t9 SELECT h FROM t1;
SHOW CREATE TABLE t9;
Table Create Table
t9 CREATE TABLE `t9` (
- `h` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
+ `h` datetime DEFAULT NULL ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t9;
h
@@ -764,25 +754,25 @@ SELECT * FROM t1;
SHOW CREATE TABLE t12;
Table Create Table
t12 CREATE TABLE `t12` (
- `k` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- `l` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- `m` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `n` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `k` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `l` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `m` timestamp NOT NULL DEFAULT current_timestamp(),
+ `n` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
`o` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00',
`p` timestamp NULL DEFAULT NULL,
- `q` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- `r` datetime DEFAULT CURRENT_TIMESTAMP,
- `s` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+ `q` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `r` datetime DEFAULT current_timestamp(),
+ `s` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`t` datetime DEFAULT NULL,
`u` datetime DEFAULT '1986-09-27 03:00:00',
- `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `b` timestamp NOT NULL DEFAULT current_timestamp(),
+ `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
`d` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00',
`e` timestamp NULL DEFAULT NULL,
- `f` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- `g` datetime DEFAULT CURRENT_TIMESTAMP,
- `h` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+ `f` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `g` datetime DEFAULT current_timestamp(),
+ `h` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`i` datetime DEFAULT NULL,
`j` datetime DEFAULT '1986-09-27 03:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -803,7 +793,7 @@ CREATE TABLE t2 SELECT a FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+ `a` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a
@@ -812,7 +802,7 @@ CREATE TABLE t3 SELECT b FROM t1;
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `b` datetime DEFAULT CURRENT_TIMESTAMP
+ `b` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t3;
b
@@ -821,7 +811,7 @@ CREATE TABLE t4 SELECT c FROM t1;
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
+ `c` datetime DEFAULT NULL ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t4;
c
@@ -858,15 +848,15 @@ CREATE TABLE t2 ( b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRE
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SET TIMESTAMP = 2000.876543;
INSERT INTO t2( a ) VALUES ( 3 );
SELECT * FROM t2;
b a
-0000-00-00 00:00:00 1
-0000-00-00 00:00:00 2
+1970-01-01 00:16:40 1
+1970-01-01 00:16:40 2
1970-01-01 00:33:20 3
DROP TABLE t1, t2;
#
@@ -1051,7 +1041,7 @@ FROM dual;
SELECT 1, 2 INTO OUTFILE 't5.dat' FROM dual;
# Mon Aug 1 15:11:19 2011 UTC
SET TIMESTAMP = 1312211479.918273;
-LOAD DATA INFILE 't3.dat' INTO TABLE t1;
+LOAD DATA INFILE 't3.dat' IGNORE INTO TABLE t1;
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1261 Row 1 doesn't contain data for all columns
@@ -1071,7 +1061,7 @@ f NULL
g NULL
h NULL
i NULL
-LOAD DATA INFILE 't4.dat' INTO TABLE t2;
+LOAD DATA INFILE 't4.dat' IGNORE INTO TABLE t2;
Warnings:
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'e' at row 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'f' at row 1
@@ -1121,7 +1111,7 @@ DELETE FROM t2;
# (read_fixed_length()) than under the LOAD ... INTO TABLE t1 command
# above. The code in this path is copy-pasted code from the path taken
# under the syntax used in the previous LOAD command.
-LOAD DATA INFILE 't3.dat' INTO TABLE t1
+LOAD DATA INFILE 't3.dat' IGNORE INTO TABLE t1
FIELDS TERMINATED BY '' ENCLOSED BY '';
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
@@ -1235,17 +1225,17 @@ t1 CREATE TABLE `t1` (
`dummy` int(11) DEFAULT NULL,
`a` datetime DEFAULT NULL,
`b` datetime DEFAULT '2011-11-18 00:00:00',
- `like_b` datetime DEFAULT CURRENT_TIMESTAMP,
+ `like_b` datetime DEFAULT current_timestamp(),
`c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00',
- `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `like_c` datetime NOT NULL DEFAULT current_timestamp(),
+ `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(),
`e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00',
- `f` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `f` timestamp NOT NULL DEFAULT current_timestamp(),
`g` timestamp NULL DEFAULT NULL,
`h` int(11) DEFAULT NULL,
- `i` int(11) NOT NULL DEFAULT '42'
+ `i` int(11) NOT NULL DEFAULT 42
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-LOAD DATA INFILE "file1.dat" INTO table t1;
+LOAD DATA INFILE "file1.dat" IGNORE INTO table t1;
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1261 Row 1 doesn't contain data for all columns
@@ -1287,17 +1277,17 @@ t1 CREATE TABLE `t1` (
`dummy` int(11) DEFAULT NULL,
`a` datetime DEFAULT NULL,
`b` datetime DEFAULT '2011-11-18 00:00:00',
- `like_b` datetime DEFAULT CURRENT_TIMESTAMP,
+ `like_b` datetime DEFAULT current_timestamp(),
`c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00',
- `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `like_c` datetime NOT NULL DEFAULT current_timestamp(),
+ `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(),
`e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00',
- `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ `f` timestamp NULL DEFAULT current_timestamp(),
`g` timestamp NULL DEFAULT NULL,
`h` int(11) DEFAULT NULL,
- `i` int(11) NOT NULL DEFAULT '42'
+ `i` int(11) NOT NULL DEFAULT 42
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-LOAD DATA INFILE "file1.dat" INTO table t1;
+LOAD DATA INFILE "file1.dat" IGNORE INTO table t1;
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1261 Row 1 doesn't contain data for all columns
@@ -1354,17 +1344,17 @@ t1 CREATE TABLE `t1` (
`dummy` int(11) DEFAULT NULL,
`a` datetime DEFAULT NULL,
`b` datetime DEFAULT '2011-11-18 00:00:00',
- `like_b` datetime DEFAULT CURRENT_TIMESTAMP,
+ `like_b` datetime DEFAULT current_timestamp(),
`c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00',
- `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `like_c` datetime NOT NULL DEFAULT current_timestamp(),
+ `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(),
`e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00',
- `f` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `f` timestamp NOT NULL DEFAULT current_timestamp(),
`g` timestamp NULL DEFAULT NULL,
`h` int(11) DEFAULT NULL,
- `i` int(11) NOT NULL DEFAULT '42'
+ `i` int(11) NOT NULL DEFAULT 42
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-LOAD DATA INFILE "file2.dat" INTO table t1;
+LOAD DATA INFILE "file2.dat" IGNORE INTO table t1;
Warnings:
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'like_c' at row 1
@@ -1392,17 +1382,17 @@ t1 CREATE TABLE `t1` (
`dummy` int(11) DEFAULT NULL,
`a` datetime DEFAULT NULL,
`b` datetime DEFAULT '2011-11-18 00:00:00',
- `like_b` datetime DEFAULT CURRENT_TIMESTAMP,
+ `like_b` datetime DEFAULT current_timestamp(),
`c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00',
- `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `like_c` datetime NOT NULL DEFAULT current_timestamp(),
+ `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(),
`e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00',
- `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ `f` timestamp NULL DEFAULT current_timestamp(),
`g` timestamp NULL DEFAULT NULL,
`h` int(11) DEFAULT NULL,
- `i` int(11) NOT NULL DEFAULT '42'
+ `i` int(11) NOT NULL DEFAULT 42
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-LOAD DATA INFILE "file2.dat" INTO table t1;
+LOAD DATA INFILE "file2.dat" IGNORE INTO table t1;
Warnings:
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'like_c' at row 1
@@ -1440,7 +1430,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
- `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+ `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1
INSERT INTO t1 ( a ) VALUES ( 1 );
SELECT * FROM t1;
@@ -1454,7 +1444,7 @@ a b
# 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234;
UPDATE v1 SET a = 2;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM t1;
a b
1 1970-01-01 03:16:40
@@ -1477,7 +1467,7 @@ a c
1973-08-14 09:11:22 1
SET TIMESTAMP = 1.126789;
INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM v1;
a c
1973-08-14 09:11:22 1
@@ -1566,50 +1556,40 @@ SET TIME_ZONE = "+00:00";
# Test of errors for column data types that dont support function
# defaults.
#
-CREATE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP(6) );
-ERROR 42000: Invalid default value for 'a'
-CREATE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-CREATE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP(6) );
+CREATE OR REPLACE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
+drop table if exists t1;
#
# Test that the default clause behaves like NOW() regarding time zones.
#
@@ -2050,7 +2030,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
- `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
+ `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), c TIMESTAMP(6) NULL );
@@ -2058,7 +2038,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UP
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`a` int(11) DEFAULT NULL,
`c` timestamp(6) NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -2068,7 +2048,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UP
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -2094,7 +2074,7 @@ CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDAT
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6),
+ `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6),
`b` int(11) DEFAULT NULL,
`c` timestamp(6) NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -2103,7 +2083,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
- `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`c` timestamp(6) NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -2113,7 +2093,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` timestamp(6) NULL DEFAULT NULL,
- `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6),
+ `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6),
`b` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -2121,7 +2101,7 @@ CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMES
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`b` int(11) DEFAULT NULL,
`c` timestamp(6) NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -2130,7 +2110,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
- `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`c` timestamp(6) NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -2140,7 +2120,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` timestamp(6) NULL DEFAULT NULL,
- `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`b` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
@@ -2153,7 +2133,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
- `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
+ `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
#
@@ -2217,7 +2197,7 @@ CREATE TABLE t2 SELECT a FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
+ `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a
@@ -2226,7 +2206,7 @@ CREATE TABLE t3 SELECT b FROM t1;
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)
+ `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t3;
b
@@ -2235,7 +2215,7 @@ CREATE TABLE t4 SELECT c FROM t1;
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6)
+ `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t4;
c
@@ -2262,7 +2242,7 @@ CREATE TABLE t7 SELECT f FROM t1;
SHOW CREATE TABLE t7;
Table Create Table
t7 CREATE TABLE `t7` (
- `f` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
+ `f` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t7;
f
@@ -2271,7 +2251,7 @@ CREATE TABLE t8 SELECT g FROM t1;
SHOW CREATE TABLE t8;
Table Create Table
t8 CREATE TABLE `t8` (
- `g` datetime(6) DEFAULT CURRENT_TIMESTAMP(6)
+ `g` datetime(6) DEFAULT current_timestamp(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t8;
g
@@ -2280,7 +2260,7 @@ CREATE TABLE t9 SELECT h FROM t1;
SHOW CREATE TABLE t9;
Table Create Table
t9 CREATE TABLE `t9` (
- `h` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6)
+ `h` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t9;
h
@@ -2320,25 +2300,25 @@ SELECT * FROM t1;
SHOW CREATE TABLE t12;
Table Create Table
t12 CREATE TABLE `t12` (
- `k` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
- `l` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
- `m` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- `n` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6),
+ `k` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `l` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `m` timestamp(6) NOT NULL DEFAULT current_timestamp(6),
+ `n` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6),
`o` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765',
`p` timestamp(6) NULL DEFAULT NULL,
- `q` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
- `r` datetime(6) DEFAULT CURRENT_TIMESTAMP(6),
- `s` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6),
+ `q` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `r` datetime(6) DEFAULT current_timestamp(6),
+ `s` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6),
`t` datetime(6) DEFAULT NULL,
`u` datetime(6) DEFAULT '1986-09-27 03:00:00.098765',
- `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
- `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6),
+ `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6),
+ `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6),
`d` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765',
`e` timestamp(6) NULL DEFAULT NULL,
- `f` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
- `g` datetime(6) DEFAULT CURRENT_TIMESTAMP(6),
- `h` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6),
+ `f` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `g` datetime(6) DEFAULT current_timestamp(6),
+ `h` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6),
`i` datetime(6) DEFAULT NULL,
`j` datetime(6) DEFAULT '1986-09-27 03:00:00.098765'
) ENGINE=InnoDB DEFAULT CHARSET=latin1
@@ -2359,7 +2339,7 @@ CREATE TABLE t2 SELECT a FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
+ `a` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a
@@ -2368,7 +2348,7 @@ CREATE TABLE t3 SELECT b FROM t1;
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6)
+ `b` datetime(6) DEFAULT current_timestamp(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t3;
b
@@ -2377,7 +2357,7 @@ CREATE TABLE t4 SELECT c FROM t1;
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6)
+ `c` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t4;
c
@@ -2414,15 +2394,15 @@ CREATE TABLE t2 ( b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SET TIMESTAMP = 2000.876543;
INSERT INTO t2( a ) VALUES ( 3 );
SELECT * FROM t2;
b a
-0000-00-00 00:00:00.000000 1
-0000-00-00 00:00:00.000000 2
+1970-01-01 00:16:40.987654 1
+1970-01-01 00:16:40.987654 2
1970-01-01 00:33:20.876543 3
DROP TABLE t1, t2;
#
@@ -2607,7 +2587,7 @@ FROM dual;
SELECT 1, 2 INTO OUTFILE 't5.dat' FROM dual;
# Mon Aug 1 15:11:19 2011 UTC
SET TIMESTAMP = 1312211479.918273;
-LOAD DATA INFILE 't3.dat' INTO TABLE t1;
+LOAD DATA INFILE 't3.dat' IGNORE INTO TABLE t1;
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1261 Row 1 doesn't contain data for all columns
@@ -2627,7 +2607,7 @@ f NULL
g NULL
h NULL
i NULL
-LOAD DATA INFILE 't4.dat' INTO TABLE t2;
+LOAD DATA INFILE 't4.dat' IGNORE INTO TABLE t2;
Warnings:
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'e' at row 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'f' at row 1
@@ -2677,7 +2657,7 @@ DELETE FROM t2;
# (read_fixed_length()) than under the LOAD ... INTO TABLE t1 command
# above. The code in this path is copy-pasted code from the path taken
# under the syntax used in the previous LOAD command.
-LOAD DATA INFILE 't3.dat' INTO TABLE t1
+LOAD DATA INFILE 't3.dat' IGNORE INTO TABLE t1
FIELDS TERMINATED BY '' ENCLOSED BY '';
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
@@ -2791,17 +2771,17 @@ t1 CREATE TABLE `t1` (
`dummy` int(11) DEFAULT NULL,
`a` datetime(6) DEFAULT NULL,
`b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000',
- `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6),
+ `like_b` datetime(6) DEFAULT current_timestamp(6),
`c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000',
- `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6),
+ `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6),
+ `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6),
`e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000',
- `f` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
+ `f` timestamp(6) NOT NULL DEFAULT current_timestamp(6),
`g` timestamp(6) NULL DEFAULT NULL,
`h` int(11) DEFAULT NULL,
- `i` int(11) NOT NULL DEFAULT '42'
+ `i` int(11) NOT NULL DEFAULT 42
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-LOAD DATA INFILE "file1.dat" INTO table t1;
+LOAD DATA INFILE "file1.dat" IGNORE INTO table t1;
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1261 Row 1 doesn't contain data for all columns
@@ -2843,17 +2823,17 @@ t1 CREATE TABLE `t1` (
`dummy` int(11) DEFAULT NULL,
`a` datetime(6) DEFAULT NULL,
`b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000',
- `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6),
+ `like_b` datetime(6) DEFAULT current_timestamp(6),
`c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000',
- `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6),
+ `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6),
+ `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6),
`e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000',
- `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ `f` timestamp NULL DEFAULT current_timestamp(),
`g` timestamp(6) NULL DEFAULT NULL,
`h` int(11) DEFAULT NULL,
- `i` int(11) NOT NULL DEFAULT '42'
+ `i` int(11) NOT NULL DEFAULT 42
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-LOAD DATA INFILE "file1.dat" INTO table t1;
+LOAD DATA INFILE "file1.dat" IGNORE INTO table t1;
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1261 Row 1 doesn't contain data for all columns
@@ -2910,17 +2890,17 @@ t1 CREATE TABLE `t1` (
`dummy` int(11) DEFAULT NULL,
`a` datetime(6) DEFAULT NULL,
`b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000',
- `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6),
+ `like_b` datetime(6) DEFAULT current_timestamp(6),
`c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000',
- `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6),
+ `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6),
+ `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6),
`e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000',
- `f` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
+ `f` timestamp(6) NOT NULL DEFAULT current_timestamp(6),
`g` timestamp(6) NULL DEFAULT NULL,
`h` int(11) DEFAULT NULL,
- `i` int(11) NOT NULL DEFAULT '42'
+ `i` int(11) NOT NULL DEFAULT 42
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-LOAD DATA INFILE "file2.dat" INTO table t1;
+LOAD DATA INFILE "file2.dat" IGNORE INTO table t1;
Warnings:
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'like_c' at row 1
@@ -2948,17 +2928,17 @@ t1 CREATE TABLE `t1` (
`dummy` int(11) DEFAULT NULL,
`a` datetime(6) DEFAULT NULL,
`b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000',
- `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6),
+ `like_b` datetime(6) DEFAULT current_timestamp(6),
`c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000',
- `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6),
+ `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6),
+ `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6),
`e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000',
- `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ `f` timestamp NULL DEFAULT current_timestamp(),
`g` timestamp(6) NULL DEFAULT NULL,
`h` int(11) DEFAULT NULL,
- `i` int(11) NOT NULL DEFAULT '42'
+ `i` int(11) NOT NULL DEFAULT 42
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-LOAD DATA INFILE "file2.dat" INTO table t1;
+LOAD DATA INFILE "file2.dat" IGNORE INTO table t1;
Warnings:
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'like_c' at row 1
@@ -2996,7 +2976,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
- `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)
+ `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
INSERT INTO t1 ( a ) VALUES ( 1 );
SELECT * FROM t1;
@@ -3010,7 +2990,7 @@ a b
# 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234;
UPDATE v1 SET a = 2;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM t1;
a b
1 1970-01-01 03:16:40.123456
@@ -3033,7 +3013,7 @@ a c
1973-08-14 09:11:22.089786 1
SET TIMESTAMP = 1.126789;
INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM v1;
a c
1973-08-14 09:11:22.089786 1
diff --git a/mysql-test/r/function_defaults_notembedded.result b/mysql-test/r/function_defaults_notembedded.result
index 9bd03ab9f05..645133bad1d 100644
--- a/mysql-test/r/function_defaults_notembedded.result
+++ b/mysql-test/r/function_defaults_notembedded.result
@@ -48,15 +48,19 @@ DROP TABLE t1;
# with different sets of active defaults.
#
CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
+connect con1, localhost, root,,;
# 2011-04-19 08:04:01 UTC
SET TIMESTAMP = 1303200241.345678;
SET debug_sync = 'before_write_delayed SIGNAL parked WAIT_FOR go';
INSERT DELAYED INTO t1 ( a ) VALUES (1), (2), (3);
+connection default;
SET debug_sync = 'now WAIT_FOR parked';
+connect con2, localhost, root,,;
# 2011-04-19 08:04:01 UTC
SET TIME_ZONE="+03:00";
SET TIMESTAMP = 1303200241.456789;
INSERT DELAYED INTO t1 ( a, b ) VALUES (4, '1977-12-19 12:34:56.789123'), (5, '1977-12-19 12:34:57.891234'), (6, '1977-12-19 12:34:58.912345');
+connection default;
SET debug_sync = 'now SIGNAL go';
SELECT * FROM t1;
a b
@@ -66,6 +70,8 @@ a b
4 1977-12-19 09:34:56
5 1977-12-19 09:34:57
6 1977-12-19 09:34:58
+disconnect con1;
+disconnect con2;
DROP TABLE t1;
#
# Test of early activation of function defaults.
@@ -133,15 +139,19 @@ DROP TABLE t1;
# with different sets of active defaults.
#
CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6));
+connect con1, localhost, root,,;
# 2011-04-19 08:04:01 UTC
SET TIMESTAMP = 1303200241.345678;
SET debug_sync = 'before_write_delayed SIGNAL parked WAIT_FOR go';
INSERT DELAYED INTO t1 ( a ) VALUES (1), (2), (3);
+connection default;
SET debug_sync = 'now WAIT_FOR parked';
+connect con2, localhost, root,,;
# 2011-04-19 08:04:01 UTC
SET TIME_ZONE="+03:00";
SET TIMESTAMP = 1303200241.456789;
INSERT DELAYED INTO t1 ( a, b ) VALUES (4, '1977-12-19 12:34:56.789123'), (5, '1977-12-19 12:34:57.891234'), (6, '1977-12-19 12:34:58.912345');
+connection default;
SET debug_sync = 'now SIGNAL go';
SELECT * FROM t1;
a b
@@ -151,6 +161,8 @@ a b
4 1977-12-19 09:34:56.789123
5 1977-12-19 09:34:57.891234
6 1977-12-19 09:34:58.912345
+disconnect con1;
+disconnect con2;
DROP TABLE t1;
#
# Test of early activation of function defaults.
diff --git a/mysql-test/r/get_diagnostics.result b/mysql-test/r/get_diagnostics.result
index 623d48c33d5..fbe3a02ee88 100644
--- a/mysql-test/r/get_diagnostics.result
+++ b/mysql-test/r/get_diagnostics.result
@@ -273,11 +273,11 @@ SELECT CAST(-19999999999999999999 AS SIGNED);
CAST(-19999999999999999999 AS SIGNED)
-9223372036854775808
Warnings:
-Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated
GET DIAGNOSTICS @var = NUMBER;
SHOW WARNINGS;
Level Code Message
-Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated
#
# If GET DIAGNOSTICS itself causes an error, an error message is appended.
#
@@ -285,14 +285,14 @@ SELECT CAST(-19999999999999999999 AS SIGNED);
CAST(-19999999999999999999 AS SIGNED)
-9223372036854775808
Warnings:
-Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated
GET DIAGNOSTICS CONDITION 99999 @var = CLASS_ORIGIN;
Warnings:
-Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated
Error 1758 Invalid condition number
SHOW WARNINGS;
Level Code Message
-Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated
Error 1758 Invalid condition number
# Statement information runtime
@@ -302,8 +302,8 @@ CAST(-19999999999999999999 AS SIGNED);
CAST(-19999999999999999999 AS SIGNED) CAST(-19999999999999999999 AS SIGNED)
-9223372036854775808 -9223372036854775808
Warnings:
-Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated.
-Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated
+Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated
GET DIAGNOSTICS @var = NUMBER;
SELECT @var;
@var
@@ -353,7 +353,7 @@ SELECT CAST(-19999999999999999999 AS SIGNED);
CAST(-19999999999999999999 AS SIGNED)
-9223372036854775808
Warnings:
-Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated
GET DIAGNOSTICS CONDITION 1
@class_origin = CLASS_ORIGIN,
@subclass_origin = SUBCLASS_ORIGIN,
@@ -392,7 +392,7 @@ SELECT
@table_name
@column_name
@cursor_name
-@message_text Got overflow when converting '-19999999999999999999' to INT. Value truncated.
+@message_text Got overflow when converting '-19999999999999999999' to INT. Value truncated
@mysql_errno 1916
@returned_sqlstate 22003
CREATE PROCEDURE p1()
@@ -452,13 +452,13 @@ schema_name
table_name
column_name
cursor_name
-message_text Got overflow when converting '-19999999999999999999' to INT. Value truncated.
+message_text Got overflow when converting '-19999999999999999999' to INT. Value truncated
mysql_errno 1916
returned_sqlstate 22003
Warnings:
Level Warning
Code 1916
-Message Got overflow when converting '-19999999999999999999' to INT. Value truncated.
+Message Got overflow when converting '-19999999999999999999' to INT. Value truncated
DROP PROCEDURE p1;
CREATE PROCEDURE p1()
BEGIN
@@ -475,13 +475,13 @@ END|
CALL p1();
CAST(-19999999999999999999 AS SIGNED) -9223372036854775808
errno1 1916
-msg1 Got overflow when converting '-19999999999999999999' to INT. Value truncated.
+msg1 Got overflow when converting '-19999999999999999999' to INT. Value truncated
errno2 1758
msg2 Invalid condition number
Warnings:
Level Warning
Code 1916
-Message Got overflow when converting '-19999999999999999999' to INT. Value truncated.
+Message Got overflow when converting '-19999999999999999999' to INT. Value truncated
Level Error
Code 1758
Message Invalid condition number
@@ -625,9 +625,10 @@ END|
CREATE TABLE t1 (a INT);
CALL p1();
v
-T
+NULL
Warnings:
Note 1050 Table 't1' already exists
+Error 1406 Data too long for column 'v' at row 1
DROP TABLE t1;
DROP PROCEDURE p1;
@@ -769,7 +770,7 @@ SELECT CAST(-19999999999999999999 AS SIGNED);
CAST(-19999999999999999999 AS SIGNED)
-9223372036854775808
Warnings:
-Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated.
+Warning 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated
GET DIAGNOSTICS CONDITION 1 @var1 = MESSAGE_TEXT, @var2 = CLASS_ORIGIN;
SELECT CHARSET(@var1), COLLATION(@var1), COERCIBILITY(@var1);
CHARSET(@var1) COLLATION(@var1) COERCIBILITY(@var1)
diff --git a/mysql-test/r/gis-alter_table_online.result b/mysql-test/r/gis-alter_table_online.result
index ea7ab3b66bd..80e40416c1e 100644
--- a/mysql-test/r/gis-alter_table_online.result
+++ b/mysql-test/r/gis-alter_table_online.result
@@ -6,39 +6,39 @@
#
CREATE TABLE t1 (a TINYBLOB);
ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMBLOB);
ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a BLOB);
ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a LONGBLOB);
ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY);
ALTER TABLE t1 MODIFY a TINYBLOB, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY);
ALTER TABLE t1 MODIFY a MEDIUMBLOB, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY);
ALTER TABLE t1 MODIFY a BLOB, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY);
ALTER TABLE t1 MODIFY a LONGBLOB, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY);
ALTER TABLE t1 MODIFY a POLYGON, ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a POLYGON);
ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
diff --git a/mysql-test/r/gis-debug.result b/mysql-test/r/gis-debug.result
index 5e8b4747f6d..79adef34b98 100644
--- a/mysql-test/r/gis-debug.result
+++ b/mysql-test/r/gis-debug.result
@@ -294,3 +294,14 @@ SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) '))));
ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'),
SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) '))))
POLYGON((9 9,5 2,4 5,9 9))
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-10134 Add full support for DEFAULT
+#
+CREATE TABLE t1 (a INT DEFAULT ST_GIS_DEBUG(1));
+ERROR HY000: Function or expression 'st_gis_debug()' cannot be used in the DEFAULT clause of `a`
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/gis-json.result b/mysql-test/r/gis-json.result
new file mode 100644
index 00000000000..1d6e2193fc9
--- /dev/null
+++ b/mysql-test/r/gis-json.result
@@ -0,0 +1,109 @@
+select st_asgeojson(geomfromtext('POINT(1 1)'));
+st_asgeojson(geomfromtext('POINT(1 1)'))
+{"type": "Point", "coordinates": [1, 1]}
+select st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)'));
+st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)'))
+{"type": "LineString", "coordinates": [[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))'));
+st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))'))
+{"type": "Polygon", "coordinates": [[[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)))'));
+st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))'))
+{"type": "MultiPolygon", "coordinates": [[[[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))'));
+st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))'))
+{"type": "MultiLineString", "coordinates": [[[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)'));
+st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)'))
+{"type": "MultiPoint", "coordinates": [[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]}
+select st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))'));
+st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))'))
+{"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [100, 0]}, {"type": "LineString", "coordinates": [[101, 0], [102, 1]]}]}
+SELECT st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}'));
+st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}'))
+POINT(1 2)
+SELECT st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}'));
+st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}'))
+LINESTRING(1 2,4 5,7 8)
+SELECT st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
+st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'))
+POLYGON((10 10,20 10,20 20,10 20,10 10))
+SELECT st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}'));
+st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}'))
+MULTIPOINT(1 2,4 5,7 8)
+SELECT st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
+st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'))
+MULTILINESTRING((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]]]]}'));
+st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}'))
+MULTIPOLYGON(((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]]}]}'));
+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]]}]}'))
+GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))
+SELECT st_astext(st_geomfromgeojson('{"type":"point"}'));
+st_astext(st_geomfromgeojson('{"type":"point"}'))
+NULL
+Warnings:
+Warning 4048 Incorrect GeoJSON format specified for st_geomfromgeojson function.
+SELECT st_astext(st_geomfromgeojson('{"type":"point"'));
+st_astext(st_geomfromgeojson('{"type":"point"'))
+NULL
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'st_geomfromgeojson'
+SELECT st_astext(st_geomfromgeojson('{"type""point"}'));
+st_astext(st_geomfromgeojson('{"type""point"}'))
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'st_geomfromgeojson' at position 7
+SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'));
+st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'))
+POINT(102 0.5)
+SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'));
+st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'))
+GEOMETRYCOLLECTION(POINT(102 0.5))
+SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',5));
+ERROR HY000: Incorrect option value: '5' for function ST_GeometryFromJSON
+SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',1));
+ERROR 22023: Invalid GIS data provided to function ST_GeometryFromJSON.
+SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2));
+ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2))
+POINT(5.3 15)
+SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3));
+ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3))
+POINT(5.3 15)
+SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4));
+ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4))
+POINT(5.3 15)
+SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2);
+ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2)
+{"type": "Point", "coordinates": [5.36, 7.27]}
+SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),1);
+ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),1)
+{"type": "Point", "coordinates": [5.4, 7.3]}
+SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),10);
+ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),10)
+{"type": "Point", "coordinates": [5.363, 7.266]}
+SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1);
+ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1)
+{"bbox": [10, 11, 10, 11], "type": "Point", "coordinates": [10, 11]}
+SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5);
+ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5)
+{"bbox": [10, 11, 10, 11], "type": "Point", "coordinates": [10, 11]}
+SELECT st_astext(st_geomfromgeojson('{"type": "MultiLineString","coordinates": []}')) as a;
+a
+NULL
+Warnings:
+Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array.
+SELECT st_astext(st_geomfromgeojson('{"type": "Polygon","coordinates": []}')) as a;
+a
+NULL
+Warnings:
+Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array.
+SELECT st_astext(st_geomfromgeojson('{"type": "MultiPolygon","coordinates": []}')) as a;
+a
+NULL
+Warnings:
+Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array.
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/gis-rt-precise.result b/mysql-test/r/gis-rt-precise.result
index 65583a0ce0d..d3308ed90ba 100644
--- a/mysql-test/r/gis-rt-precise.result
+++ b/mysql-test/r/gis-rt-precise.result
@@ -51,7 +51,7 @@ count(*)
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 40))'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range g g 34 NULL 1 Using where
+1 SIMPLE t1 range g g 34 NULL 4 Using where
SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 40))'));
fid AsText(g)
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
index 0506a0b2a0a..2450da8a811 100644
--- a/mysql-test/r/gis-rtree.result
+++ b/mysql-test/r/gis-rtree.result
@@ -1,9 +1,8 @@
-DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (
-fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
g GEOMETRY NOT NULL,
SPATIAL KEY(g)
-) ENGINE=MyISAM;
+);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -183,9 +182,9 @@ fid AsText(g)
2 LINESTRING(149 149,151 151)
DROP TABLE t1;
CREATE TABLE t2 (
-fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
g GEOMETRY NOT NULL
-) ENGINE=MyISAM;
+);
INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)));
INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10)));
INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10)));
@@ -298,11 +297,11 @@ t2 CREATE TABLE `t2` (
SELECT count(*) FROM t2;
count(*)
100
-EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
+EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range g g 34 NULL 1 Using where
-SELECT fid, AsText(g) FROM t2 WHERE Within(g,
+1 SIMPLE t2 range g g 34 NULL 4 Using where
+SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
fid AsText(g)
46 LINESTRING(51 41,60 50)
@@ -710,9 +709,6 @@ SELECT count(*) FROM t2;
count(*)
100
DROP TABLE t2;
-drop table if exists t1;
-Warnings:
-Note 1051 Unknown table 'test.t1'
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)"));
@@ -751,10 +747,10 @@ Table Op Msg_type Msg_text
test.t1 analyze status OK
drop table t1;
CREATE TABLE t1 (
-fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
g GEOMETRY NOT NULL,
SPATIAL KEY(g)
-) ENGINE=MyISAM;
+);
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)'));
drop table t1;
CREATE TABLE t1 (
@@ -762,9 +758,9 @@ line GEOMETRY NOT NULL,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32),
SPATIAL KEY (line)
-) engine=myisam;
+);
ALTER TABLE t1 DISABLE KEYS;
-INSERT INTO t1 (name, kind, line) VALUES
+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)")),
@@ -800,12 +796,10 @@ 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));
-INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
+INSERT IGNORE INTO t2 SELECT GeomFromText(st) FROM t1;
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1, t2;
-CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-Warnings:
-Warning 1101 BLOB/TEXT column 'geometry' can't have a default value
+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,
@@ -821,9 +815,7 @@ drop table t1;
CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-Warnings:
-Warning 1101 BLOB/TEXT column 'c1' can't have a default value
+) DEFAULT CHARSET=latin1;
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
@@ -837,9 +829,7 @@ DROP TABLE t1;
CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-Warnings:
-Warning 1101 BLOB/TEXT column 'c1' can't have a default value
+) DEFAULT CHARSET=latin1;
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
@@ -880,7 +870,7 @@ c3 varchar(10) collate utf8_bin default NULL,
spatial_point point NOT NULL,
PRIMARY KEY(id),
SPATIAL KEY (spatial_point)
-)ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+) 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)')),
@@ -1459,7 +1449,7 @@ drop table t1;
CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
INSERT INTO t1(foo) VALUES (NULL);
ERROR 23000: Column 'foo' cannot be null
-INSERT INTO t1() VALUES ();
+INSERT IGNORE INTO t1() VALUES ();
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
INSERT INTO t1(foo) VALUES ('');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
@@ -1550,11 +1540,11 @@ HANDLER t1 CLOSE;
DROP TABLE t1;
End of 5.0 tests.
#
-# Bug #57323/11764487: myisam corruption with insert ignore
+# Bug #57323/11764487: myisam corruption with insert ignore
# and invalid spatial data
#
CREATE TABLE t1(a POINT NOT NULL, b GEOMETRY NOT NULL,
-SPATIAL KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
+SPATIAL KEY(a), SPATIAL KEY(b));
INSERT INTO t1 VALUES(GEOMFROMTEXT("point (0 0)"), GEOMFROMTEXT("point (1 1)"));
INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=GEOMFROMTEXT("error");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
@@ -1565,7 +1555,7 @@ ASTEXT(a) ASTEXT(b)
POINT(0 0) POINT(1 1)
DROP TABLE t1;
CREATE TABLE t1(a INT NOT NULL, b GEOMETRY NOT NULL,
-KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
+KEY(a), SPATIAL KEY(b));
INSERT INTO t1 VALUES(0, GEOMFROMTEXT("point (1 1)"));
INSERT IGNORE INTO t1 SET a=0, b=GEOMFROMTEXT("error");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
@@ -1579,7 +1569,7 @@ End of 5.1 tests
CREATE TABLE t1 (
l LINESTRING NOT NULL,
SPATIAL KEY(l)
-) ENGINE = myisam;
+);
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)'));
@@ -1602,7 +1592,7 @@ DROP TABLE t1;
#
# MDEV-8239 Reverse spatial operations OP(const, field) do not get optimized
#
-CREATE TABLE t1 (a GEOMETRY NOT NULL, SPATIAL KEY(a)) ENGINE=MyISAM;
+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));
id select_type table type possible_keys key key_len ref rows Extra
@@ -1620,7 +1610,7 @@ DROP TABLE t1;
#
# MDEV-8610 "WHERE CONTAINS(indexed_geometry_column,1)" causes full table scan
#
-CREATE TABLE t1 (a GEOMETRY NOT NULL, SPATIAL KEY(a)) ENGINE=MyISAM;
+CREATE TABLE t1 (a GEOMETRY NOT NULL, SPATIAL KEY(a));
INSERT INTO t1 VALUES (Point(1,1)),(Point(2,2)),(Point(3,3));
EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,1);
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 76f4f6accdb..93e980efa2b 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -488,7 +488,7 @@ explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimpl
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select st_issimple(st_multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(point(3,6)) AS `issimple(Point(3, 6))`
+Note 1003 select st_issimple(geometrycollection(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(point(3,6)) AS `issimple(Point(3, 6))`
create table t1 (a geometry not null);
insert into t1 values (GeomFromText('Point(1 2)'));
insert into t1 values ('Garbage');
@@ -614,8 +614,6 @@ t1 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 ;
-Warnings:
-Warning 1101 BLOB/TEXT column 'geo' can't have a default value
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
@@ -809,7 +807,7 @@ drop procedure if exists fn3;
create function fn3 () returns point deterministic return GeomFromText("point(1 1)");
show create function fn3;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-fn3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS point
+fn3 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS point
DETERMINISTIC
return GeomFromText("point(1 1)") latin1 latin1_swedish_ci latin1_swedish_ci
select astext(fn3());
@@ -1746,18 +1744,18 @@ GEOMETRY_COLUMNS CREATE TEMPORARY TABLE `GEOMETRY_COLUMNS` (
`G_TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '',
`G_TABLE_NAME` varchar(64) NOT NULL DEFAULT '',
`G_GEOMETRY_COLUMN` varchar(64) NOT NULL DEFAULT '',
- `STORAGE_TYPE` tinyint(2) NOT NULL DEFAULT '0',
- `GEOMETRY_TYPE` int(7) NOT NULL DEFAULT '0',
- `COORD_DIMENSION` tinyint(2) NOT NULL DEFAULT '0',
- `MAX_PPR` tinyint(2) NOT NULL DEFAULT '0',
- `SRID` smallint(5) NOT NULL DEFAULT '0'
+ `STORAGE_TYPE` tinyint(2) NOT NULL DEFAULT 0,
+ `GEOMETRY_TYPE` int(7) NOT NULL DEFAULT 0,
+ `COORD_DIMENSION` tinyint(2) NOT NULL DEFAULT 0,
+ `MAX_PPR` tinyint(2) NOT NULL DEFAULT 0,
+ `SRID` smallint(5) NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8
SHOW CREATE TABLE information_schema.spatial_ref_sys;
Table Create Table
SPATIAL_REF_SYS CREATE TEMPORARY TABLE `SPATIAL_REF_SYS` (
- `SRID` smallint(5) NOT NULL DEFAULT '0',
+ `SRID` smallint(5) NOT NULL DEFAULT 0,
`AUTH_NAME` varchar(512) NOT NULL DEFAULT '',
- `AUTH_SRID` int(5) NOT NULL DEFAULT '0',
+ `AUTH_SRID` int(5) NOT NULL DEFAULT 0,
`SRTEXT` varchar(2048) NOT NULL DEFAULT ''
) ENGINE=MEMORY DEFAULT CHARSET=utf8
create table t1(g GEOMETRY, pt POINT);
@@ -1861,3 +1859,375 @@ t2 CREATE TABLE `t2` (
`w2` int(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2;
+#
+# Start of 10.2 tests
+#
+create view v1 as select AsWKT(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))));
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select st_astext(geometrycollection(point(44,6),geometrycollection(point(3,6),point(7,9)))) AS `Name_exp_1` latin1 latin1_swedish_ci
+select * from v1;
+Name_exp_1
+GEOMETRYCOLLECTION(POINT(44 6),GEOMETRYCOLLECTION(POINT(3 6),POINT(7 9)))
+drop view v1;
+#
+# MDEV-10134 Add full support for DEFAULT
+#
+CREATE TABLE t1 (a POINT, x DOUBLE DEFAULT x(a), y DOUBLE DEFAULT y(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` point DEFAULT NULL,
+ `x` double DEFAULT st_x(`a`),
+ `y` double DEFAULT st_y(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (Point(1,2));
+SELECT x,y FROM t1;
+x y
+1 2
+DROP TABLE t1;
+CREATE TABLE t1 (g GEOMETRY, area DOUBLE DEFAULT ST_AREA(g));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `g` geometry DEFAULT NULL,
+ `area` double DEFAULT st_area(`g`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (g) VALUES (GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'));
+SELECT area FROM t1;
+area
+400
+DROP TABLE t1;
+CREATE TABLE t1 (g GEOMETRY, length DOUBLE DEFAULT ST_LENGTH(g));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `g` geometry DEFAULT NULL,
+ `length` double DEFAULT st_length(`g`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (g) VALUES (GeomFromText('LINESTRING(0 0,20 0,20 20,0 20,0 0)'));
+SELECT length FROM t1;
+length
+80
+DROP TABLE t1;
+CREATE TABLE t1 (g POINT, distance DOUBLE DEFAULT ST_DISTANCE(g, POINT(0,0)));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `g` point DEFAULT NULL,
+ `distance` double DEFAULT st_distance(`g`,point(0,0))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (g) VALUES (Point(1,0));
+SELECT distance FROM t1;
+distance
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a TEXT, g GEOMETRY DEFAULT GeomFromText(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text DEFAULT NULL,
+ `g` geometry DEFAULT st_geometryfromtext(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('point(1 1)');
+SELECT AsText(g) FROM t1;
+AsText(g)
+POINT(1 1)
+DROP TABLE t1;
+CREATE TABLE t1 (x INT, y INT, g GEOMETRY DEFAULT POINT(x,y));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL,
+ `y` int(11) DEFAULT NULL,
+ `g` geometry DEFAULT point(`x`,`y`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (x,y) VALUES (10,20);
+SELECT AsText(g) FROM t1;
+AsText(g)
+POINT(10 20)
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT PointN(a,2));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` geometry DEFAULT st_pointn(`a`,2)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)'));
+SELECT AsText(b) FROM t1;
+AsText(b)
+POINT(2 2)
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT StartPoint(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` geometry DEFAULT st_startpoint(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)'));
+SELECT AsText(b) FROM t1;
+AsText(b)
+POINT(1 1)
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c GEOMETRY DEFAULT GeometryCollection(a,b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` geometry DEFAULT NULL,
+ `c` geometry DEFAULT geometrycollection(`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES (Point(1,1), Point(2,2));
+SELECT AsText(c) FROM t1;
+AsText(c)
+GEOMETRYCOLLECTION(POINT(1 1),POINT(2 2))
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT GeomFromWKB(AsBinary(a),20));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` geometry DEFAULT st_geometryfromwkb(st_aswkb(`a`),20)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (GeomFromText('POINT(1 1)', 10));
+SELECT AsText(a), SRID(a), AsText(b), SRID(b) FROM t1;
+AsText(a) SRID(a) AsText(b) SRID(b)
+POINT(1 1) 10 POINT(1 1) 20
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT BOUNDARY(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` geometry DEFAULT st_boundary(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
+SELECT AsText(b) FROM t1;
+AsText(b)
+LINESTRING(10 10,10 20,20 20,20 10,10 10)
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT BUFFER(a,10));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` geometry DEFAULT st_buffer(`a`,10)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
+SELECT GeometryType(b) FROM t1;
+GeometryType(b)
+POLYGON
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT CENTROID(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` geometry DEFAULT st_centroid(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
+SELECT AsText(b) FROM t1;
+AsText(b)
+POINT(15 15)
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT ENVELOPE(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` geometry DEFAULT st_envelope(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,4 4)'));
+SELECT AsText(b) FROM t1;
+AsText(b)
+POLYGON((1 1,4 1,4 4,1 4,1 1))
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT PointOnSurface(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` geometry DEFAULT st_pointonsurface(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
+SELECT GeometryType(b) FROM t1;
+GeometryType(b)
+POINT
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` geometry DEFAULT point(1,1),
+ `c` geometry DEFAULT st_union(`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (Point(0,0));
+SELECT AsText(c) FROM t1;
+AsText(c)
+MULTIPOINT(0 0,1 1)
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b VARCHAR(20) DEFAULT GeometryType(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` varchar(20) DEFAULT st_geometrytype(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (Point(0, 0));
+SELECT b FROM t1;
+b
+POINT
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsSimple(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` int(11) DEFAULT st_issimple(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (Point(0, 0));
+SELECT b FROM t1;
+b
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsEmpty(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` int(11) DEFAULT st_isempty(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (Point(0, 0));
+SELECT b FROM t1;
+b
+0
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsRing(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` int(11) DEFAULT st_isring(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)'));
+SELECT b FROM t1;
+b
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsClosed(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` int(11) DEFAULT st_isclosed(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)'));
+SELECT b FROM t1;
+b
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT Dimension(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` int(11) DEFAULT st_dimension(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (Buffer(Point(1,1),1));
+SELECT b FROM t1;
+b
+2
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumGeometries(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` int(11) DEFAULT st_numgeometries(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (ST_UNION(Point(1,1),Point(0,0)));
+SELECT b FROM t1;
+b
+2
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumInteriorRings(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` int(11) DEFAULT st_numinteriorrings(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+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;
+b
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumPoints(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` int(11) DEFAULT st_numpoints(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (LineString(Point(1,1),Point(0,0)));
+SELECT b FROM t1;
+b
+2
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT SRID(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` int(11) DEFAULT srid(`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (GeomFromText('Point(1 1)', 100));
+SELECT b FROM t1;
+b
+100
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT MBRDisjoint(a,b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` geometry DEFAULT NULL,
+ `c` int(11) DEFAULT mbrdisjoint(`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
+SELECT c FROM t1;
+c
+0
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT ST_Disjoint(a,b));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` geometry DEFAULT NULL,
+ `c` int(11) DEFAULT st_disjoint(`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
+SELECT c FROM t1;
+c
+0
+DROP TABLE t1;
+CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT ST_Relate(a,b,'T*F**FFF*'));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` geometry DEFAULT NULL,
+ `b` geometry DEFAULT NULL,
+ `c` int(11) DEFAULT st_relate(`a`,`b`,'T*F**FFF*')
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
+SELECT c FROM t1;
+c
+1
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/gis2.result b/mysql-test/r/gis2.result
index 214431e1d2d..2d5ae9abf73 100644
--- a/mysql-test/r/gis2.result
+++ b/mysql-test/r/gis2.result
@@ -12,3 +12,27 @@ WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'));
id
2
DROP TABLE t1;
+create table t1 (p point default "qwer");
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+create table t1 (p point default 0);
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+create table t1 (p point not null default st_geometryfromtext('point 0)'));
+ERROR 42000: Invalid default value for 'p'
+create table t1 (p point not null default st_geometryfromtext('point(0 0)'));
+insert into t1 values(default);
+select st_astext(p) from t1;
+st_astext(p)
+POINT(0 0)
+drop table t1;
+create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),0));
+set timestamp=10;
+insert into t1 values(default);
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+drop table t1;
+SET timestamp=default;
+create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),0));
+set timestamp=10;
+alter table t1 add column i int;
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+drop table t1;
+SET timestamp=default;
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 826d1f6c6b2..b250137ebf8 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -4,6 +4,8 @@ SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creato
SET GLOBAL log_bin_trust_function_creators = 1;
drop table if exists t1;
drop database if exists mysqltest;
+connect master,localhost,root,,;
+connection master;
SET NAMES binary;
delete from mysql.user where user='mysqltest_1';
delete from mysql.db where user='mysqltest_1';
@@ -518,6 +520,8 @@ 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;
@@ -551,6 +555,7 @@ update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2;
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 's' in table 't1'
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;
a q b r
10 2 1 2
@@ -565,6 +570,9 @@ grant all on mysqltest_2.* to mysqltest_3@localhost;
grant select on *.* to mysqltest_3@localhost;
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;
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
@@ -576,6 +584,7 @@ update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200;
ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't2'
update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200;
ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1'
+connection master;
select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
a q b r
10 2 1 2
@@ -589,6 +598,7 @@ delete from mysql.columns_priv where user="mysqltest_3";
flush privileges;
drop database mysqltest_1;
drop database mysqltest_2;
+disconnect conn2;
SHOW PRIVILEGES;
Privilege Context Comment
Alter Tables To alter the table
@@ -622,14 +632,22 @@ Trigger Tables To use triggers
Create tablespace Server Admin To create/alter/drop tablespaces
Update Tables To update existing rows
Usage Server Admin No privileges - allow connect only
+connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection root;
create database mysqltest;
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;
alter table t1 rename t2;
ERROR 42000: INSERT, CREATE command denied to user 'mysqltest_1'@'localhost' for table '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;
CREATE USER dummy@localhost;
CREATE DATABASE mysqltest;
CREATE TABLE mysqltest.dummytable (dummyfield INT);
@@ -667,7 +685,7 @@ Db char(64) NO PRI
User char(80) NO PRI
Table_name char(64) NO PRI
Grantor char(141) NO MUL
-Timestamp timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
+Timestamp timestamp NO current_timestamp() on update current_timestamp()
Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') NO
Column_priv set('Select','Insert','Update','References') NO
use test;
@@ -742,6 +760,7 @@ use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost;
DROP USER dummy@localhost;
DROP DATABASE mysqltest;
+connection default;
use mysql;
insert into tables_priv values ('','test_db','mysqltest_1','test_table','test_grantor',CURRENT_TIMESTAMP,'Select','Select');
flush privileges;
@@ -801,13 +820,18 @@ delete from mysql.db where user='mysqltest1';
delete from mysql.tables_priv where user='mysqltest1';
flush privileges;
drop database mysqltest;
+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;
rename table t1 to t2;
ERROR 42000: DROP command denied to user 'user27515'@'localhost' for table 't1'
+disconnect conn27515;
+connection master;
revoke all privileges, grant option from user27515@localhost;
drop user user27515@localhost;
drop database db27515;
@@ -849,8 +873,11 @@ select * from information_schema.schema_privileges
where grantee like "'mysqltest_8'%";
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'mysqltest_8'@'%' def mysqltest SELECT NO
+connect conn3,localhost,mysqltest_8,,;
select * from t1;
a
+disconnect conn3;
+connection master;
revoke select on mysqltest.* from mysqltest_8@'';
show grants for mysqltest_8@'';
Grants for mysqltest_8@%
@@ -899,8 +926,11 @@ GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%'
select * from information_schema.column_privileges;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
'mysqltest_8'@'%' def test t1 a UPDATE NO
+connect conn4,localhost,mysqltest_8,,;
select * from t1;
a
+disconnect conn4;
+connection master;
revoke update (a) on t1 from mysqltest_8@'';
show grants for mysqltest_8@'';
Grants for mysqltest_8@%
@@ -940,8 +970,11 @@ GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%'
select * from information_schema.table_privileges;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
'mysqltest_8'@'%' def test t1 UPDATE NO
+connect conn5,localhost,mysqltest_8,,;
select * from t1;
a
+disconnect conn5;
+connection master;
revoke update on t1 from mysqltest_8@'';
show grants for mysqltest_8@'';
Grants for mysqltest_8@%
@@ -979,8 +1012,11 @@ where grantee like "'mysqltest_8'%";
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
'mysqltest_8'@'host8' def USAGE NO
'mysqltest_8'@'%' def USAGE NO
+connect conn5,localhost,mysqltest_8,,;
select * from t1;
a
+disconnect conn5;
+connection master;
flush privileges;
show grants for mysqltest_8@'';
Grants for mysqltest_8@%
@@ -996,7 +1032,9 @@ drop user mysqltest_8@'';
show grants for mysqltest_8@'';
ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host '%'
connect(localhost,mysqltest_8,,test,MASTER_PORT,MASTER_SOCKET);
+connect conn6,localhost,mysqltest_8,,;
ERROR 28000: Access denied for user 'mysqltest_8'@'localhost' (using password: NO)
+connection master;
show grants for mysqltest_8;
ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host '%'
drop user mysqltest_8@host8;
@@ -1006,6 +1044,7 @@ insert into mysql.user select * from t2;
flush privileges;
drop table t2;
drop table t1;
+connection master;
CREATE DATABASE mysqltest3;
USE mysqltest3;
CREATE TABLE t_nn (c1 INT);
@@ -1022,6 +1061,7 @@ GRANT SHOW VIEW ON mysqltest2.v_ny TO 'mysqltest_1'@'localhost' IDENTIFIE
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,;
SHOW CREATE VIEW mysqltest2.v_nn;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_nn'
SHOW CREATE TABLE mysqltest2.v_nn;
@@ -1053,10 +1093,11 @@ SHOW CREATE VIEW mysqltest2.t_nn;
ERROR HY000: 'mysqltest2.t_nn' is not VIEW
SHOW CREATE VIEW mysqltest2.v_yy;
View Create View character_set_client collation_connection
-v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55) latin1 latin1_swedish_ci
+v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where `mysqltest2`.`t_nn`.`c1` = 55 latin1 latin1_swedish_ci
SHOW CREATE TABLE mysqltest2.v_yy;
View Create View character_set_client collation_connection
-v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55) latin1 latin1_swedish_ci
+v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where `mysqltest2`.`t_nn`.`c1` = 55 latin1 latin1_swedish_ci
+connection master;
SHOW CREATE TABLE mysqltest2.v_nn;
View Create View character_set_client collation_connection
v_nn CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_nn` AS select `t_nn`.`c1` AS `c1` from `t_nn` latin1 latin1_swedish_ci
@@ -1079,9 +1120,12 @@ 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';
USE test;
+connection default;
+disconnect master;
create user longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789;
ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345678' is too long for user name (should be no longer than 80)
CREATE DATABASE mysqltest1;
@@ -1095,6 +1139,7 @@ CREATE TABLE mysqltest1.t2 (int_field INT);
"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();
USER()
mysqltest_1@localhost
@@ -1106,12 +1151,18 @@ RENAME TABLE t1 TO t2;
ERROR 42000: DROP, ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1'
ALTER TABLE t1 RENAME TO t2;
ERROR 42000: DROP, ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1'
+disconnect conn42;
+connection default;
GRANT DROP ON mysqltest1.t1 TO mysqltest_1@localhost;
+connect conn42,localhost,mysqltest_1,,mysqltest1;
RENAME TABLE t1 TO t2;
ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1'
ALTER TABLE t1 RENAME TO t2;
ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1'
+disconnect conn42;
+connection default;
GRANT ALTER ON mysqltest1.t1 TO mysqltest_1@localhost;
+connect conn42,localhost,mysqltest_1,,mysqltest1;
SHOW GRANTS;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
@@ -1120,13 +1171,19 @@ RENAME TABLE t1 TO t2;
ERROR 42000: INSERT, CREATE command denied to user 'mysqltest_1'@'localhost' for table 't2'
ALTER TABLE t1 RENAME TO t2;
ERROR 42000: INSERT, CREATE command denied to user 'mysqltest_1'@'localhost' for table 't2'
+disconnect conn42;
+connection default;
GRANT INSERT, CREATE ON mysqltest1.t1 TO mysqltest_1@localhost;
+connect conn42,localhost,mysqltest_1,,mysqltest1;
SHOW GRANTS;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost'
+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;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
@@ -1136,8 +1193,11 @@ 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;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
@@ -1147,6 +1207,8 @@ RENAME TABLE t1 TO t2;
ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1'
ALTER TABLE t1 RENAME TO t2;
ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1'
+disconnect conn42;
+connection default;
DROP USER mysqltest_1@localhost;
DROP DATABASE mysqltest1;
USE test;
@@ -1177,25 +1239,37 @@ ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghi
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;
TRUNCATE t1;
ERROR 42000: DROP command denied to user 'bug23556'@'localhost' for table '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;
+connect con1, localhost, root,,*NO-ONE*;
+connection con1;
GRANT PROCESS ON * TO user@localhost;
ERROR 3D000: No database selected
+disconnect con1;
+connection default;
DROP DATABASE IF EXISTS mysqltest1;
DROP DATABASE IF EXISTS mysqltest2;
DROP DATABASE IF EXISTS mysqltest3;
@@ -1217,8 +1291,7 @@ GRANT EXECUTE ON PROCEDURE mysqltest2.p_inv TO mysqltest_1@localhost;
GRANT EXECUTE ON FUNCTION mysqltest3.f_def TO mysqltest_1@localhost;
GRANT EXECUTE ON FUNCTION mysqltest4.f_inv TO mysqltest_1@localhost;
GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost;
-
----> connection: bug9504_con1
+connect bug9504_con1,localhost,mysqltest_1,,;
use mysqltest1;
use mysqltest2;
use mysqltest3;
@@ -1236,8 +1309,8 @@ mysqltest3.f_def()
SELECT mysqltest4.f_inv();
mysqltest4.f_inv()
1
-
----> connection: default
+connection default;
+disconnect bug9504_con1;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
DROP DATABASE mysqltest3;
@@ -1251,8 +1324,7 @@ GRANT ALL PRIVILEGES ON mysqltest1.* TO mysqltest_1@localhost;
GRANT SELECT ON mysqltest2.* TO mysqltest_1@localhost;
CREATE PROCEDURE mysqltest1.p1() SQL SECURITY INVOKER
SELECT 1;
-
----> connection: bug27337_con1
+connect bug27337_con1,localhost,mysqltest_1,,mysqltest2;
CREATE TABLE t1(c INT);
ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table 't1'
CALL mysqltest1.p1();
@@ -1260,14 +1332,14 @@ CALL mysqltest1.p1();
1
CREATE TABLE t1(c INT);
ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table 't1'
-
----> connection: bug27337_con2
+disconnect bug27337_con1;
+connect bug27337_con2,localhost,mysqltest_1,,mysqltest2;
CREATE TABLE t1(c INT);
ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table 't1'
SHOW TABLES;
Tables_in_mysqltest2
-
----> connection: default
+connection default;
+disconnect bug27337_con2;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
DROP USER mysqltest_1@localhost;
@@ -1279,8 +1351,7 @@ CREATE TABLE mysqltest1.t1(c INT);
CREATE TABLE mysqltest2.t2(c INT);
GRANT SELECT ON mysqltest1.t1 TO mysqltest_1@localhost;
GRANT SELECT ON mysqltest2.t2 TO mysqltest_2@localhost;
-
----> connection: bug27337_con1
+connect bug27337_con1,localhost,mysqltest_1,,mysqltest1;
SHOW TABLES FROM mysqltest1;
Tables_in_mysqltest1
t1
@@ -1288,8 +1359,7 @@ PREPARE stmt1 FROM 'SHOW TABLES FROM mysqltest1';
EXECUTE stmt1;
Tables_in_mysqltest1
t1
-
----> connection: bug27337_con2
+connect bug27337_con2,localhost,mysqltest_2,,mysqltest2;
SHOW COLUMNS FROM mysqltest2.t2;
Field Type Null Key Default Extra
c int(11) YES NULL
@@ -1297,24 +1367,22 @@ PREPARE stmt2 FROM 'SHOW COLUMNS FROM mysqltest2.t2';
EXECUTE stmt2;
Field Type Null Key Default Extra
c int(11) YES NULL
-
----> connection: default
+connection default;
REVOKE SELECT ON mysqltest1.t1 FROM mysqltest_1@localhost;
REVOKE SELECT ON mysqltest2.t2 FROM mysqltest_2@localhost;
-
----> connection: bug27337_con1
+connection bug27337_con1;
SHOW TABLES FROM mysqltest1;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest1'
EXECUTE stmt1;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest1'
-
----> connection: bug27337_con2
+connection bug27337_con2;
SHOW COLUMNS FROM mysqltest2.t2;
ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't2'
EXECUTE stmt2;
ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't2'
-
----> connection: default
+connection default;
+disconnect bug27337_con1;
+disconnect bug27337_con2;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
DROP USER mysqltest_1@localhost;
@@ -1328,6 +1396,8 @@ 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;
UPDATE v1 SET f2 = 4;
ERROR HY000: View 'db27878.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
@@ -1335,6 +1405,8 @@ SELECT * FROM test.t1;
f1 f2
1 1
2 2
+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';
@@ -1394,8 +1466,7 @@ 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;
-
-# Connection: bug57952_con1 (testuser@localhost, db: mysqltest1)
+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';
@@ -1411,14 +1482,12 @@ a
CALL p3;
Tables_in_mysqltest2
t3
-
-# Connection: default
+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 (testuser@localhost, db: mysqltest1)
+connection bug57952_con1;
# - Check column-level privileges...
EXECUTE s1;
ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for column 'b' in table 't1'
@@ -1442,8 +1511,8 @@ EXECUTE s3;
ERROR 42000: Access denied for user 'testuser'@'localhost' to database 'mysqltest2'
CALL p3;
ERROR 42000: Access denied for user 'testuser'@'localhost' to database 'mysqltest2'
-
-# Connection: default
+connection default;
+disconnect bug57952_con1;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
DROP USER testuser@localhost;
@@ -1474,28 +1543,26 @@ select db, routine_name, routine_type, proc_priv from mysql.procs_priv where use
db routine_name routine_type proc_priv
mysqltest1 f1 FUNCTION Execute
mysqltest1 p1 PROCEDURE Execute
-#
-# Create connection 'bug_36544_con1' as 'mysqluser1@localhost'.
+connect bug36544_con1,localhost,mysqluser1,,;
call mysqltest1.p1();
select mysqltest1.f1();
mysqltest1.f1()
0
-#
-# Switch to connection 'default'.
+connection default;
drop user mysqluser1@localhost;
#
# Test that dropping of user is properly reflected in
# both privilege tables and in in-memory structures.
#
-# Switch to connection 'bug36544_con1'.
+connection bug36544_con1;
# The connection cold be alive but should not be able to
# access to any of the stored routines.
call mysqltest1.p1();
ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.p1'
select mysqltest1.f1();
ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.f1'
-#
-# Switch to connection 'default'.
+disconnect bug36544_con1;
+connection default;
#
# Now create user with the same name and check that he
# has not inherited privileges.
@@ -1505,15 +1572,13 @@ Grants for mysqluser1@localhost
GRANT USAGE ON *.* TO 'mysqluser1'@'localhost'
select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost';
db routine_name routine_type proc_priv
-#
-# Create connection 'bug_36544_con2' as 'mysqluser1@localhost'.
+connect bug36544_con2,localhost,mysqluser1,,;
# Newly created user should not be able to access any of the routines.
call mysqltest1.p1();
ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.p1'
select mysqltest1.f1();
ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.f1'
-#
-# Switch to connection 'default'.
+connection default;
#
# 2) Check that RENAME USER properly updates privileges on both
# stored procedures and functions.
@@ -1551,8 +1616,7 @@ select db, table_name, table_priv from mysql.tables_priv where user='mysqluser1'
db table_name table_priv
mysqltest1 t11 Select
mysqltest1 t22 Select
-#
-# Switch to connection 'bug36544_con2'.
+connection bug36544_con2;
call mysqltest1.p1();
select mysqltest1.f1();
mysqltest1.f1()
@@ -1561,13 +1625,12 @@ select * from mysqltest1.t11;
i
select * from mysqltest1.t22;
i
-#
-# Switch to connection 'default'.
+connection default;
rename user mysqluser1@localhost to mysqluser10@localhost;
#
# Test that there are no privileges left for mysqluser1.
#
-# Switch to connection 'bug36544_con2'.
+connection bug36544_con2;
# The connection cold be alive but should not be able to
# access to any of the stored routines or tables.
call mysqltest1.p1();
@@ -1578,8 +1641,8 @@ select * from mysqltest1.t11;
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't11'
select * from mysqltest1.t22;
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't22'
-#
-# Switch to connection 'default'.
+disconnect bug36544_con2;
+connection default;
#
# Now create user with the old name and check that he
# has not inherited privileges.
@@ -1591,8 +1654,7 @@ select db, routine_name, routine_type, proc_priv from mysql.procs_priv where use
db routine_name routine_type proc_priv
select db, table_name, table_priv from mysql.tables_priv where user='mysqluser1' and host='localhost';
db table_name table_priv
-#
-# Create connection 'bug_36544_con3' as 'mysqluser1@localhost'.
+connect bug36544_con3,localhost,mysqluser1,,;
# Newly created user should not be able to access to any of the
# stored routines or tables.
call mysqltest1.p1();
@@ -1603,8 +1665,8 @@ select * from mysqltest1.t11;
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't11'
select * from mysqltest1.t22;
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't22'
-#
-# Switch to connection 'default'.
+disconnect bug36544_con3;
+connection default;
#
# Now check that privileges became associated with a new user
# name - mysqluser10.
@@ -1624,8 +1686,7 @@ select db, table_name, table_priv from mysql.tables_priv where user='mysqluser10
db table_name table_priv
mysqltest1 t11 Select
mysqltest1 t22 Select
-#
-# Create connection 'bug_36544_con4' as 'mysqluser10@localhost'.
+connect bug36544_con4,localhost,mysqluser10,,;
call mysqltest1.p1();
select mysqltest1.f1();
mysqltest1.f1()
@@ -1634,8 +1695,8 @@ select * from mysqltest1.t11;
i
select * from mysqltest1.t22;
i
-#
-# Switch to connection 'default'.
+disconnect bug36544_con4;
+connection default;
#
# Clean-up.
drop user mysqluser1@localhost;
@@ -1656,15 +1717,19 @@ create database mysqltest;
use mysqltest;
grant create on mysqltest.* to mysqltest@localhost;
create table t1 (i INT);
+connect user1,localhost,mysqltest,,mysqltest;
+connection user1;
insert into t1 values (1);
ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1'
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;
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 table if not exists t1 select * from t2;
ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1'
@@ -1681,6 +1746,7 @@ create table t4 select * from t2;
ERROR 42S01: Table 't4' already exists
create table t1 select * from t2;
ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1'
+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;
@@ -1688,6 +1754,7 @@ 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;
FLUSH PRIVILEGES without procs_priv table.
@@ -1711,6 +1778,7 @@ FLUSH PRIVILEGES;
CREATE DATABASE dbbug33464;
CREATE USER 'userbug33464'@'localhost';
GRANT CREATE ROUTINE ON dbbug33464.* TO 'userbug33464'@'localhost';
+connect connbug33464, localhost, userbug33464, , dbbug33464;
userbug33464@localhost dbbug33464
CREATE PROCEDURE sp3(v1 char(20))
@@ -1725,6 +1793,8 @@ CREATE FUNCTION fn2() returns char(50) SQL SECURITY DEFINER
BEGIN
return 2;
END//
+disconnect connbug33464;
+connection default;
USE dbbug33464;
root@localhost dbbug33464
@@ -1753,6 +1823,7 @@ SHOW GRANTS FOR 'user1'@'localhost';
Grants for user1@localhost
GRANT USAGE ON *.* TO 'user1'@'localhost'
GRANT CREATE, CREATE ROUTINE ON `db1`.* TO 'user1'@'localhost'
+connect con1,localhost,user1,,;
** Connect as user1 and create a procedure.
** The creation will imply implicitly assigned
** EXECUTE and ALTER ROUTINE privileges to
@@ -1769,6 +1840,7 @@ BEGIN
SET @x = 0;
REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;
END ;||
+connect con2,localhost,user2,,;
** Connect as user2 and create a procedure.
** Implicitly assignment of privileges will
** fail because the user2@localhost is an
@@ -1780,6 +1852,7 @@ REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;
END ;||
Warnings:
Warning 1404 Failed to grant EXECUTE and ALTER ROUTINE privileges
+connection default;
SHOW GRANTS FOR 'user1'@'localhost';
Grants for user1@localhost
GRANT USAGE ON *.* TO 'user1'@'localhost'
@@ -1789,6 +1862,8 @@ SHOW GRANTS FOR 'user2';
Grants for user2@%
GRANT USAGE ON *.* TO 'user2'@'%'
GRANT CREATE, CREATE ROUTINE ON `db1`.* TO 'user2'@'%'
+disconnect con1;
+disconnect con2;
DROP PROCEDURE db1.proc1;
DROP PROCEDURE db1.proc2;
REVOKE ALL ON db1.* FROM 'user1'@'localhost';
@@ -1801,6 +1876,7 @@ DROP DATABASE db1;
# Bug #25863 No database selected error, but documentation
# says * for global allowed
#
+connect conn1,localhost,root,,*NO-ONE*;
GRANT ALL ON * TO mysqltest_1;
ERROR 3D000: No database selected
GRANT ALL ON *.* TO mysqltest_1;
@@ -1820,18 +1896,23 @@ SHOW GRANTS FOR mysqltest_1;
Grants for mysqltest_1@%
GRANT ALL PRIVILEGES ON *.* TO 'mysqltest_1'@'%'
DROP USER mysqltest_1;
+connection default;
+disconnect conn1;
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;
SELECT * FROM `../db2/tb2`;
ERROR 42S02: Table 'db1.../db2/tb2' doesn't exist
SELECT * FROM `../db2`.tb2;
ERROR 42000: SELECT command denied to user 'testbug'@'localhost' for table 'tb2'
SELECT * FROM `#mysql50#/../db2/tb2`;
ERROR 42000: Incorrect table name '#mysql50#/../db2/tb2'
+connection default;
+disconnect con1;
DROP USER 'testbug'@localhost;
DROP TABLE db2.t1;
DROP DATABASE db1;
@@ -1888,13 +1969,13 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT RELOAD, SHUTDOWN, PROCESS, FILE, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT, CREATE USER ON *.* TO 'mysqltest_u1'@'localhost'
GRANT CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE ROUTINE, ALTER ROUTINE, EVENT ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
ERROR 42000: SHOW command denied to user 'mysqltest_u1'@'localhost' for table 't1'
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -1911,16 +1992,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT SELECT ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -1937,16 +2018,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT INSERT ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -1963,16 +2044,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT UPDATE ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -1989,16 +2070,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT DELETE ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2015,16 +2096,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT CREATE ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2041,16 +2122,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT DROP ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2067,16 +2148,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT ALTER ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2093,16 +2174,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT INDEX ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2119,16 +2200,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT REFERENCES ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2145,16 +2226,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT USAGE ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost' WITH GRANT OPTION
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2171,16 +2252,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT CREATE VIEW ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2197,16 +2278,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT SHOW VIEW ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2223,16 +2304,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT SELECT ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2249,16 +2330,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT INSERT ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2275,16 +2356,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT UPDATE ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2301,16 +2382,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT DELETE ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2327,16 +2408,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT CREATE ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2353,16 +2434,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT DROP ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2379,16 +2460,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT ALTER ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2405,16 +2486,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT INDEX ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2431,16 +2512,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT REFERENCES ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2457,16 +2538,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT USAGE ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost' WITH GRANT OPTION
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2483,16 +2564,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT CREATE VIEW ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2509,16 +2590,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT SHOW VIEW ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost'
-
-# connection: con1 (mysqltest_u1@mysqltest_db1)
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
+connection con1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-
-# connection: default
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
@@ -2563,6 +2644,7 @@ drop user mysqltest_u1;
CREATE USER foo@'127.0.0.1';
GRANT ALL ON *.* TO foo@'127.0.0.1';
# First attempt, should connect successfully
+connect conn1, '127.0.0.1', foo,,test;
SELECT user(), current_user();
user() current_user()
foo@localhost foo@127.0.0.1
@@ -2570,16 +2652,22 @@ foo@localhost foo@127.0.0.1
RENAME USER foo@'127.0.0.1' to foo@'127.0.0.0/255.0.0.0';
# Second attempt, should connect successfully as its valid mask
# This was failing without fix
+connect conn2, '127.0.0.1', foo,,test;
SELECT user(), current_user();
user() current_user()
foo@localhost foo@127.0.0.0/255.0.0.0
# Rename the user back to original
RENAME USER foo@'127.0.0.0/255.0.0.0' to foo@'127.0.0.1';
# Third attempt, should connect successfully
+connect conn3, '127.0.0.1', foo,,test;
SELECT user(), current_user();
user() current_user()
foo@localhost foo@127.0.0.1
# Clean-up
+connection default;
+disconnect conn1;
+disconnect conn2;
+disconnect conn3;
DROP USER foo@'127.0.0.1';
# End of Bug#12766319
#
@@ -2590,7 +2678,7 @@ DROP DATABASE IF EXISTS secret;
DROP DATABASE IF EXISTS no_such_db;
CREATE DATABASE secret;
GRANT USAGE ON *.* TO untrusted@localhost;
-# Connection con1
+connect con1, localhost, untrusted;
SHOW GRANTS;
Grants for untrusted@localhost
GRANT USAGE ON *.* TO 'untrusted'@'localhost'
@@ -2605,7 +2693,38 @@ CREATE PROCEDURE no_such_db.foo() BEGIN END;
ERROR 42000: Access denied for user 'untrusted'@'localhost' to database 'no_such_db'
CREATE PROCEDURE secret.peek_at_secret() BEGIN END;
ERROR 42000: Access denied for user 'untrusted'@'localhost' to database 'secret'
-# Connection default
+connection default;
+disconnect con1;
DROP USER untrusted@localhost;
DROP DATABASE secret;
set GLOBAL sql_mode=default;
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-10134 Add full support for DEFAULT
+#
+CREATE TABLE t1 (a VARCHAR(30) DEFAULT USER());
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(30) DEFAULT user()
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+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;
+a
+root@localhost
+dummy@localhost
+root@localhost
+DROP TABLE t1;
+DROP USER dummy@localhost;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index cf58a2dc6f5..2ccc01d225a 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -11,15 +11,27 @@ 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;
grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass';
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql'
+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\_%';
@@ -27,6 +39,8 @@ delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
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();
current_user()
mysqltest_1@localhost
@@ -41,6 +55,8 @@ grant select on `my\_1`.* to mysqltest_4@localhost with grant option;
ERROR 28000: Can't find any matching row in the user table
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;
Grants for mysqltest_1@localhost
GRANT CREATE USER ON *.* TO 'mysqltest_1'@'localhost'
@@ -56,6 +72,8 @@ delete from mysql.db where user like 'mysqltest\_%';
flush privileges;
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();
current_user()
mysqltest_1@localhost
@@ -66,6 +84,8 @@ mysqltest_1
test
grant all privileges on `mysqltest_1`.* to mysqltest_1@localhost with grant option;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest_1'
+disconnect user2;
+connection default;
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
@@ -79,6 +99,8 @@ 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();
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
@@ -91,16 +113,22 @@ ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table '
select * from t1;
id data
1 I can't change it!
+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;
grant select (a,b) on t1 to mysqltest_2@localhost;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't1'
grant select on t1 to mysqltest_3@localhost;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
+disconnect mrugly;
+connection default;
drop table t1;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
@@ -118,14 +146,24 @@ create user mysqltest_6@host6;
create user mysqltest_7@host7;
flush privileges;
drop user mysqltest_3@host3;
+connect con8,127.0.0.1,root,,test,$MASTER_MYPORT,;
+disconnect con8;
+connection default;
drop user mysqltest_1@host1, mysqltest_2@host2, mysqltest_4@host4,
mysqltest_5@host5, mysqltest_6@host6, mysqltest_7@host7;
+connect con9,127.0.0.1,root,,test,$MASTER_MYPORT,;
+disconnect con9;
+connection default;
create database mysqltest_1;
grant select, insert, update on `mysqltest\_1`.* to mysqltest_1@localhost;
+connect con10,localhost,mysqltest_1,,;
+connection con10;
set sql_log_off = 1;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
set sql_log_bin = 0;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
+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;
@@ -270,14 +308,20 @@ GRANT SELECT ON "mysql".* TO '%@a'@'a'
drop user '%@a'@'a';
create user mysqltest_2@localhost;
grant create user on *.* to mysqltest_2@localhost;
+connect user3,localhost,mysqltest_2,,;
+connection user3;
select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password;
ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 'user'
create user mysqltest_A@'%';
rename user mysqltest_A@'%' to mysqltest_B@'%';
drop user mysqltest_B@'%';
+disconnect user3;
+connection default;
drop user mysqltest_2@localhost;
create user mysqltest_3@localhost;
grant INSERT,DELETE,UPDATE on mysql.* to mysqltest_3@localhost;
+connect user4,localhost,mysqltest_3,,;
+connection user4;
show grants;
Grants for mysqltest_3@localhost
GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
@@ -294,12 +338,16 @@ 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;
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();
Grants for mysqltest_1@127.0.0.0/255.0.0.0
GRANT USAGE ON *.* TO 'mysqltest_1'@'127.0.0.0/255.0.0.0'
@@ -309,15 +357,21 @@ i
1
2
3
+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;
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();
current_user()
mysqltest_1@127.0.0.1
set password = password('changed');
+disconnect b12302;
+connection default;
select host, length(password) from mysql.user where user like 'mysqltest\_1';
host length(password)
127.0.0.1 41
@@ -325,10 +379,14 @@ 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();
current_user()
mysqltest_1@127.0.0.0/255.0.0.0
set password = password('changed');
+disconnect b12302_2;
+connection default;
select host, length(password) from mysql.user where user like 'mysqltest\_1';
host length(password)
127.0.0.0/255.0.0.0 41
@@ -336,17 +394,38 @@ 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;
+connect n5,localhost,test,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection n5;
set password = password("changed");
ERROR 42000: You are using MariaDB as an anonymous user and anonymous users are not allowed to modify user settings
+disconnect n5;
+connection default;
+connect con2root,localhost,root,,;
+connect con3root,localhost,root,,;
+connection default;
lock table mysql.user write;
+connection con2root;
flush privileges;
+connection con3root;
grant all on *.* to 'mysqltest_1'@'localhost';
+connection default;
unlock tables;
+connection con2root;
+connection con3root;
+connection default;
lock table mysql.user write;
+connection con2root;
set password for 'mysqltest_1'@'localhost' = password('');
+connection con3root;
revoke all on *.* from 'mysqltest_1'@'localhost';
+connection default;
unlock tables;
+connection con2root;
+connection con3root;
+connection default;
drop user 'mysqltest_1'@'localhost';
+disconnect con2root;
+disconnect con3root;
create database TESTDB;
create table t2(a int);
create temporary table t1 as select * from mysql.user;
@@ -361,8 +440,11 @@ Warning 1364 Field 'authentication_string' doesn't have a default value
INSERT INTO mysql.db (host, db, user, select_priv) VALUES
('%','TESTDB','mysqltest_1','Y');
FLUSH PRIVILEGES;
+connect con1,localhost,mysqltest_1,password,TESTDB;
create database TEStdb;
Got one of the listed errors
+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;
@@ -373,6 +455,8 @@ SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creato
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);
DROP FUNCTION IF EXISTS f2;
@@ -383,6 +467,8 @@ f2()
1
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;
@@ -394,35 +480,48 @@ create database mysqltest_2;
grant all on mysqltest_1.* to mysqltest_u1@localhost;
use mysqltest_2;
create table t1 (i int);
+connect user1,localhost,mysqltest_u1,,mysqltest_1;
+connection user1;
show create table mysqltest_2.t1;
ERROR 42000: SHOW command denied to user 'mysqltest_u1'@'localhost' for table 't1'
create table t1 like mysqltest_2.t1;
ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1'
+connection default;
grant select on mysqltest_2.t1 to mysqltest_u1@localhost;
+connection user1;
show create table mysqltest_2.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t1 like mysqltest_2.t1;
+connection default;
+disconnect user1;
use test;
drop database mysqltest_1;
drop database mysqltest_2;
drop user mysqltest_u1@localhost;
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;
create database mysqltest_3;
ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest_3'
use mysqltest_1;
create table t2(f1 int);
select * from t1;
f1
+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;
@@ -435,6 +534,8 @@ 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;
SELECT c FROM t2;
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
@@ -442,6 +543,8 @@ SELECT * FROM t2;
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for table 't2'
SELECT * FROM t1 JOIN t2 USING (b);
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
+connection default;
+disconnect conn1;
USE test;
DROP TABLE db1.t1, db1.t2;
DROP USER mysqltest1@localhost;
@@ -530,8 +633,7 @@ CREATE TABLE mysqltest_db2.t2_1(a INT);
# SQL-statement against temporary tables (loosely follow order in
# sql_command enum).
###########################################################################
-
-# -- connect con1, mysqltest_u1@localhost, mysqltest_db1
+connect con1,localhost,mysqltest_u1,,mysqltest_db1;
#
# Variants of CREATE TABLE.
#
@@ -770,8 +872,7 @@ DROP TEMPORARY TABLE t1;
# - Check that even outside of SUID context we can access temporary
# table once it is created.
###########################################################################
-
-# -- connect con2, mysqltest_u2@localhost, mysqltest_db1
+connect con2,localhost,mysqltest_u2,,mysqltest_db1;
CREATE TEMPORARY TABLE t2(a INT);
ERROR 42000: Access denied for user 'mysqltest_u2'@'localhost' to database 'mysqltest_db1'
CALL p1();
@@ -796,8 +897,7 @@ DROP TEMPORARY TABLE t4;
# - Check that once table is created it can be accessed from within any
# context, even by user without any privileges on tables.
###########################################################################
-
-# -- connect con3, mysqltest_u4@localhost, mysqltest_db1
+connect con3,localhost,mysqltest_u4,,mysqltest_db1;
CALL p1();
INSERT INTO t4 VALUES (4);
UPDATE t4 SET x = 10 WHERE x = 1;
@@ -812,8 +912,7 @@ DROP TEMPORARY TABLE t4;
# - SELECT_ACL, UPDATE_ACL and DELETE_ACL are required to include
# a temporary table into the underlying-table-list.
###########################################################################
-
-# -- connect con4, mysqltest_u5@localhost, mysqltest_db1
+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);
@@ -832,13 +931,12 @@ DROP TEMPORARY TABLE t9;
###########################################################################
# That's all. Cleanup.
###########################################################################
-
-# -- connection: default
-# -- disconnect con1
+connection default;
# All remaining temporary tables are automatically dropped.
-# -- disconnect con2
-# -- disconnect con3
-# -- disconnect con4
+disconnect con1;
+disconnect con2;
+disconnect con3;
+disconnect con4;
SET GLOBAL keycache1.key_buffer_size = 0;
DROP DATABASE mysqltest_db1;
DROP DATABASE mysqltest_db2;
diff --git a/mysql-test/r/grant3.result b/mysql-test/r/grant3.result
index d1722fc8ea9..4c99fb02f19 100644
--- a/mysql-test/r/grant3.result
+++ b/mysql-test/r/grant3.result
@@ -1,6 +1,8 @@
set global sql_mode="";
set local sql_mode="";
SET NAMES binary;
+connect master,localhost,root,,;
+connection master;
drop table if exists t1;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
@@ -10,9 +12,14 @@ 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;
grant select on `my\_1`.* to mysqltest_2@localhost;
ERROR 42000: You are not allowed to create a user with GRANT
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\_%';
@@ -132,6 +139,8 @@ 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;
Grants for mysqltest1@%
GRANT USAGE ON *.* TO 'mysqltest1'@'%'
@@ -139,6 +148,8 @@ GRANT SELECT, UPDATE ON `mysqltest\_1`.* TO 'mysqltest1'@'%'
GRANT UPDATE ON `mysqltest_1`.* TO 'mysqltest1'@'%'
SELECT * FROM mysqltest_1.t1;
a
+disconnect conn1;
+connection default;
DROP USER 'mysqltest1'@'%';
DROP DATABASE mysqltest_1;
#
@@ -163,6 +174,8 @@ Grants for user2@%
GRANT USAGE ON *.* TO 'user2'@'%'
GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%'
# Connect as the renamed user
+connect conn1, localhost, user2,,;
+connection conn1;
SHOW GRANTS;
Grants for user2@%
GRANT USAGE ON *.* TO 'user2'@'%'
@@ -177,6 +190,8 @@ a
# access this column.
SELECT b FROM temp.t1;
ERROR 42000: SELECT command denied to user 'user2'@'localhost' for column 'b' in table 't1'
+disconnect conn1;
+connection default;
DROP USER 'user2'@'%';
DROP DATABASE temp;
set global sql_mode=default;
diff --git a/mysql-test/r/grant4.result b/mysql-test/r/grant4.result
index 5a0032cd338..c3db2e03e3e 100644
--- a/mysql-test/r/grant4.result
+++ b/mysql-test/r/grant4.result
@@ -11,6 +11,8 @@ 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;
** Connect as restricted user mysqltest_u1.
+connect con1,localhost,mysqltest_u1,,;
+connection con1;
** Test column level privileges only. No SELECT privileges on the table.
** INSERT INTO ... VALUES ...
** Attempting to insert values to a table with only column privileges
@@ -72,6 +74,7 @@ t_select_priv CREATE TABLE `t_select_priv` (
show create table mysqltest_db1.t_no_priv;
ERROR 42000: SHOW command denied to user 'mysqltest_u1'@'localhost' for table 't_no_priv'
+connection default;
use mysqltest_db1;
CREATE TABLE t5 (s1 INT);
CREATE INDEX i ON t5 (s1);
@@ -85,6 +88,7 @@ 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;
** Connect as restricted user mysqltest_u1.
** SELECT FROM INFORMATION_SCHEMA.STATISTICS will succeed because any privileges will do (authentication is enough).
@@ -121,6 +125,8 @@ ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table
SHOW CREATE VIEW v3;
View Create View character_set_client collation_connection
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t_select_priv`.`a` AS `a`,`t_select_priv`.`b` AS `b` from `t_select_priv` latin1 latin1_swedish_ci
+connection default;
+disconnect con1;
drop database mysqltest_db1;
drop user mysqltest_u1@localhost;
#
@@ -147,11 +153,13 @@ insert into mysqltest_db1.t2 values (1);
# 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;
# Corrupt t1 by replacing t1.MYI with a corrupt + unclosed one created
# by doing: 'create table t1 (a int key(a))'
# head -c1024 t1.MYI > corrupt_t1.MYI
flush table mysqltest_db1.t1;
-# Switching to connection 'con1'.
+connection con1;
check table mysqltest_db1.t1;
Table Op Msg_type Msg_text
mysqltest_db1.t1 check warning 1 client is using or hasn't closed the table properly
@@ -177,7 +185,8 @@ Table Op Msg_type Msg_text
mysqltest_db1.t1 repair warning Number of rows changed from 1 to 2
mysqltest_db1.t1 repair status OK
# Clean-up.
-# Switching to connection 'default'.
+disconnect con1;
+connection default;
drop database mysqltest_db1;
drop user mysqltest_u1@localhost;
create user foo1 identified by password '11111111111111111111111111111111111111111';
diff --git a/mysql-test/r/grant5.result b/mysql-test/r/grant5.result
index d7f3b6812bb..24abc61a348 100644
--- a/mysql-test/r/grant5.result
+++ b/mysql-test/r/grant5.result
@@ -4,6 +4,7 @@ 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;
Grants for test@%
@@ -14,5 +15,6 @@ Grants for foo
GRANT USAGE ON *.* TO 'foo'
show grants for foo@'%';
ERROR 42000: Access denied for user 'test'@'%' to database 'mysql'
+connection default;
drop user test, foo;
drop role foo;
diff --git a/mysql-test/r/grant_4332.result b/mysql-test/r/grant_4332.result
index 93c0a24d164..b62ca1a20cc 100644
--- a/mysql-test/r/grant_4332.result
+++ b/mysql-test/r/grant_4332.result
@@ -10,7 +10,7 @@ alter table mysql.event modify definer char(77) collate utf8_bin not null defaul
flush privileges;
select user();
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def user() 253 77 14 N 1 31 8
+def user() 253 77 14 N 1 39 8
user()
root@localhost
create user a17aaaaaaaaaaaaa0@localhost;
@@ -29,7 +29,7 @@ alter table mysql.event modify definer char(141) collate utf8_bin not null defau
flush privileges;
select user();
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def user() 253 141 14 N 1 31 8
+def user() 253 141 14 N 1 39 8
user()
root@localhost
set GLOBAL sql_mode=default;
diff --git a/mysql-test/r/grant_cache_no_prot.result b/mysql-test/r/grant_cache_no_prot.result
index 34abd96f026..f1adb3ae839 100644
--- a/mysql-test/r/grant_cache_no_prot.result
+++ b/mysql-test/r/grant_cache_no_prot.result
@@ -7,7 +7,8 @@ set LOCAL query_cache_type=ON;
set GLOBAL query_cache_size=1355776;
reset query cache;
flush status;
------ establish connection root -----
+connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection root;
show grants for current_user;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
@@ -26,7 +27,8 @@ insert into test.t1 values ("test.t1");
select * from t1;
a
test.t1
------ establish connection root2 -----
+connect root2,localhost,root,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection root2;
select * from t1;
a b c
1 1 1
@@ -56,7 +58,8 @@ grant SELECT on mysqltest.* to mysqltest_1@localhost;
grant SELECT on mysqltest.t1 to mysqltest_2@localhost;
grant SELECT on test.t1 to mysqltest_2@localhost;
grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost;
------ establish connection user1 (user=mysqltest_1) -----
+connect user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection user1;
show grants for current_user();
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
@@ -121,11 +124,13 @@ Qcache_hits 3
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 1
------ establish connection unkuser (user=unkuser) -----
+connect unkuser,localhost,unkuser,,,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection unkuser;
show grants for current_user();
Grants for @localhost
GRANT USAGE ON *.* TO ''@'localhost'
------ establish connection user2 (user=mysqltest_2) -----
+connect user2,localhost,mysqltest_2,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection user2;
select "user2";
user2
user2
@@ -156,7 +161,8 @@ Qcache_hits 7
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 2
------ establish connection user3 (user=mysqltest_3) -----
+connect user3,localhost,mysqltest_3,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection user3;
select "user3";
user3
user3
@@ -181,7 +187,8 @@ Qcache_hits 7
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 4
------ establish connection user4 (user=mysqltest_1) -----
+connect user4,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection user4;
select "user4";
user4
user4
@@ -212,8 +219,21 @@ Qcache_hits 8
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 5
------ close connections -----
------ switch to connection default -----
+connection root;
+disconnect root;
+connection root2;
+disconnect root2;
+connection user1;
+disconnect user1;
+connection user2;
+disconnect user2;
+connection user3;
+disconnect user3;
+connection user4;
+disconnect user4;
+connection unkuser;
+disconnect unkuser;
+connection default;
set names binary;
delete from mysql.user where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
delete from mysql.db where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
diff --git a/mysql-test/r/grant_cache_ps_prot.result b/mysql-test/r/grant_cache_ps_prot.result
index 5fe57c7c35d..56a98cc076d 100644
--- a/mysql-test/r/grant_cache_ps_prot.result
+++ b/mysql-test/r/grant_cache_ps_prot.result
@@ -7,7 +7,8 @@ set LOCAL query_cache_type=ON;
set GLOBAL query_cache_size=1355776;
reset query cache;
flush status;
------ establish connection root -----
+connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection root;
show grants for current_user;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
@@ -26,7 +27,8 @@ insert into test.t1 values ("test.t1");
select * from t1;
a
test.t1
------ establish connection root2 -----
+connect root2,localhost,root,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection root2;
select * from t1;
a b c
1 1 1
@@ -56,7 +58,8 @@ grant SELECT on mysqltest.* to mysqltest_1@localhost;
grant SELECT on mysqltest.t1 to mysqltest_2@localhost;
grant SELECT on test.t1 to mysqltest_2@localhost;
grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost;
------ establish connection user1 (user=mysqltest_1) -----
+connect user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection user1;
show grants for current_user();
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
@@ -121,11 +124,13 @@ Qcache_hits 3
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 1
------ establish connection unkuser (user=unkuser) -----
+connect unkuser,localhost,unkuser,,,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection unkuser;
show grants for current_user();
Grants for @localhost
GRANT USAGE ON *.* TO ''@'localhost'
------ establish connection user2 (user=mysqltest_2) -----
+connect user2,localhost,mysqltest_2,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection user2;
select "user2";
user2
user2
@@ -156,7 +161,8 @@ Qcache_hits 7
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 2
------ establish connection user3 (user=mysqltest_3) -----
+connect user3,localhost,mysqltest_3,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection user3;
select "user3";
user3
user3
@@ -181,7 +187,8 @@ Qcache_hits 7
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 3
------ establish connection user4 (user=mysqltest_1) -----
+connect user4,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection user4;
select "user4";
user4
user4
@@ -212,8 +219,21 @@ Qcache_hits 8
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 4
------ close connections -----
------ switch to connection default -----
+connection root;
+disconnect root;
+connection root2;
+disconnect root2;
+connection user1;
+disconnect user1;
+connection user2;
+disconnect user2;
+connection user3;
+disconnect user3;
+connection user4;
+disconnect user4;
+connection unkuser;
+disconnect unkuser;
+connection default;
set names binary;
delete from mysql.user where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
delete from mysql.db where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
diff --git a/mysql-test/r/grant_explain_non_select.result b/mysql-test/r/grant_explain_non_select.result
index 1dbb5b1e3c0..53b7d687d6c 100644
--- a/mysql-test/r/grant_explain_non_select.result
+++ b/mysql-test/r/grant_explain_non_select.result
@@ -6,6 +6,8 @@ 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;
EXPLAIN INSERT INTO t1 VALUES (10);
ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1'
@@ -15,7 +17,9 @@ EXPLAIN INSERT INTO t1 SELECT * FROM t2;
ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1'
INSERT INTO t1 SELECT * FROM t2;
ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1'
+connection default;
GRANT INSERT ON privtest_db.t1 TO 'privtest'@'localhost';
+connection con1;
EXPLAIN INSERT INTO t1 VALUES (10);
id select_type table type possible_keys key key_len ref rows Extra
1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL
@@ -24,7 +28,9 @@ EXPLAIN INSERT INTO t1 SELECT * FROM t2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
INSERT INTO t1 SELECT * FROM t2;
+connection default;
REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost';
+connection con1;
EXPLAIN REPLACE INTO t1 VALUES (10);
ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1'
REPLACE INTO t1 VALUES (10);
@@ -33,7 +39,9 @@ EXPLAIN REPLACE INTO t1 SELECT * FROM t2;
ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1'
REPLACE INTO t1 SELECT * FROM t2;
ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1'
+connection default;
GRANT INSERT ON privtest_db.t1 TO 'privtest'@'localhost';
+connection con1;
EXPLAIN REPLACE INTO t1 VALUES (10);
ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1'
REPLACE INTO t1 VALUES (10);
@@ -42,8 +50,10 @@ EXPLAIN REPLACE INTO t1 SELECT * FROM t2;
ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1'
REPLACE INTO t1 SELECT * FROM t2;
ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1'
+connection default;
REVOKE INSERT ON privtest_db.t1 FROM 'privtest'@'localhost';
GRANT DELETE ON privtest_db.t1 TO 'privtest'@'localhost';
+connection con1;
EXPLAIN REPLACE INTO t1 VALUES (10);
ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1'
REPLACE INTO t1 VALUES (10);
@@ -52,7 +62,9 @@ EXPLAIN REPLACE INTO t1 SELECT * FROM t2;
ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1'
REPLACE INTO t1 SELECT * FROM t2;
ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1'
+connection default;
GRANT INSERT, DELETE ON privtest_db.t1 TO 'privtest'@'localhost';
+connection con1;
EXPLAIN REPLACE INTO t1 VALUES (10);
id select_type table type possible_keys key key_len ref rows Extra
1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL
@@ -61,7 +73,9 @@ EXPLAIN REPLACE INTO t1 SELECT * FROM t2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
REPLACE INTO t1 SELECT * FROM t2;
+connection default;
REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost';
+connection con1;
EXPLAIN UPDATE t1 SET a = a + 1;
ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1'
UPDATE t1 SET a = a + 1;
@@ -70,7 +84,9 @@ EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1'
UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1'
+connection default;
GRANT UPDATE ON privtest_db.t1 TO 'privtest'@'localhost';
+connection con1;
EXPLAIN UPDATE t1 SET a = a + 1;
ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1'
UPDATE t1 SET a = a + 1;
@@ -79,8 +95,10 @@ EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1'
UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1'
+connection default;
REVOKE UPDATE ON privtest_db.t1 FROM 'privtest'@'localhost';
GRANT SELECT ON privtest_db.t1 TO 'privtest'@'localhost';
+connection con1;
EXPLAIN UPDATE t1 SET a = a + 1;
ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1'
UPDATE t1 SET a = a + 1;
@@ -89,7 +107,9 @@ EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1'
UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1'
+connection default;
GRANT UPDATE, SELECT ON privtest_db.t1 TO 'privtest'@'localhost';
+connection con1;
EXPLAIN UPDATE t1 SET a = a + 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8
@@ -99,7 +119,9 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where
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;
EXPLAIN DELETE FROM t1 WHERE a = 10;
ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1'
DELETE FROM t1 WHERE a = 10;
@@ -108,7 +130,9 @@ EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1'
DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1'
+connection default;
GRANT DELETE ON privtest_db.t1 TO 'privtest'@'localhost';
+connection con1;
EXPLAIN DELETE FROM t1 WHERE a = 10;
ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1'
DELETE FROM t1 WHERE a = 10;
@@ -117,8 +141,10 @@ EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1'
DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1'
+connection default;
REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost';
GRANT SELECT ON privtest_db.t1 TO 'privtest'@'localhost';
+connection con1;
EXPLAIN DELETE FROM t1 WHERE a = 10;
ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1'
DELETE FROM t1 WHERE a = 10;
@@ -127,8 +153,10 @@ EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1'
DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1'
+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;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where
@@ -138,9 +166,11 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where
DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
+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;
EXPLAIN SELECT * FROM v1;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
SELECT * FROM v1;
@@ -175,6 +205,8 @@ DELETE FROM v1 WHERE a = 10;
EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
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;
diff --git a/mysql-test/r/grant_lowercase.result b/mysql-test/r/grant_lowercase.result
index b449453a47a..d4a1667595e 100644
--- a/mysql-test/r/grant_lowercase.result
+++ b/mysql-test/r/grant_lowercase.result
@@ -1,8 +1,12 @@
set sql_mode="";
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;
grant file on aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.* to 'user'@'%' identified by 'secret';
ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+connection default;
+disconnect conn1;
drop user user1@localhost;
call mtr.add_suppression("Incorrect database name");
alter table mysql.host modify Db varchar(200);
diff --git a/mysql-test/r/grant_lowercase_fs.result b/mysql-test/r/grant_lowercase_fs.result
index eb27b1d7ea0..e883067eca0 100644
--- a/mysql-test/r/grant_lowercase_fs.result
+++ b/mysql-test/r/grant_lowercase_fs.result
@@ -3,13 +3,18 @@ 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);
SELECT * FROM t1;
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1'
+connect con2,localhost,USER_1,,db1;
SELECT * FROM t1;
f1
CREATE TABLE t2(f1 int);
ERROR 42000: CREATE command denied to user 'USER_1'@'localhost' for table 't2'
+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;
diff --git a/mysql-test/r/greedy_optimizer.result b/mysql-test/r/greedy_optimizer.result
index 74fe9980958..de9db45cb15 100644
--- a/mysql-test/r/greedy_optimizer.result
+++ b/mysql-test/r/greedy_optimizer.result
@@ -118,10 +118,10 @@ select @@optimizer_prune_level;
1
set optimizer_search_depth=63;
Warnings:
-Warning 1287 'optimizer-search-depth=63' is deprecated and will be removed in a future release. Please use a search depth less than 63 instead
+Warning 1292 Truncated incorrect optimizer_search_depth value: '63'
select @@optimizer_search_depth;
@@optimizer_search_depth
-63
+62
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;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
@@ -133,7 +133,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 821.837037
+Last_query_cost 1693.637037
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;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
@@ -145,55 +145,55 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 821.837037
+Last_query_cost 1693.637037
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;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
-1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
-1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 794.837037
+Last_query_cost 844.037037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index
-1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index
-1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
+1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 794.837037
+Last_query_cost 844.037037
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1
+1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
+1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 794.837037
+Last_query_cost 844.037037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1
+1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
+1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where
1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
show status like 'Last_query_cost';
Variable_name Value
-Last_query_cost 794.837037
+Last_query_cost 844.037037
set optimizer_prune_level=0;
select @@optimizer_prune_level;
@@optimizer_prune_level
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index eb730a8c954..9fee03877c5 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -1346,12 +1346,43 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR JOIN (PRIMARY,i2);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 144
+#
+# For this explain, the query plan is weird: if we are using
+# the primary key for reasons other than doing grouping, can't
+# 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;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index; Using filesort
+# Here's a proof it is really doing sorting:
+flush status;
+SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (PRIMARY,i2) GROUP BY a;
+show status like 'Sort_%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 0
+Sort_range 0
+Sort_rows 144
+Sort_scan 1
+# Proof ends.
+#
+# For this explain, the query plan is weird: if we are using
+# the primary key for reasons other than doing sorting, can't
+# 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;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index; Using filesort
+# Here's a proof it is really doing sorting:
+flush status;
+SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
+show status like 'Sort_%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 0
+Sort_range 0
+Sort_rows 144
+Sort_scan 1
+# Proof ends.
+#
SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
a
1
@@ -1758,7 +1789,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select <expr_cache><`test`.`t1`.`a`>((select `test`.`t1`.`a`)) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by (<expr_cache><`test`.`t1`.`a`>((select `test`.`t1`.`a`)) + 0)
+Note 1003 select <expr_cache><`test`.`t1`.`a`>((select `test`.`t1`.`a`)) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by <expr_cache><`test`.`t1`.`a`>((select `test`.`t1`.`a`)) + 0
EXPLAIN EXTENDED
SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY -aa;
id select_type table type possible_keys key key_len ref rows filtered Extra
@@ -1766,7 +1797,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select <expr_cache><`test`.`t1`.`a`>((select `test`.`t1`.`a`)) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by -(<expr_cache><`test`.`t1`.`a`>((select `test`.`t1`.`a`)))
+Note 1003 select <expr_cache><`test`.`t1`.`a`>((select `test`.`t1`.`a`)) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by -<expr_cache><`test`.`t1`.`a`>((select `test`.`t1`.`a`))
# should return only one record
SELECT (SELECT tt.a FROM t1 tt LIMIT 1) aa, COUNT(DISTINCT b) FROM t1
GROUP BY aa;
@@ -2792,3 +2823,12 @@ SELECT 1 IN ( SELECT COUNT( DISTINCT f2 ) FROM t1 WHERE f1 <= 4 );
1 IN ( SELECT COUNT( DISTINCT f2 ) FROM t1 WHERE f1 <= 4 )
0
drop table t1;
+#
+# MDEV-10694 - SIGFPE and/or huge memory allocation in maria_create with distinct/group by/ rollup
+#
+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;
+1
+1
+drop table t1;
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index cd7f1014ec0..36a44b05817 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -1707,15 +1707,15 @@ select a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1
a1 a2 b
explain select distinct a1,a2,b from t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using index
+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by
explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a');
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index
+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 100.00 Using where; Using index
+1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 50.78 Using where; Using index
Warnings:
-Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`b` = 'a') and (`test`.`t1`.`c` = 'i121') and (`test`.`t1`.`a2` >= 'b'))
+Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`b` = 'a' and `test`.`t1`.`c` = 'i121' and `test`.`t1`.`a2` >= 'b'
explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 Using where; Using index for group-by
@@ -1724,15 +1724,15 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index
explain select distinct a1,a2,b from t2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index NULL idx_t2_2 146 NULL # Using index
+1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using index for group-by
explain select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a');
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index NULL idx_t2_2 146 NULL # Using where; Using index
+1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 100.00 Using where; Using index
+1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 50.61 Using where; Using index
Warnings:
-Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`b` = 'a') and (`test`.`t2`.`c` = 'i121') and (`test`.`t2`.`a2` >= 'b'))
+Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`b` = 'a' and `test`.`t2`.`c` = 'i121' and `test`.`t2`.`a2` >= 'b'
explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by
@@ -1855,7 +1855,7 @@ c e
d e
explain select distinct a1,a2,b from t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using index
+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by
explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
@@ -1870,7 +1870,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by; Using temporary; Using filesort
explain select distinct a1,a2,b from t2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index NULL idx_t2_2 146 NULL # Using index
+1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using index for group-by
explain select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
@@ -1953,15 +1953,15 @@ b
a
explain select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index
+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 65 Using where; Using index for group-by (scanning)
explain extended select count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 100.00 Using where; Using index for group-by
Warnings:
-Note 1003 select count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`) AS `count(distinct a1,a2,b)` from `test`.`t1` where ((`test`.`t1`.`b` = 'c') and (`test`.`t1`.`a1` > 'a') and (`test`.`t1`.`a2` > 'a'))
+Note 1003 select count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`) AS `count(distinct a1,a2,b)` from `test`.`t1` where `test`.`t1`.`b` = 'c' and `test`.`t1`.`a1` > 'a' and `test`.`t1`.`a2` > 'a'
explain select count(distinct b) from t1 where (a2 >= 'b') and (b = 'a');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index
@@ -1969,7 +1969,7 @@ explain extended select 98 + count(distinct a1,a2,b) from t1 where (a1 > 'a') an
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 100.00 Using where; Using index for group-by
Warnings:
-Note 1003 select (98 + count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`)) AS `98 + count(distinct a1,a2,b)` from `test`.`t1` where ((`test`.`t1`.`a1` > 'a') and (`test`.`t1`.`a2` > 'a'))
+Note 1003 select 98 + count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`) AS `98 + count(distinct a1,a2,b)` from `test`.`t1` where `test`.`t1`.`a1` > 'a' and `test`.`t1`.`a2` > 'a'
select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
count(distinct a1,a2,b)
4
@@ -2077,19 +2077,19 @@ where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a1
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 85.53 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`c` > 'a111')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`c` > 'a111' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`
explain extended select a1,a2,b,min(c),max(c) from t1
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 50.78 Using where; Using temporary; Using filesort
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,min(`test`.`t1`.`c`) AS `min(c)`,max(`test`.`t1`.`c`) AS `max(c)` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`d` > 'xy2')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,min(`test`.`t1`.`c`) AS `min(c)`,max(`test`.`t1`.`c`) AS `max(c)` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`d` > 'xy2' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
explain extended select a1,a2,b,c from t1
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b,c;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 50.78 Using where; Using temporary; Using filesort
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`d` > 'xy2')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`,`test`.`t1`.`c`
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`d` > 'xy2' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`,`test`.`t1`.`c`
explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b < 'b') group by a1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
@@ -2097,7 +2097,7 @@ explain extended select a1,a2,b from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a'
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 85.53 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`c` > 'a111')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`c` > 'a111' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
explain select a1,a2,min(b),c from t2 where (a2 = 'a') and (c = 'a111') group by a1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
@@ -2121,12 +2121,12 @@ explain extended select a1,a2,count(a2) from t1 where (a1 > 'a') group by a1,a2,
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,count(`test`.`t1`.`a2`) AS `count(a2)` from `test`.`t1` where (`test`.`t1`.`a1` > 'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,count(`test`.`t1`.`a2`) AS `count(a2)` from `test`.`t1` where `test`.`t1`.`a1` > 'a' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
explain extended select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index
Warnings:
-Note 1003 select sum(ord(`test`.`t1`.`a1`)) AS `sum(ord(a1))` from `test`.`t1` where (`test`.`t1`.`a1` > 'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
+Note 1003 select sum(ord(`test`.`t1`.`a1`)) AS `sum(ord(a1))` from `test`.`t1` where `test`.`t1`.`a1` > 'a' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
create table t4 as select distinct a1, a2, b, c from t1;
alter table t4 add unique index idxt4 (a1, a2, b, c);
# This is "superceded" by MDEV-7118, and Loose Index Scan is again an option:
@@ -2173,7 +2173,7 @@ c
d
explain select distinct a1 from t1 where a2 = 'b';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index
+1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using where; Using index for group-by
select distinct a1 from t1 where a2 = 'b';
a1
a
@@ -2283,7 +2283,7 @@ INSERT INTO t1 (a) VALUES
('SOUTH EAST'), ('SOUTH WEST'), ('WESTERN');
EXPLAIN SELECT DISTINCT a,a FROM t1 ORDER BY a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL a 66 NULL 11 Using index
+1 SIMPLE t1 range NULL a 66 NULL 6 Using index for group-by
SELECT DISTINCT a,a FROM t1 ORDER BY a;
a a
@@ -2499,7 +2499,7 @@ INSERT INTO t1 VALUES
(4), (2), (1), (2), (2), (4), (1), (4);
EXPLAIN SELECT DISTINCT(a) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL idx 5 NULL 16 Using index
+1 SIMPLE t1 range NULL idx 5 NULL 9 Using index for group-by
SELECT DISTINCT(a) FROM t1;
a
1
@@ -2507,7 +2507,7 @@ a
4
EXPLAIN SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL idx 5 NULL 16 Using index
+1 SIMPLE t1 range NULL idx 5 NULL 9 Using index for group-by
SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
a
1
@@ -2562,7 +2562,7 @@ a MIN(b) MAX(b) AVG(b)
DROP TABLE t1;
create table t1 (a int, b int, key (a,b), key `index` (a,b)) engine=MyISAM;
Warnings:
-Note 1831 Duplicate index `index`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `index`. This is deprecated and will be disallowed in a future release
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),
@@ -2636,7 +2636,7 @@ explain extended select sql_buffer_result a, max(b)+1 from t1 where a = 0 group
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ref a,index a 5 const 15 100.00 Using index; Using temporary
Warnings:
-Note 1003 select sql_buffer_result `test`.`t1`.`a` AS `a`,(max(`test`.`t1`.`b`) + 1) AS `max(b)+1` from `test`.`t1` where (`test`.`t1`.`a` = 0) group by `test`.`t1`.`a`
+Note 1003 select sql_buffer_result `test`.`t1`.`a` AS `a`,max(`test`.`t1`.`b`) + 1 AS `max(b)+1` from `test`.`t1` where `test`.`t1`.`a` = 0 group by `test`.`t1`.`a`
drop table t1;
CREATE TABLE t1 (a int, b int, c int, d int,
KEY foo (c,d,a,b), KEY bar (c,a,b,d));
@@ -2646,7 +2646,7 @@ INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT a,b,c+1,d FROM t1;
EXPLAIN SELECT DISTINCT c FROM t1 WHERE d=4;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL foo 20 NULL 32 Using where; Using index
+1 SIMPLE t1 range NULL foo 10 NULL 9 Using where; Using index for group-by
SELECT DISTINCT c FROM t1 WHERE d=4;
c
1
@@ -3339,19 +3339,19 @@ 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;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL a 10 NULL 16 Using index
+1 SIMPLE t1 range NULL a 5 NULL 9 Using index for group-by
SELECT COUNT(DISTINCT a) FROM t1;
COUNT(DISTINCT a)
2
EXPLAIN SELECT COUNT(DISTINCT a,b) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL a 10 NULL 16 Using index
+1 SIMPLE t1 range NULL a 10 NULL 9 Using index for group-by
SELECT COUNT(DISTINCT a,b) FROM t1;
COUNT(DISTINCT a,b)
16
EXPLAIN SELECT COUNT(DISTINCT b,a) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL a 10 NULL 16 Using index
+1 SIMPLE t1 range NULL a 10 NULL 9 Using index for group-by
SELECT COUNT(DISTINCT b,a) FROM t1;
COUNT(DISTINCT b,a)
16
@@ -3414,7 +3414,7 @@ COUNT(DISTINCT a)
2
EXPLAIN SELECT 1 FROM t1 HAVING COUNT(DISTINCT a) < 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL a 10 NULL 16 Using index
+1 SIMPLE t1 range NULL a 5 NULL 9 Using index for group-by
SELECT 1 FROM t1 HAVING COUNT(DISTINCT a) < 10;
1
1
@@ -3435,19 +3435,19 @@ COUNT(DISTINCT t1_1.a)
1
EXPLAIN SELECT COUNT(DISTINCT a), 12 FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL a 10 NULL 16 Using index
+1 SIMPLE t1 range NULL a 5 NULL 9 Using index for group-by
SELECT COUNT(DISTINCT a), 12 FROM t1;
COUNT(DISTINCT a) 12
2 12
EXPLAIN SELECT COUNT(DISTINCT a, b, c) FROM t2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index NULL a 15 NULL 16 Using index
+1 SIMPLE t2 range NULL a 15 NULL 9 Using index for group-by
SELECT COUNT(DISTINCT a, b, c) FROM t2;
COUNT(DISTINCT a, b, c)
16
EXPLAIN SELECT COUNT(DISTINCT a), SUM(DISTINCT a), AVG(DISTINCT a) FROM t2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index NULL a 15 NULL 16 Using index
+1 SIMPLE t2 range NULL a 5 NULL 9 Using index for group-by
SELECT COUNT(DISTINCT a), SUM(DISTINCT a), AVG(DISTINCT a) FROM t2;
COUNT(DISTINCT a) SUM(DISTINCT a) AVG(DISTINCT a)
2 3 1.5000
@@ -3459,7 +3459,7 @@ COUNT(DISTINCT a) SUM(DISTINCT a) AVG(DISTINCT f)
2 3 1.0000
EXPLAIN SELECT COUNT(DISTINCT a, b), COUNT(DISTINCT b, a) FROM t2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index NULL a 15 NULL 16 Using index
+1 SIMPLE t2 range NULL a 10 NULL 9 Using index for group-by
SELECT COUNT(DISTINCT a, b), COUNT(DISTINCT b, a) FROM t2;
COUNT(DISTINCT a, b) COUNT(DISTINCT b, a)
16 16
diff --git a/mysql-test/r/group_min_max_innodb.result b/mysql-test/r/group_min_max_innodb.result
index 2803107b97e..311032bc453 100644
--- a/mysql-test/r/group_min_max_innodb.result
+++ b/mysql-test/r/group_min_max_innodb.result
@@ -194,7 +194,7 @@ EXPLAIN SELECT c1, i1, max(i2) FROM t2
WHERE (c1 = 'C' OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 )
GROUP BY c1,i1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range k2 k2 5 NULL 59 Using where; Using index
+1 SIMPLE t2 range k2 k2 5 NULL 60 Using where; Using index
SELECT c1, i1, max(i2) FROM t2
WHERE (c1 = 'C' OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 )
GROUP BY c1,i1;
@@ -205,7 +205,7 @@ EXPLAIN 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;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range k2 k2 5 NULL 58 Using where; Using index
+1 SIMPLE t2 range k2 k2 5 NULL 60 Using where; Using index
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;
diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result
index 3845f119528..c64d0579962 100644
--- a/mysql-test/r/having.result
+++ b/mysql-test/r/having.result
@@ -12,7 +12,7 @@ explain extended select count(a) as b from t1 where a=0 having b >=0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select count(NULL) AS `b` from dual where 0 having (`b` >= 0)
+Note 1003 select count(NULL) AS `b` from dual where 0 having `b` >= 0
drop table t1;
CREATE TABLE t1 (
raw_id int(10) NOT NULL default '0',
@@ -370,7 +370,7 @@ select * from t1 a, t1 b group by a.s1 having s1 is null;
ERROR 23000: Column 's1' in having clause is ambiguous
drop table t1;
create table t1 (s1 char character set latin1 collate latin1_german1_ci);
-insert into t1 values ('ü'),('y');
+insert ignore into t1 values ('ü'),('y');
Warnings:
Warning 1265 Data truncated for column 's1' at row 1
select s1,count(s1) from t1
@@ -470,10 +470,9 @@ WHERE table2.f1 = 2
GROUP BY table1.f1, table2.f2
HAVING (table2.f2 = 8 AND table1.f1 >= 6);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE table2 const PRIMARY PRIMARY 4 const 1 100.00 Using filesort
-1 SIMPLE table1 ALL NULL NULL NULL NULL 4 100.00 Using where
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables
Warnings:
-Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where (`test`.`table1`.`f3` = 9) group by `test`.`table1`.`f1`,7 having ((7 = 8) and (`test`.`table1`.`f1` >= 6))
+Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where `test`.`table1`.`f3` = 9 group by `test`.`table1`.`f1`,7 having 0
EXPLAIN EXTENDED
SELECT table1.f1, table2.f2
FROM t1 AS table1
@@ -482,10 +481,9 @@ WHERE table2.f1 = 2
GROUP BY table1.f1, table2.f2
HAVING (table2.f2 = 8);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE table2 const PRIMARY PRIMARY 4 const 1 100.00 Using filesort
-1 SIMPLE table1 ALL NULL NULL NULL NULL 4 100.00 Using where
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables
Warnings:
-Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where (`test`.`table1`.`f3` = 9) group by `test`.`table1`.`f1`,7 having (7 = 8)
+Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where `test`.`table1`.`f3` = 9 group by `test`.`table1`.`f1`,7 having 0
DROP TABLE t1;
#
# Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355
@@ -633,7 +631,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL f10 4 NULL 2 100.00 Using index
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select min(`test`.`t1`.`f10`) AS `field1` from `test`.`t1` where <expr_cache><7>(<in_optimizer>(7,<exists>(select `test`.`t3`.`f3` from `test`.`t3` where (<cache>(7) = `test`.`t3`.`f3`)))) having (<cache>(`field1`) < 's')
+Note 1003 select min(`test`.`t1`.`f10`) AS `field1` from `test`.`t1` where <expr_cache><7>(<in_optimizer>(7,<exists>(select `test`.`t3`.`f3` from `test`.`t3` where <cache>(7) = `test`.`t3`.`f3`))) having <cache>(`field1`) < 's'
set optimizer_switch=@save_optimizer_switch;
drop table t1,t2,t3;
End of 5.2 tests
@@ -758,3 +756,76 @@ A COUNT(*)
DROP VIEW v1;
DROP TABLE t1;
End of 10.1 tests
+#
+# MDEV-14093: GROUP BY with HAVING over function + ORDER BY
+#
+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;
+id books having_field
+1 NULL 0
+DROP TABLE _authors, _books, _books2authors;
+#
+# Bug#17055185: WRONG RESULTS WHEN RUNNING A SELECT THAT INCLUDE
+# A HAVING BASED ON A FUNCTION.
+#
+CREATE TABLE series (
+val INT(10) UNSIGNED NOT NULL
+);
+INSERT INTO series VALUES(1);
+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;
+|
+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;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT t, next_seq_value() r FROM t1 FORCE INDEX(t)
+GROUP BY t HAVING r = 1 ORDER BY t1.u;
+t r
+10 1
+12 1
+15 1
+17 1
+DROP TABLE t1;
+DROP FUNCTION next_seq_value;
+DROP TABLE series;
diff --git a/mysql-test/r/help.result b/mysql-test/r/help.result
index aefe6f8381e..66850e75dc1 100644
--- a/mysql-test/r/help.result
+++ b/mysql-test/r/help.result
@@ -1,46 +1,46 @@
-insert into mysql.help_category(help_category_id,name)values(10001,'impossible_category_1');
+insert ignore into mysql.help_category(help_category_id,name)values(10001,'impossible_category_1');
Warnings:
Warning 1364 Field 'url' doesn't have a default value
select @category1_id:= 10001;
@category1_id:= 10001
10001
-insert into mysql.help_category(help_category_id,name)values(10002,'impossible_category_2');
+insert ignore into mysql.help_category(help_category_id,name)values(10002,'impossible_category_2');
Warnings:
Warning 1364 Field 'url' doesn't have a default value
select @category2_id:= 10002;
@category2_id:= 10002
10002
-insert into mysql.help_category(help_category_id,name,parent_category_id)values(10003,'impossible_category_3',@category2_id);
+insert ignore into mysql.help_category(help_category_id,name,parent_category_id)values(10003,'impossible_category_3',@category2_id);
Warnings:
Warning 1364 Field 'url' doesn't have a default value
select @category3_id:= 10003;
@category3_id:= 10003
10003
-insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10101,'impossible_function_1',@category1_id,'description of \n impossible_function1\n','example of \n impossible_function1');
+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');
Warnings:
Warning 1364 Field 'url' doesn't have a default value
select @topic1_id:= 10101;
@topic1_id:= 10101
10101
-insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10102,'impossible_function_2',@category1_id,'description of \n impossible_function2\n','example of \n impossible_function2');
+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');
Warnings:
Warning 1364 Field 'url' doesn't have a default value
select @topic2_id:= 10102;
@topic2_id:= 10102
10102
-insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10103,'impossible_function_3',@category2_id,'description of \n impossible_function3\n','example of \n impossible_function3');
+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');
Warnings:
Warning 1364 Field 'url' doesn't have a default value
select @topic3_id:= 10103;
@topic3_id:= 10103
10103
-insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10104,'impossible_function_4',@category2_id,'description of \n impossible_function4\n','example of \n impossible_function4');
+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');
Warnings:
Warning 1364 Field 'url' doesn't have a default value
select @topic4_id:= 10104;
@topic4_id:= 10104
10104
-insert into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10105,'impossible_function_7',@category3_id,'description of \n impossible_function5\n','example of \n impossible_function7');
+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');
Warnings:
Warning 1364 Field 'url' doesn't have a default value
select @topic5_id:= 10105;
diff --git a/mysql-test/r/index_intersect_innodb.result b/mysql-test/r/index_intersect_innodb.result
index 9c3a501111d..15244098170 100644
--- a/mysql-test/r/index_intersect_innodb.result
+++ b/mysql-test/r/index_intersect_innodb.result
@@ -485,7 +485,7 @@ SELECT * FROM City
WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000
AND Country BETWEEN 'S' AND 'Z' ;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Country,Population 4,7,4 NULL # Using sort_intersect(PRIMARY,Country,Population); Using where
+1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where
SELECT * FROM City USE INDEX ()
WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%';
ID Name Country Population
@@ -745,7 +745,7 @@ SELECT * FROM City
WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000
AND Country BETWEEN 'S' AND 'Z';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Country,Population 4,7,4 NULL # Using sort_intersect(PRIMARY,Country,Population); Using where
+1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where
SELECT * FROM City WHERE
Name LIKE 'C%' AND Population > 1000000;
ID Name Country Population
diff --git a/mysql-test/r/index_merge_innodb.result b/mysql-test/r/index_merge_innodb.result
index b3007408368..6a3ea839535 100644
--- a/mysql-test/r/index_merge_innodb.result
+++ b/mysql-test/r/index_merge_innodb.result
@@ -552,7 +552,7 @@ primary key (pk1, pk2)
);
explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 9 Using where
+1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 10 Using where
select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy badkey filler1 filler2
1 10 0 0 0 0 0 0 0 10 0 filler-data-10 filler2
@@ -597,7 +597,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge key1,pktail2ok key1,pktail2ok 4,4 NULL 1 Using intersect(key1,pktail2ok); Using where
explain select * from t1 where (pktail2ok=1 and pk1< 50000) or key1=10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge PRIMARY,key1,pktail2ok pktail2ok,key1 8,4 NULL 199 Using sort_union(pktail2ok,key1); Using where
+1 SIMPLE t1 index_merge PRIMARY,key1,pktail2ok pktail2ok,key1 8,4 NULL 200 Using sort_union(pktail2ok,key1); Using where
explain select * from t1 where pktail3bad=1 and key1=10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref key1,pktail3bad key1 4 const 100 Using where
@@ -699,8 +699,8 @@ SELECT COUNT(*) FROM
(SELECT * FROM t1 FORCE INDEX(primary,idx)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6144
-2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 6144 Using sort_union(idx,PRIMARY); Using where
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6145
+2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 6145 Using sort_union(idx,PRIMARY); Using where
SELECT COUNT(*) FROM
(SELECT * FROM t1 FORCE INDEX(primary,idx)
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result
index 6ec17254809..992e1d831b5 100644
--- a/mysql-test/r/index_merge_myisam.result
+++ b/mysql-test/r/index_merge_myisam.result
@@ -34,6 +34,9 @@ key1 key2 key3 key4 key5 key6 key7 key8
1022 1022 1022 1022 1022 1022 1022 2
1023 1023 1023 1023 1023 1023 1023 1
1024 1024 1024 1024 1024 1024 1024 0
+select * from t0 where key1=1022;
+key1 key2 key3 key4 key5 key6 key7 key8
+1022 1022 1022 1022 1022 1022 1022 2
explain select * from t0 where key1 < 3 or key2 <4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 7 Using sort_union(i1,i2); Using where
@@ -224,7 +227,7 @@ index i2_1(key2, key2_1),
index i2_2(key2, key2_1)
);
Warnings:
-Note 1831 Duplicate index `i2_2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i2_2`. This is deprecated and will be disallowed in a future release
insert into t4 select key1,key1,key1 div 10, key1 % 10, key1 % 10, key1 from t0;
select * from t4 where key1a = 3 or key1b = 4;
key1a key1b key2 key2_1 key2_2 key3
@@ -292,7 +295,7 @@ set optimizer_switch='derived_merge=off,derived_with_keys=off';
explain select * from (select * from t1 where key1 = 3 or key2 =3) as Z where key8 >5;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using where
-2 DERIVED t1 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
+2 DERIVED t1 index_merge i1,i2,i8 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
set optimizer_switch=@tmp_optimizer_switch;
create table t3 like t0;
insert into t3 select * from t0;
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 2b5a536308a..6f411eb8639 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -222,14 +222,16 @@ Field Type Collation Null Key Default Extra Privileges Comment
c varchar(64) utf8_general_ci NO select,insert,update,references
select * from information_schema.COLUMNS where table_name="t1"
and column_name= "a";
-TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
-def mysqltest t1 a 1 NULL YES int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION
+def mysqltest t1 a 1 NULL YES int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references NEVER NULL
show columns from mysqltest.t1 where field like "%a%";
Field Type Null Key Default Extra
a int(11) YES NULL
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';
table_name column_name privileges
@@ -237,12 +239,16 @@ t1 a select
show columns from mysqltest.t1;
Field Type Null Key Default Extra
a int(11) YES NULL
+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';
table_name column_name privileges
v1 c select
explain select * from v1;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
+connection default;
+disconnect user4;
drop view v1, mysqltest.v1;
drop tables mysqltest.t4, mysqltest.t1, t2, t3, t5;
drop database mysqltest;
@@ -267,6 +273,8 @@ latin1_bin latin1 47 # 1
latin1_general_ci latin1 48 # 1
latin1_general_cs latin1 49 # 1
latin1_spanish_ci latin1 94 # 1
+latin1_swedish_nopad_ci latin1 1032 # 1
+latin1_nopad_bin latin1 1071 # 1
SHOW COLLATION LIKE 'latin1%';
Collation Charset Id Default Compiled Sortlen
latin1_german1_ci latin1 5 # 1
@@ -277,6 +285,8 @@ latin1_bin latin1 47 # 1
latin1_general_ci latin1 48 # 1
latin1_general_cs latin1 49 # 1
latin1_spanish_ci latin1 94 # 1
+latin1_swedish_nopad_ci latin1 1032 # 1
+latin1_nopad_bin latin1 1071 # 1
SHOW COLLATION WHERE collation like 'latin1%';
Collation Charset Id Default Compiled Sortlen
latin1_german1_ci latin1 5 # 1
@@ -287,6 +297,8 @@ latin1_bin latin1 47 # 1
latin1_general_ci latin1 48 # 1
latin1_general_cs latin1 49 # 1
latin1_spanish_ci latin1 94 # 1
+latin1_swedish_nopad_ci latin1 1032 # 1
+latin1_nopad_bin latin1 1071 # 1
select * from information_schema.COLLATION_CHARACTER_SET_APPLICABILITY
where COLLATION_NAME like 'latin1%';
COLLATION_NAME CHARACTER_SET_NAME
@@ -298,6 +310,8 @@ latin1_bin latin1
latin1_general_ci latin1
latin1_general_cs latin1
latin1_spanish_ci latin1
+latin1_swedish_nopad_ci latin1
+latin1_nopad_bin latin1
drop procedure if exists sel2;
drop function if exists sub1;
drop function if exists sub2;
@@ -346,15 +360,21 @@ routine_schema routine_name
test sel2
test sub1
drop view v1;
+connect user1,localhost,mysqltest_1,,;
+connection user1;
select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES;
ROUTINE_NAME ROUTINE_DEFINITION
show create function sub1;
ERROR 42000: FUNCTION sub1 does not exist
+connection user3;
select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES;
ROUTINE_NAME ROUTINE_DEFINITION
sel2 NULL
sub1 NULL
+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;
ROUTINE_NAME ROUTINE_DEFINITION
sel2 NULL
@@ -379,6 +399,9 @@ return i+1 latin1 latin1_swedish_ci latin1_swedish_ci
show function status like "sub2";
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
test sub2 FUNCTION mysqltest_1@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
+connection default;
+disconnect user1;
+disconnect user3;
drop function sub2;
show create procedure sel2;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
@@ -425,15 +448,17 @@ latin1_bin
latin1_general_ci
latin1_general_cs
latin1_spanish_ci
+latin1_swedish_nopad_ci
+latin1_nopad_bin
show keys from v4;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
select * from information_schema.views where TABLE_NAME like "v%";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM
def test v0 select `information_schema`.`schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
-def test v1 select `information_schema`.`tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`information_schema`.`tables`.`TABLE_NAME` = 'v1') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
-def test v2 select `information_schema`.`columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`information_schema`.`columns`.`TABLE_NAME` = 'v2') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
-def test v3 select `information_schema`.`character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`information_schema`.`character_sets`.`CHARACTER_SET_NAME` like 'latin1%') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
-def test v4 select `information_schema`.`collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`information_schema`.`collations`.`COLLATION_NAME` like 'latin1%') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
+def test v1 select `information_schema`.`tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where `information_schema`.`tables`.`TABLE_NAME` = 'v1' NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
+def test v2 select `information_schema`.`columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where `information_schema`.`columns`.`TABLE_NAME` = 'v2' NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
+def test v3 select `information_schema`.`character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where `information_schema`.`character_sets`.`CHARACTER_SET_NAME` like 'latin1%' NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
+def test v4 select `information_schema`.`collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where `information_schema`.`collations`.`COLLATION_NAME` like 'latin1%' NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
drop view v0, v1, v2, v3, v4;
create table t1 (a int);
grant select,update,insert on t1 to mysqltest_1@localhost;
@@ -483,10 +508,10 @@ 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);
Warnings:
-Note 1831 Duplicate index `key_1`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `key_1`. This is deprecated and will be disallowed in a future release
alter table t1 add constraint constraint_2 unique key_2(a);
Warnings:
-Note 1831 Duplicate index `key_2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `key_2`. This is deprecated and will be disallowed in a future release
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -510,6 +535,7 @@ def test PRIMARY def test t1 a 1 NULL NULL NULL NULL
def test constraint_1 def test t1 a 1 NULL NULL NULL NULL
def test key_1 def test t1 a 1 NULL NULL NULL NULL
def test key_2 def test t1 a 1 NULL NULL NULL NULL
+connection user2;
select table_name from information_schema.TABLES where table_schema like "test%";
table_name
t1
@@ -520,6 +546,8 @@ select ROUTINE_NAME from information_schema.ROUTINES;
ROUTINE_NAME
sel2
sub1
+disconnect user2;
+connection default;
delete from mysql.user where user='mysqltest_1';
drop table t1;
drop procedure sel2;
@@ -558,6 +586,7 @@ select s1 from t1 where s1 in (select version from
information_schema.tables) union select version from
information_schema.tables;
s1
+11
10
drop table t1;
SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
@@ -566,7 +595,7 @@ CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` (
`CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '',
`DEFAULT_COLLATE_NAME` varchar(32) NOT NULL DEFAULT '',
`DESCRIPTION` varchar(60) NOT NULL DEFAULT '',
- `MAXLEN` bigint(3) NOT NULL DEFAULT '0'
+ `MAXLEN` bigint(3) NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8
set names latin2;
SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
@@ -575,7 +604,7 @@ CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` (
`CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '',
`DEFAULT_COLLATE_NAME` varchar(32) NOT NULL DEFAULT '',
`DESCRIPTION` varchar(60) NOT NULL DEFAULT '',
- `MAXLEN` bigint(3) NOT NULL DEFAULT '0'
+ `MAXLEN` bigint(3) NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8
set names latin1;
create table t1 select * from information_schema.CHARACTER_SETS
@@ -590,7 +619,7 @@ t1 CREATE TABLE `t1` (
`CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '',
`DEFAULT_COLLATE_NAME` varchar(32) NOT NULL DEFAULT '',
`DESCRIPTION` varchar(60) NOT NULL DEFAULT '',
- `MAXLEN` bigint(3) NOT NULL DEFAULT '0'
+ `MAXLEN` bigint(3) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=utf8
drop table t1;
create view v1 as select * from information_schema.TABLES;
@@ -815,6 +844,7 @@ table_schema table_name column_name
information_schema ALL_PLUGINS PLUGIN_DESCRIPTION
information_schema COLUMNS COLUMN_DEFAULT
information_schema COLUMNS COLUMN_TYPE
+information_schema COLUMNS GENERATION_EXPRESSION
information_schema EVENTS EVENT_DEFINITION
information_schema PARAMETERS DTD_IDENTIFIER
information_schema PARTITIONS PARTITION_EXPRESSION
@@ -887,6 +917,8 @@ x_float NULL NULL
x_double_precision NULL NULL
drop table t1;
grant select on test.* to mysqltest_4@localhost;
+connect user10261,localhost,mysqltest_4,,;
+connection user10261;
SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS
where COLUMN_NAME='TABLE_NAME' and table_name not like 'innodb%';
TABLE_NAME COLUMN_NAME PRIVILEGES
@@ -903,6 +935,8 @@ TABLE_CONSTRAINTS TABLE_NAME select
TABLE_PRIVILEGES TABLE_NAME select
TABLE_STATISTICS TABLE_NAME select
VIEWS TABLE_NAME select
+connection default;
+disconnect user10261;
delete from mysql.user where user='mysqltest_4';
delete from mysql.db where user='mysqltest_4';
flush privileges;
@@ -931,34 +965,34 @@ trg1 INSERT t1 begin
if new.j > 10 then
set new.j := 10;
end if;
-end BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+end BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
trg2 UPDATE t1 begin
if old.i % 2 = 0 then
set new.j := -1;
end if;
-end BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+end BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
trg3 UPDATE t1 begin
if new.j = -1 then
set @fired:= "Yes";
end if;
-end AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+end AFTER # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
select * from information_schema.triggers where trigger_schema in ('mysql', 'information_schema', 'test', 'mysqltest');
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def test trg1 INSERT def test t1 0 NULL begin
+def test trg1 INSERT def test t1 1 NULL begin
if new.j > 10 then
set new.j := 10;
end if;
-end ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-def test trg2 UPDATE def test t1 0 NULL begin
+end ROW BEFORE NULL NULL OLD NEW # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+def test trg2 UPDATE def test t1 1 NULL begin
if old.i % 2 = 0 then
set new.j := -1;
end if;
-end ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-def test trg3 UPDATE def test t1 0 NULL begin
+end ROW BEFORE NULL NULL OLD NEW # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+def test trg3 UPDATE def test t1 1 NULL begin
if new.j = -1 then
set @fired:= "Yes";
end if;
-end ROW AFTER NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+end ROW AFTER NULL NULL OLD NEW # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
drop trigger trg1;
drop trigger trg2;
drop trigger trg3;
@@ -970,6 +1004,11 @@ 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;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
'user1'@'localhost' def mysqltest t1 f1 SELECT NO
@@ -984,6 +1023,7 @@ show grants;
Grants for user1@localhost
GRANT USAGE ON *.* TO 'user1'@'localhost'
GRANT SELECT (f1) ON `mysqltest`.`t1` TO 'user1'@'localhost'
+connection con2;
select * from information_schema.column_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
select * from information_schema.table_privileges order by grantee;
@@ -998,6 +1038,7 @@ show grants;
Grants for user2@localhost
GRANT USAGE ON *.* TO 'user2'@'localhost'
GRANT SELECT ON `mysqltest`.`t2` TO 'user2'@'localhost'
+connection con3;
select * from information_schema.column_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
select * from information_schema.table_privileges order by grantee;
@@ -1012,6 +1053,7 @@ show grants;
Grants for user3@localhost
GRANT USAGE ON *.* TO 'user3'@'localhost'
GRANT SELECT ON `mysqltest`.* TO 'user3'@'localhost'
+connection con4;
select * from information_schema.column_privileges where grantee like '\'user%'
order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
@@ -1034,6 +1076,11 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
show grants;
Grants for user4@localhost
GRANT SELECT ON *.* TO 'user4'@'localhost'
+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;
@@ -1107,12 +1154,15 @@ t2 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL
DROP TABLE t1,t2;
create table t1(f1 int);
create view v1 (c) as select f1 from t1;
+connect con5,localhost,root,,*NO-ONE*;
select database();
database()
NULL
show fields from test.v1;
Field Type Null Key Default Extra
c int(11) YES NULL
+connection default;
+disconnect con5;
drop view v1;
drop table t1;
alter database information_schema;
@@ -1198,7 +1248,6 @@ table_schema='information_schema' and
or column_type = 'varchar(27)')
group by column_type order by num;
column_type group_concat(table_schema, '.', table_name) num
-varchar(27) information_schema.COLUMNS 1
varchar(7) information_schema.ROUTINES,information_schema.VIEWS 2
varchar(20) information_schema.ALL_PLUGINS,information_schema.ALL_PLUGINS,information_schema.ALL_PLUGINS,information_schema.FILES,information_schema.FILES,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PROFILING 9
create table t1(f1 char(1) not null, f2 char(9) not null)
@@ -1223,11 +1272,15 @@ 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';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM
def test v1 NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
def test v2 select 1 AS `1` NONE NO mysqltest_1@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
+connection default;
+disconnect con16681;
drop view v1, v2;
drop table t1;
drop user mysqltest_1@localhost;
@@ -1259,6 +1312,7 @@ SHOW CREATE FUNCTION f1;
Function sql_mode Create Function character_set_client collation_connection Database Collation
f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
RETURN @a + 1 latin1 latin1_swedish_ci latin1_swedish_ci
+connect conn1, localhost, mysql_bug20230,,;
SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test';
ROUTINE_NAME ROUTINE_DEFINITION
f1 NULL
@@ -1273,6 +1327,8 @@ CALL p1();
SELECT f1();
f1()
2
+disconnect conn1;
+connection default;
DROP FUNCTION f1;
DROP PROCEDURE p1;
DROP USER mysql_bug20230@localhost;
@@ -1288,13 +1344,13 @@ DROP TABLE IF EXISTS bug23037;
DROP FUNCTION IF EXISTS get_value;
SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037';
COLUMN_NAME MD5(COLUMN_DEFAULT) LENGTH(COLUMN_DEFAULT)
-fld1 7cf7a6782be951a1f2464a350da926a5 65532
+fld1 85ea6a55b8f0058e640b3de141a3a9d9 65534
SELECT MD5(get_value());
MD5(get_value())
-7cf7a6782be951a1f2464a350da926a5
+76176d2daa20c582375b8dcfc18033cd
SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT), COLUMN_DEFAULT=get_value() FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037';
COLUMN_NAME MD5(COLUMN_DEFAULT) LENGTH(COLUMN_DEFAULT) COLUMN_DEFAULT=get_value()
-fld1 7cf7a6782be951a1f2464a350da926a5 65532 1
+fld1 85ea6a55b8f0058e640b3de141a3a9d9 65534 0
DROP TABLE bug23037;
DROP FUNCTION get_value;
set @tmp_optimizer_switch=@@optimizer_switch;
@@ -1350,7 +1406,8 @@ trigger_name
t1_ai
show triggers from mysqltest;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
-t1_ai INSERT t1 set @a = new.a + new.b + new.c AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+t1_ai INSERT t1 set @a = new.a + new.b + new.c AFTER # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+connect con27629,localhost,mysqltest_1,,mysqltest;
show columns from t1;
Field Type Null Key Default Extra
b int(11) YES NULL
@@ -1362,6 +1419,8 @@ Trigger Event Table Statement Timing Created sql_mode Definer character_set_clie
select trigger_name from information_schema.triggers
where event_object_table='t1';
trigger_name
+connection default;
+disconnect con27629;
drop user mysqltest_1@localhost;
drop database mysqltest;
create table t1 (
@@ -1378,12 +1437,12 @@ select column_default from information_schema.columns where table_name= 't1';
column_default
NULL
NULL
-
+''
NULL
NULL
10
NULL
-2006-01-01 00:00:00
+'2006-01-01 00:00:00'
show columns from t1;
Field Type Null Key Default Extra
f1 varchar(50) YES NULL
@@ -1415,13 +1474,19 @@ select * from information_schema.engines WHERE ENGINE="MyISAM";
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
MyISAM DEFAULT MyISAM storage engine NO NO NO
grant select on *.* to user3148@localhost;
+connect con3148,localhost,user3148,,test;
+connection con3148;
select user,db from information_schema.processlist;
user db
user3148 test
+connection default;
+disconnect con3148;
drop user user3148@localhost;
+connect pslistcon,localhost,root,,test;
SELECT 'other connection here' AS who;
who
other connection here
+connection default;
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,
@@ -1430,6 +1495,7 @@ FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE ID=@tid;
time_low time_high time_ms_low time_ms_high
OK OK OK OK
+disconnect pslistcon;
DROP TABLE IF EXISTS server_status;
DROP EVENT IF EXISTS event_status;
SET GLOBAL event_scheduler=1;
@@ -1512,9 +1578,9 @@ WHERE TABLE_SCHEMA='mysql' and TABLE_NAME= 'db';
TABLE_COLLATION
utf8_bin
select * from information_schema.columns where table_schema = NULL;
-TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION
select * from `information_schema`.`COLUMNS` where `TABLE_NAME` = NULL;
-TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION
select * from `information_schema`.`KEY_COLUMN_USAGE` where `TABLE_SCHEMA` = NULL;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
select * from `information_schema`.`KEY_COLUMN_USAGE` where `TABLE_NAME` = NULL;
@@ -1579,10 +1645,22 @@ show open tables where f1()=0;
show open tables where f1()=0;
drop table t1;
drop function f1;
+connect conn1, localhost, root,,;
+connection conn1;
select * from information_schema.tables where 1=sleep(100000);
+connection default;
+connection conn1;
Got one of the listed errors
+connection default;
+disconnect conn1;
+connect conn1, localhost, root,,;
+connection conn1;
select * from information_schema.columns where 1=sleep(100000);
+connection default;
+connection conn1;
Got one of the listed errors
+connection default;
+disconnect conn1;
explain select count(*) from information_schema.tables;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tables ALL NULL NULL NULL NULL NULL Skip_open_table; Scanned all databases
@@ -1688,6 +1766,8 @@ USE db1;
CREATE TABLE t1 (id INT);
CREATE USER nonpriv;
USE test;
+connect nonpriv_con, localhost, nonpriv,,;
+connection nonpriv_con;
# connected as nonpriv
# Should return 0
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
@@ -1698,7 +1778,9 @@ USE INFORMATION_SCHEMA;
SELECT COUNT(*) FROM TABLES WHERE TABLE_NAME='t1';
COUNT(*)
0
+connection default;
# connected as root
+disconnect nonpriv_con;
DROP USER nonpriv;
DROP TABLE db1.t1;
DROP DATABASE db1;
@@ -1732,8 +1814,12 @@ DROP TABLE ubig;
select 1 from information_schema.tables where table_schema=repeat('a', 2000);
1
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);
1
+connection default;
+disconnect con1;
drop user mysqltest_1@localhost;
End of 5.1 tests.
#
@@ -1746,13 +1832,15 @@ End of 5.1 tests.
drop tables if exists t1, t2, t3;
create table t1 (i int);
create table t2 (j int primary key auto_increment);
-# Switching to connection 'con3726_1'
+connect con3726_1,localhost,root,,test;
+connection con3726_1;
lock table t2 read;
-# Switching to connection 'con3726_2'
+connect con3726_2,localhost,root,,test;
+connection con3726_2;
# RENAME below will be blocked by 'lock table t2 read' above but
# will add two pending requests for exclusive metadata locks.
rename table t2 to t3;
-# Switching to connection 'default'
+connection default;
# 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');
@@ -1764,10 +1852,12 @@ where table_schema = 'test' and table_name in ('t1', 't2');
table_name auto_increment
t1 NULL
t2 1
-# Switching to connection 'con3726_1'
+connection con3726_1;
unlock tables;
-# Switching to connection 'con3726_2'
-# Switching to connection 'default'
+connection con3726_2;
+connection default;
+disconnect con3726_1;
+disconnect con3726_2;
drop tables t1, t3;
EXPLAIN SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE;
id select_type table type possible_keys key key_len ref rows Extra
@@ -1831,7 +1921,7 @@ LEFT JOIN INFORMATION_SCHEMA.COLUMNS
USING (TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME)
WHERE COLUMNS.TABLE_SCHEMA = 'test'
AND COLUMNS.TABLE_NAME = 't1';
-TABLE_SCHEMA TABLE_NAME COLUMN_NAME CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME TABLE_CATALOG ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
+TABLE_SCHEMA TABLE_NAME COLUMN_NAME CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME TABLE_CATALOG ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION
#
# A test case for Bug#56540 "Exception (crash) in sql_show.cc
# during rqg_info_schema test on Windows"
@@ -1846,9 +1936,10 @@ 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;
-# --> connection con1
+connect con1, localhost, root,,;
+connection con1;
flush tables;
-# --> connection default
+connection default;
select * from information_schema.views;
TABLE_CATALOG def
TABLE_SCHEMA test
@@ -1869,9 +1960,10 @@ unlock tables;
#
# Cleanup.
#
-# --> connection con1
+connection con1;
# Reaping 'flush tables'
-# --> connection default
+disconnect con1;
+connection default;
drop table t1;
drop view v1;
#
@@ -1897,47 +1989,33 @@ create table t2 (k int);
# Acquire lock on 't2' so upcoming RENAME is
# blocked.
lock tables t2 read;
-#
-# Switching to connection 'con12828477_1'.
-#
+connect con12828477_1, localhost, root,,mysqltest;
# The below RENAME should wait on 't2' while
# keeping X lock on 't1'.
rename table t1 to t3, t2 to t1, t3 to t2;
-#
-# Switching to connection 'con12828477_2'.
-#
+connect con12828477_2, localhost, root,,mysqltest;
# Wait while the above RENAME is blocked.
# Issue query to I_S which will open 't0' and get
# blocked on 't1' because of RENAME.
select table_name, auto_increment from information_schema.tables where table_schema='mysqltest';
-#
-# Switching to connection 'con12828477_3'.
-#
+connect con12828477_3, localhost, root,,mysqltest;
# Wait while the above SELECT is blocked.
#
# Check that it holds no lock on 't0' so it can be renamed.
rename table t0 to t4;
-#
-# Switching to connection 'default'.
-#
+connection default;
#
# Unblock the first RENAME.
unlock tables;
-#
-# Switching to connection 'con12828477_1'.
-#
+connection con12828477_1;
# Reap the first RENAME
-#
-# Switching to connection 'con12828477_2'.
-#
+connection con12828477_2;
# Reap SELECT to I_S.
table_name auto_increment
t0 NULL
t1 NULL
t2 NULL
-#
-# Switching to connection 'default'.
-#
+connection default;
#
# Now test that we don't keep locks in case when we to fill
# I_S table we read .FRM or .TRG file only (this was the case
@@ -1947,44 +2025,33 @@ rename table t4 to t0;
# Acquire lock on 't2' so upcoming RENAME is
# blocked.
lock tables t2 read;
-#
-# Switching to connection 'con12828477_1'.
-#
+connection con12828477_1;
# The below RENAME should wait on 't2' while
# keeping X lock on 't1'.
rename table t1 to t3, t2 to t1, t3 to t2;
-#
-# Switching to connection 'con12828477_2'.
-#
+connection con12828477_2;
# Wait while the above RENAME is blocked.
# Issue query to I_S which will open 't0' and get
# blocked on 't1' because of RENAME.
select event_object_table, trigger_name from information_schema.triggers where event_object_schema='mysqltest';
-#
-# Switching to connection 'con12828477_3'.
-#
+connection con12828477_3;
# Wait while the above SELECT is blocked.
#
# Check that it holds no lock on 't0' so it can be renamed.
rename table t0 to t4;
-#
-# Switching to connection 'default'.
-#
+connection default;
#
# Unblock the first RENAME.
unlock tables;
-#
-# Switching to connection 'con12828477_1'.
-#
+connection con12828477_1;
# Reap the first RENAME
-#
-# Switching to connection 'con12828477_2'.
-#
+connection con12828477_2;
# Reap SELECT to I_S.
event_object_table trigger_name
-#
-# Switching to connection 'default'.
-#
+connection default;
+disconnect con12828477_1;
+disconnect con12828477_2;
+disconnect con12828477_3;
#
# MDEV-3818: Query against view over IS tables worse than equivalent query without view
#
@@ -1995,7 +2062,7 @@ where (table_schema = "osm") and (table_name = "test");
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE columns ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL NULL Using where; Open_frm_only; Scanned 0 databases
Warnings:
-Note 1003 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'))
+Note 1003 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'
explain extended
select information_schema.columns.column_name as column_name
from information_schema.columns
@@ -2003,7 +2070,7 @@ where (information_schema.columns.table_schema = 'osm') and (information_schema.
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE columns ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL NULL Using where; Open_frm_only; Scanned 0 databases
Warnings:
-Note 1003 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'))
+Note 1003 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;
#
# Clean-up.
@@ -2030,6 +2097,8 @@ SELECT @val1 = @val2;
# MDEV-5723: mysqldump -uroot unusable for multi-database operations, checks all databases
#
drop database if exists db1;
+connect con1,localhost,root,,;
+connection con1;
create database db1;
use db1;
create table t1 (a int);
@@ -2068,6 +2137,8 @@ Variable_name Value
Opened_tables 3
drop database mysqltest;
drop database db1;
+connection default;
+disconnect con1;
set global sql_mode=default;
USE test;
#
diff --git a/mysql-test/r/information_schema_all_engines.result b/mysql-test/r/information_schema_all_engines.result
index 7f79dd883e2..126a6f4bccd 100644
--- a/mysql-test/r/information_schema_all_engines.result
+++ b/mysql-test/r/information_schema_all_engines.result
@@ -17,13 +17,17 @@ GEOMETRY_COLUMNS
GLOBAL_STATUS
GLOBAL_VARIABLES
INDEX_STATISTICS
-INNODB_CHANGED_PAGES
+INNODB_BUFFER_PAGE
+INNODB_BUFFER_PAGE_LRU
+INNODB_BUFFER_POOL_STATS
INNODB_CMP
INNODB_CMPMEM
INNODB_CMPMEM_RESET
INNODB_CMP_PER_INDEX
INNODB_CMP_RESET
+INNODB_LOCKS
INNODB_LOCK_WAITS
+INNODB_METRICS
INNODB_MUTEXES
INNODB_SYS_COLUMNS
INNODB_SYS_FIELDS
@@ -32,6 +36,7 @@ INNODB_SYS_FOREIGN_COLS
INNODB_SYS_INDEXES
INNODB_SYS_TABLES
INNODB_SYS_TABLESTATS
+INNODB_SYS_VIRTUAL
INNODB_TABLESPACES_ENCRYPTION
INNODB_TABLESPACES_SCRUBBING
INNODB_TRX
@@ -91,13 +96,17 @@ GEOMETRY_COLUMNS F_TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
INDEX_STATISTICS TABLE_SCHEMA
-INNODB_CHANGED_PAGES space_id
+INNODB_BUFFER_PAGE POOL_ID
+INNODB_BUFFER_PAGE_LRU POOL_ID
+INNODB_BUFFER_POOL_STATS POOL_ID
INNODB_CMP page_size
INNODB_CMPMEM page_size
INNODB_CMPMEM_RESET page_size
INNODB_CMP_PER_INDEX database_name
INNODB_CMP_RESET page_size
+INNODB_LOCKS lock_id
INNODB_LOCK_WAITS requesting_trx_id
+INNODB_METRICS NAME
INNODB_MUTEXES NAME
INNODB_SYS_COLUMNS TABLE_ID
INNODB_SYS_FIELDS INDEX_ID
@@ -106,6 +115,7 @@ INNODB_SYS_FOREIGN_COLS ID
INNODB_SYS_INDEXES INDEX_ID
INNODB_SYS_TABLES TABLE_ID
INNODB_SYS_TABLESTATS TABLE_ID
+INNODB_SYS_VIRTUAL TABLE_ID
INNODB_TABLESPACES_ENCRYPTION SPACE
INNODB_TABLESPACES_SCRUBBING SPACE
INNODB_TRX trx_id
@@ -165,13 +175,17 @@ GEOMETRY_COLUMNS F_TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
INDEX_STATISTICS TABLE_SCHEMA
-INNODB_CHANGED_PAGES space_id
+INNODB_BUFFER_PAGE POOL_ID
+INNODB_BUFFER_PAGE_LRU POOL_ID
+INNODB_BUFFER_POOL_STATS POOL_ID
INNODB_CMP page_size
INNODB_CMPMEM page_size
INNODB_CMPMEM_RESET page_size
INNODB_CMP_PER_INDEX database_name
INNODB_CMP_RESET page_size
+INNODB_LOCKS lock_id
INNODB_LOCK_WAITS requesting_trx_id
+INNODB_METRICS NAME
INNODB_MUTEXES NAME
INNODB_SYS_COLUMNS TABLE_ID
INNODB_SYS_FIELDS INDEX_ID
@@ -180,6 +194,7 @@ INNODB_SYS_FOREIGN_COLS ID
INNODB_SYS_INDEXES INDEX_ID
INNODB_SYS_TABLES TABLE_ID
INNODB_SYS_TABLESTATS TABLE_ID
+INNODB_SYS_VIRTUAL TABLE_ID
INNODB_TABLESPACES_ENCRYPTION SPACE
INNODB_TABLESPACES_SCRUBBING SPACE
INNODB_TRX trx_id
@@ -244,13 +259,17 @@ GEOMETRY_COLUMNS information_schema.GEOMETRY_COLUMNS 1
GLOBAL_STATUS information_schema.GLOBAL_STATUS 1
GLOBAL_VARIABLES information_schema.GLOBAL_VARIABLES 1
INDEX_STATISTICS information_schema.INDEX_STATISTICS 1
-INNODB_CHANGED_PAGES information_schema.INNODB_CHANGED_PAGES 1
+INNODB_BUFFER_PAGE information_schema.INNODB_BUFFER_PAGE 1
+INNODB_BUFFER_PAGE_LRU information_schema.INNODB_BUFFER_PAGE_LRU 1
+INNODB_BUFFER_POOL_STATS information_schema.INNODB_BUFFER_POOL_STATS 1
INNODB_CMP information_schema.INNODB_CMP 1
INNODB_CMPMEM information_schema.INNODB_CMPMEM 1
INNODB_CMPMEM_RESET information_schema.INNODB_CMPMEM_RESET 1
INNODB_CMP_PER_INDEX information_schema.INNODB_CMP_PER_INDEX 1
INNODB_CMP_RESET information_schema.INNODB_CMP_RESET 1
+INNODB_LOCKS information_schema.INNODB_LOCKS 1
INNODB_LOCK_WAITS information_schema.INNODB_LOCK_WAITS 1
+INNODB_METRICS information_schema.INNODB_METRICS 1
INNODB_MUTEXES information_schema.INNODB_MUTEXES 1
INNODB_SYS_COLUMNS information_schema.INNODB_SYS_COLUMNS 1
INNODB_SYS_FIELDS information_schema.INNODB_SYS_FIELDS 1
@@ -259,6 +278,7 @@ INNODB_SYS_FOREIGN_COLS information_schema.INNODB_SYS_FOREIGN_COLS 1
INNODB_SYS_INDEXES information_schema.INNODB_SYS_INDEXES 1
INNODB_SYS_TABLES information_schema.INNODB_SYS_TABLES 1
INNODB_SYS_TABLESTATS information_schema.INNODB_SYS_TABLESTATS 1
+INNODB_SYS_VIRTUAL information_schema.INNODB_SYS_VIRTUAL 1
INNODB_TABLESPACES_ENCRYPTION information_schema.INNODB_TABLESPACES_ENCRYPTION 1
INNODB_TABLESPACES_SCRUBBING information_schema.INNODB_TABLESPACES_SCRUBBING 1
INNODB_TRX information_schema.INNODB_TRX 1
@@ -308,13 +328,17 @@ Database: information_schema
| GLOBAL_STATUS |
| GLOBAL_VARIABLES |
| INDEX_STATISTICS |
-| INNODB_CHANGED_PAGES |
+| INNODB_BUFFER_PAGE |
+| INNODB_BUFFER_PAGE_LRU |
+| INNODB_BUFFER_POOL_STATS |
| INNODB_CMP |
| INNODB_CMPMEM |
| INNODB_CMPMEM_RESET |
| INNODB_CMP_PER_INDEX |
| INNODB_CMP_RESET |
+| INNODB_LOCKS |
| INNODB_LOCK_WAITS |
+| INNODB_METRICS |
| INNODB_MUTEXES |
| INNODB_SYS_COLUMNS |
| INNODB_SYS_FIELDS |
@@ -323,6 +347,7 @@ Database: information_schema
| INNODB_SYS_INDEXES |
| INNODB_SYS_TABLES |
| INNODB_SYS_TABLESTATS |
+| INNODB_SYS_VIRTUAL |
| INNODB_TABLESPACES_ENCRYPTION |
| INNODB_TABLESPACES_SCRUBBING |
| INNODB_TRX |
@@ -372,13 +397,17 @@ Database: INFORMATION_SCHEMA
| GLOBAL_STATUS |
| GLOBAL_VARIABLES |
| INDEX_STATISTICS |
-| INNODB_CHANGED_PAGES |
+| INNODB_BUFFER_PAGE |
+| INNODB_BUFFER_PAGE_LRU |
+| INNODB_BUFFER_POOL_STATS |
| INNODB_CMP |
| INNODB_CMPMEM |
| INNODB_CMPMEM_RESET |
| INNODB_CMP_PER_INDEX |
| INNODB_CMP_RESET |
+| INNODB_LOCKS |
| INNODB_LOCK_WAITS |
+| INNODB_METRICS |
| INNODB_MUTEXES |
| INNODB_SYS_COLUMNS |
| INNODB_SYS_FIELDS |
@@ -387,6 +416,7 @@ Database: INFORMATION_SCHEMA
| INNODB_SYS_INDEXES |
| INNODB_SYS_TABLES |
| INNODB_SYS_TABLESTATS |
+| INNODB_SYS_VIRTUAL |
| INNODB_TABLESPACES_ENCRYPTION |
| INNODB_TABLESPACES_SCRUBBING |
| INNODB_TRX |
@@ -423,5 +453,5 @@ Wildcard: inf_rmation_schema
| information_schema |
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA;
table_schema count(*)
-information_schema 59
+information_schema 64
mysql 30
diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result
index c09e04f786a..ca1ab45b98b 100644
--- a/mysql-test/r/information_schema_db.result
+++ b/mysql-test/r/information_schema_db.result
@@ -38,10 +38,13 @@ 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;
select * from information_schema.tables;
call mbase.p1();
call mbase.p1();
call mbase.p1();
+connection default;
use `inf%`;
drop user mysqltest_1@localhost;
drop table t1;
@@ -59,6 +62,7 @@ drop function func2;
drop database `inf%`;
drop procedure mbase.p1;
drop database mbase;
+disconnect user1;
use test;
create table t1 (i int);
create function f1 () returns int return (select max(i) from t1);
@@ -87,6 +91,7 @@ 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;
@@ -95,6 +100,7 @@ create view v5 as select f1 from t1;
grant select, show view on v5 to testdb_2@localhost;
create definer=`no_such_user`@`no_such_host` view v6 as select f1 from t1;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
+connection default;
use testdb_1;
create view v6 as select f1 from t1;
grant select, show view on v6 to testdb_2@localhost;
@@ -118,9 +124,11 @@ Field Type Null Key Default Extra
f1 char(4) YES NULL
Warnings:
Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
+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;
@@ -135,6 +143,7 @@ f1 char(4) YES NULL
show create view testdb_1.v6;
View Create View character_set_client collation_connection
v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v6` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1` latin1 latin1_swedish_ci
+connection testdb_1;
show fields from testdb_1.v7;
Field Type Null Key Default Extra
f1 char(4) YES NULL
@@ -147,8 +156,10 @@ Warnings:
Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
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;
show fields from testdb_1.v5;
ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v5'
show create view testdb_1.v5;
@@ -192,9 +203,15 @@ where a.table_name = 'testdb_1.v1';
view_definition
select * from v2;
ERROR HY000: View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+connection default;
use test;
drop view testdb_1.v1, v2, testdb_1.v3, v4;
drop database testdb_1;
+connection testdb_1;
+disconnect testdb_1;
+connection testdb_2;
+disconnect testdb_2;
+connection default;
drop user testdb_1@localhost;
drop user testdb_2@localhost;
create database testdb_1;
@@ -202,6 +219,8 @@ 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';
table_schema table_name view_definition
@@ -209,13 +228,19 @@ testdb_1 v1 select `testdb_1`.`t1`.`a` AS `a` from `testdb_1`.`t1`
show create view testdb_1.v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v1` AS select `testdb_1`.`t1`.`a` AS `a` from `testdb_1`.`t1` latin1 latin1_swedish_ci
+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';
table_schema table_name view_definition
testdb_1 v1
show create view testdb_1.v1;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v1'
+connection default;
drop user mysqltest_1@localhost;
drop database testdb_1;
+connection user1;
+disconnect user1;
+connection default;
set global sql_mode=default;
diff --git a/mysql-test/r/information_schema_linux.result b/mysql-test/r/information_schema_linux.result
index 43095b76151..b4b7de7bc65 100644
--- a/mysql-test/r/information_schema_linux.result
+++ b/mysql-test/r/information_schema_linux.result
@@ -2,6 +2,9 @@
# MDEV-6756: map a linux pid (child pid) to a connection id shown in
# the output of SHOW PROCESSLIST
#
+connect con1,localhost,root;
SELECT max(tid) != min(tid) FROM information_schema.processlist;
max(tid) != min(tid)
1
+connection default;
+disconnect con1;
diff --git a/mysql-test/r/information_schema_parameters.result b/mysql-test/r/information_schema_parameters.result
index 93c7634a910..1d974851133 100644
--- a/mysql-test/r/information_schema_parameters.result
+++ b/mysql-test/r/information_schema_parameters.result
@@ -6,7 +6,7 @@ PARAMETERS CREATE TEMPORARY TABLE `PARAMETERS` (
`SPECIFIC_CATALOG` varchar(512) NOT NULL DEFAULT '',
`SPECIFIC_SCHEMA` varchar(64) NOT NULL DEFAULT '',
`SPECIFIC_NAME` varchar(64) NOT NULL DEFAULT '',
- `ORDINAL_POSITION` int(21) NOT NULL DEFAULT '0',
+ `ORDINAL_POSITION` int(21) NOT NULL DEFAULT 0,
`PARAMETER_MODE` varchar(5) DEFAULT NULL,
`PARAMETER_NAME` varchar(64) DEFAULT NULL,
`DATA_TYPE` varchar(64) NOT NULL DEFAULT '',
@@ -17,7 +17,7 @@ PARAMETERS CREATE TEMPORARY TABLE `PARAMETERS` (
`DATETIME_PRECISION` bigint(21) unsigned DEFAULT NULL,
`CHARACTER_SET_NAME` varchar(64) DEFAULT NULL,
`COLLATION_NAME` varchar(64) DEFAULT NULL,
- `DTD_IDENTIFIER` longtext NOT NULL,
+ `DTD_IDENTIFIER` longtext NOT NULL DEFAULT '',
`ROUTINE_TYPE` varchar(9) NOT NULL DEFAULT ''
) DEFAULT CHARSET=utf8
SELECT * FROM information_schema.columns
@@ -29,7 +29,7 @@ TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME SPECIFIC_CATALOG
ORDINAL_POSITION 1
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 512
@@ -44,12 +44,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME SPECIFIC_SCHEMA
ORDINAL_POSITION 2
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 64
@@ -64,12 +66,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME SPECIFIC_NAME
ORDINAL_POSITION 3
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 64
@@ -84,6 +88,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
@@ -104,6 +110,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
@@ -124,6 +132,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
@@ -144,12 +154,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME DATA_TYPE
ORDINAL_POSITION 7
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 64
@@ -164,6 +176,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
@@ -184,6 +198,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
@@ -204,6 +220,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
@@ -224,6 +242,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
@@ -244,6 +264,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
@@ -264,6 +286,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
@@ -284,6 +308,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
@@ -304,12 +330,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME DTD_IDENTIFIER
ORDINAL_POSITION 15
-COLUMN_DEFAULT NULL
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE longtext
CHARACTER_MAXIMUM_LENGTH 4294967295
@@ -324,12 +352,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME ROUTINE_TYPE
ORDINAL_POSITION 16
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 9
@@ -344,6 +374,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
DESCRIBE INFORMATION_SCHEMA.PARAMETERS;
Field Type Null Key Default Extra
SPECIFIC_CATALOG varchar(512) NO
@@ -360,7 +392,7 @@ NUMERIC_SCALE int(21) YES NULL
DATETIME_PRECISION bigint(21) unsigned YES NULL
CHARACTER_SET_NAME varchar(64) YES NULL
COLLATION_NAME varchar(64) YES NULL
-DTD_IDENTIFIER longtext NO NULL
+DTD_IDENTIFIER longtext NO
ROUTINE_TYPE varchar(9) NO
# ========== parameters.2 ==========
DROP DATABASE IF EXISTS i_s_parameters_test;
diff --git a/mysql-test/r/information_schema_part.result b/mysql-test/r/information_schema_part.result
index 77959de256e..081631a512f 100644
--- a/mysql-test/r/information_schema_part.result
+++ b/mysql-test/r/information_schema_part.result
@@ -7,9 +7,9 @@ partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
select * from information_schema.partitions where table_schema="test"
and table_name="t1";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
-def test t1 x1 NULL 1 NULL LIST NULL b*a NULL 1 0 0 0 # 1024 0 # # NULL NULL default ts1
-def test t1 x2 NULL 2 NULL LIST NULL b*a NULL 3,11,5,7 0 0 0 # 1024 0 # # NULL NULL default ts2
-def test t1 x3 NULL 3 NULL LIST NULL b*a NULL 16,8,24,27 0 0 0 # 1024 0 # # NULL NULL default ts3
+def test t1 x1 NULL 1 NULL LIST NULL `b` * `a` NULL 1 0 0 0 # 1024 0 # # NULL NULL default ts1
+def test t1 x2 NULL 2 NULL LIST NULL `b` * `a` NULL 3,11,5,7 0 0 0 # 1024 0 # # NULL NULL default ts2
+def test t1 x3 NULL 3 NULL LIST NULL `b` * `a` NULL 16,8,24,27 0 0 0 # 1024 0 # # NULL NULL default ts3
create table t2 (a int not null,b int not null,c int not null, primary key(a,b))
partition by range (a)
partitions 3
@@ -19,18 +19,18 @@ partition x3 values less than maxvalue tablespace ts3);
select * from information_schema.partitions where table_schema="test"
and table_name="t2";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
-def test t2 x1 NULL 1 NULL RANGE NULL a NULL 5 0 0 0 # 1024 0 # # NULL NULL default ts1
-def test t2 x2 NULL 2 NULL RANGE NULL a NULL 10 0 0 0 # 1024 0 # # NULL NULL default ts2
-def test t2 x3 NULL 3 NULL RANGE NULL a NULL MAXVALUE 0 0 0 # 1024 0 # # NULL NULL default ts3
+def test t2 x1 NULL 1 NULL RANGE NULL `a` NULL 5 0 0 0 # 1024 0 # # NULL NULL default ts1
+def test t2 x2 NULL 2 NULL RANGE NULL `a` NULL 10 0 0 0 # 1024 0 # # NULL NULL default ts2
+def test t2 x3 NULL 3 NULL RANGE NULL `a` NULL MAXVALUE 0 0 0 # 1024 0 # # NULL NULL default ts3
create table t3 (f1 date)
partition by hash(month(f1))
partitions 3;
select * from information_schema.partitions where table_schema="test"
and table_name="t3";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
-def test t3 p0 NULL 1 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
-def test t3 p1 NULL 2 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
-def test t3 p2 NULL 3 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
+def test t3 p0 NULL 1 NULL HASH NULL month(`f1`) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
+def test t3 p1 NULL 2 NULL HASH NULL month(`f1`) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
+def test t3 p2 NULL 3 NULL HASH NULL month(`f1`) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
create table t4 (f1 date, f2 int)
partition by key(f1,f2)
partitions 3;
@@ -63,14 +63,14 @@ subpartition x22 tablespace t2)
);
select * from information_schema.partitions where table_schema="test";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
-def test t1 x1 x11 1 1 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default t1
-def test t1 x1 x12 1 2 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default t2
-def test t1 x2 x21 2 1 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default t1
-def test t1 x2 x22 2 2 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default t2
-def test t2 x1 x11 1 1 RANGE KEY a `a` 1 0 0 0 # 1024 0 # # NULL NULL default t1
-def test t2 x1 x12 1 2 RANGE KEY a `a` 1 0 0 0 # 1024 0 # # NULL NULL default t2
-def test t2 x2 x21 2 1 RANGE KEY a `a` 5 0 0 0 # 1024 0 # # NULL NULL default t1
-def test t2 x2 x22 2 2 RANGE KEY a `a` 5 0 0 0 # 1024 0 # # NULL NULL default t2
+def test t1 x1 x11 1 1 RANGE HASH `a` `a` + `b` 1 0 0 0 # 1024 0 # # NULL NULL default t1
+def test t1 x1 x12 1 2 RANGE HASH `a` `a` + `b` 1 0 0 0 # 1024 0 # # NULL NULL default t2
+def test t1 x2 x21 2 1 RANGE HASH `a` `a` + `b` 5 0 0 0 # 1024 0 # # NULL NULL default t1
+def test t1 x2 x22 2 2 RANGE HASH `a` `a` + `b` 5 0 0 0 # 1024 0 # # NULL NULL default t2
+def test t2 x1 x11 1 1 RANGE KEY `a` `a` 1 0 0 0 # 1024 0 # # NULL NULL default t1
+def test t2 x1 x12 1 2 RANGE KEY `a` `a` 1 0 0 0 # 1024 0 # # NULL NULL default t2
+def test t2 x2 x21 2 1 RANGE KEY `a` `a` 5 0 0 0 # 1024 0 # # NULL NULL default t1
+def test t2 x2 x22 2 2 RANGE KEY `a` `a` 5 0 0 0 # 1024 0 # # NULL NULL default t2
drop table t1,t2;
create table t1 (
a int not null,
@@ -88,10 +88,10 @@ subpartition x22 tablespace t2 nodegroup 1)
);
select * from information_schema.partitions where table_schema="test";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
-def test t1 x1 x11 1 1 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL 0 t1
-def test t1 x1 x12 1 2 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL 1 t2
-def test t1 x2 x21 2 1 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL 0 t1
-def test t1 x2 x22 2 2 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL 1 t2
+def test t1 x1 x11 1 1 RANGE HASH `a` `a` + `b` 1 0 0 0 # 1024 0 # # NULL NULL 0 t1
+def test t1 x1 x12 1 2 RANGE HASH `a` `a` + `b` 1 0 0 0 # 1024 0 # # NULL NULL 1 t2
+def test t1 x2 x21 2 1 RANGE HASH `a` `a` + `b` 5 0 0 0 # 1024 0 # # NULL NULL 0 t1
+def test t1 x2 x22 2 2 RANGE HASH `a` `a` + `b` 5 0 0 0 # 1024 0 # # NULL NULL 1 t2
show tables;
Tables_in_test
t1
@@ -107,9 +107,9 @@ partitions 3;
select * from information_schema.partitions where table_schema="test"
and table_name="t1";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
-def test t1 p0 NULL 1 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
-def test t1 p1 NULL 2 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
-def test t1 p2 NULL 3 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
+def test t1 p0 NULL 1 NULL LINEAR HASH NULL month(`f1`) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
+def test t1 p1 NULL 2 NULL LINEAR HASH NULL month(`f1`) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
+def test t1 p2 NULL 3 NULL LINEAR HASH NULL month(`f1`) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
drop table t1;
create table t1 (a int)
PARTITION BY RANGE (a)
@@ -120,9 +120,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-SUBPARTITION BY LINEAR HASH (a)
-(PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+SUBPARTITION BY LINEAR HASH (`a`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM)
select SUBPARTITION_METHOD FROM information_schema.partitions WHERE
table_schema="test" AND table_name="t1";
SUBPARTITION_METHOD
@@ -138,8 +138,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST (a)
-(PARTITION p0 VALUES IN (10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53) ENGINE = MyISAM) */
+ PARTITION BY LIST (`a`)
+(PARTITION `p0` VALUES IN (10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53) ENGINE = MyISAM)
SELECT PARTITION_DESCRIPTION FROM information_schema.partitions WHERE
table_schema = "test" AND table_name = "t1";
PARTITION_DESCRIPTION
diff --git a/mysql-test/r/information_schema_routines.result b/mysql-test/r/information_schema_routines.result
index 65e352e3af3..0d83f3a2bda 100644
--- a/mysql-test/r/information_schema_routines.result
+++ b/mysql-test/r/information_schema_routines.result
@@ -18,9 +18,9 @@ ROUTINES CREATE TEMPORARY TABLE `ROUTINES` (
`DATETIME_PRECISION` bigint(21) unsigned DEFAULT NULL,
`CHARACTER_SET_NAME` varchar(64) DEFAULT NULL,
`COLLATION_NAME` varchar(64) DEFAULT NULL,
- `DTD_IDENTIFIER` longtext,
+ `DTD_IDENTIFIER` longtext DEFAULT NULL,
`ROUTINE_BODY` varchar(8) NOT NULL DEFAULT '',
- `ROUTINE_DEFINITION` longtext,
+ `ROUTINE_DEFINITION` longtext DEFAULT NULL,
`EXTERNAL_NAME` varchar(64) DEFAULT NULL,
`EXTERNAL_LANGUAGE` varchar(64) DEFAULT NULL,
`PARAMETER_STYLE` varchar(8) NOT NULL DEFAULT '',
@@ -31,7 +31,7 @@ ROUTINES CREATE TEMPORARY TABLE `ROUTINES` (
`CREATED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`LAST_ALTERED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`SQL_MODE` varchar(8192) NOT NULL DEFAULT '',
- `ROUTINE_COMMENT` longtext NOT NULL,
+ `ROUTINE_COMMENT` longtext NOT NULL DEFAULT '',
`DEFINER` varchar(189) NOT NULL DEFAULT '',
`CHARACTER_SET_CLIENT` varchar(32) NOT NULL DEFAULT '',
`COLLATION_CONNECTION` varchar(32) NOT NULL DEFAULT '',
@@ -46,7 +46,7 @@ TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME SPECIFIC_NAME
ORDINAL_POSITION 1
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 64
@@ -61,12 +61,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_CATALOG
ORDINAL_POSITION 2
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 512
@@ -81,12 +83,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_SCHEMA
ORDINAL_POSITION 3
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 64
@@ -101,12 +105,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_NAME
ORDINAL_POSITION 4
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 64
@@ -121,12 +127,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_TYPE
ORDINAL_POSITION 5
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 9
@@ -141,12 +149,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME DATA_TYPE
ORDINAL_POSITION 6
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 64
@@ -161,6 +171,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
@@ -181,6 +193,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
@@ -201,6 +215,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
@@ -221,6 +237,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
@@ -241,6 +259,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
@@ -261,6 +281,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
@@ -281,6 +303,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
@@ -301,6 +325,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
@@ -321,12 +347,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_BODY
ORDINAL_POSITION 15
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 8
@@ -341,6 +369,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
@@ -361,6 +391,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
@@ -381,6 +413,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
@@ -401,12 +435,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME PARAMETER_STYLE
ORDINAL_POSITION 19
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 8
@@ -421,12 +457,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME IS_DETERMINISTIC
ORDINAL_POSITION 20
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 3
@@ -441,12 +479,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME SQL_DATA_ACCESS
ORDINAL_POSITION 21
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 64
@@ -461,6 +501,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
@@ -481,12 +523,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME SECURITY_TYPE
ORDINAL_POSITION 23
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 7
@@ -501,12 +545,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME CREATED
ORDINAL_POSITION 24
-COLUMN_DEFAULT 0000-00-00 00:00:00
+COLUMN_DEFAULT '0000-00-00 00:00:00'
IS_NULLABLE NO
DATA_TYPE datetime
CHARACTER_MAXIMUM_LENGTH NULL
@@ -521,12 +567,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME LAST_ALTERED
ORDINAL_POSITION 25
-COLUMN_DEFAULT 0000-00-00 00:00:00
+COLUMN_DEFAULT '0000-00-00 00:00:00'
IS_NULLABLE NO
DATA_TYPE datetime
CHARACTER_MAXIMUM_LENGTH NULL
@@ -541,12 +589,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME SQL_MODE
ORDINAL_POSITION 26
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 8192
@@ -561,12 +611,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_COMMENT
ORDINAL_POSITION 27
-COLUMN_DEFAULT NULL
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE longtext
CHARACTER_MAXIMUM_LENGTH 4294967295
@@ -581,12 +633,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME DEFINER
ORDINAL_POSITION 28
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 189
@@ -601,12 +655,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME CHARACTER_SET_CLIENT
ORDINAL_POSITION 29
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 32
@@ -621,12 +677,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME COLLATION_CONNECTION
ORDINAL_POSITION 30
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 32
@@ -641,12 +699,14 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
COLUMN_NAME DATABASE_COLLATION
ORDINAL_POSITION 31
-COLUMN_DEFAULT
+COLUMN_DEFAULT ''
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 32
@@ -661,6 +721,8 @@ COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
+IS_GENERATED NEVER
+GENERATION_EXPRESSION NULL
DESCRIBE INFORMATION_SCHEMA.ROUTINES;
Field Type Null Key Default Extra
SPECIFIC_NAME varchar(64) NO
@@ -689,7 +751,7 @@ SECURITY_TYPE varchar(7) NO
CREATED datetime NO 0000-00-00 00:00:00
LAST_ALTERED datetime NO 0000-00-00 00:00:00
SQL_MODE varchar(8192) NO
-ROUTINE_COMMENT longtext NO NULL
+ROUTINE_COMMENT longtext NO
DEFINER varchar(189) NO
CHARACTER_SET_CLIENT varchar(32) NO
COLLATION_CONNECTION varchar(32) NO
diff --git a/mysql-test/r/init_connect.result b/mysql-test/r/init_connect.result
index 0ff6c206422..11bb6036156 100644
--- a/mysql-test/r/init_connect.result
+++ b/mysql-test/r/init_connect.result
@@ -1,29 +1,51 @@
+connect con0,localhost,root,,;
+connection con0;
select hex(@a);
hex(@a)
NULL
+connect con1,localhost,user_1,,;
+connection con1;
select hex(@a);
hex(@a)
610063
+connection con0;
set global init_connect="set @a=2;set @b=3";
+connect con2,localhost,user_1,,;
+connection con2;
select @a, @b;
@a @b
2 3
+connection con0;
set GLOBAL init_connect=DEFAULT;
+connect con3,localhost,user_1,,;
+connection con3;
select @a;
@a
NULL
+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;
hex(a)
00
616263
+connection con0;
set GLOBAL init_connect="adsfsdfsdfs";
+connect con5,localhost,user_1,,;
+connection con5;
select @a;
ERROR 08S01: Aborted connection to db: 'test' user: 'user_1' host: 'localhost' (init_connect command failed)
select @a;
Got one of the listed errors
+connection con0;
drop table t1;
+disconnect con1;
+disconnect con2;
+disconnect con3;
+disconnect con4;
+disconnect con5;
End of 4.1 tests
create table t1 (x int);
insert into t1 values (3), (5), (7);
@@ -31,18 +53,24 @@ create table t2 (y int);
create user mysqltest1@localhost;
grant all privileges on test.* to mysqltest1@localhost;
set global init_connect="create procedure p1() select * from t1";
+connect con1,localhost,mysqltest1,,;
+connection con1;
call p1();
x
3
5
7
drop procedure p1;
+connection con0;
+disconnect con1;
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);
count(*)
3
@@ -53,13 +81,23 @@ x
select @x;
@x
42
+connection con0;
+disconnect con1;
set global init_connect="call p1(4711)";
+connect con1,localhost,mysqltest1,,;
+connection con1;
select @x;
@x
4711
+connection con0;
+disconnect con1;
set global init_connect="drop procedure if exists p1";
+connect con1,localhost,mysqltest1,,;
+connection con1;
call p1();
ERROR 42000: PROCEDURE test.p1 does not exist
+connection con0;
+disconnect con1;
create procedure p1(out sum int)
begin
declare n int default 0;
@@ -81,9 +119,13 @@ end;
end loop;
end|
set global init_connect="call p1(@sum)";
+connect con1,localhost,mysqltest1,,;
+connection con1;
select @sum;
@sum
12
+connection con0;
+disconnect con1;
drop procedure p1;
create procedure p1(tbl char(10), v int)
begin
@@ -94,12 +136,16 @@ execute stmt1 using @v;
deallocate prepare stmt1;
end|
set global init_connect="call p1('t1', 11)";
+connect con1,localhost,mysqltest1,,;
+connection con1;
select * from t1;
x
3
5
7
11
+connection con0;
+disconnect con1;
drop procedure p1;
create function f1() returns int
begin
@@ -108,22 +154,36 @@ select count(*) into n from t1;
return n;
end|
set global init_connect="set @x = f1()";
+connect con1,localhost,mysqltest1,,;
+connection con1;
select @x;
@x
4
+connection con0;
+disconnect con1;
set global init_connect="create view v1 as select f1()";
+connect con1,localhost,mysqltest1,,;
+connection con1;
select * from v1;
f1()
4
+connection con0;
+disconnect con1;
set global init_connect="drop view v1";
+connect con1,localhost,mysqltest1,,;
+connection con1;
select * from v1;
ERROR 42S02: Table 'test.v1' doesn't exist
+connection con0;
+disconnect con1;
drop function f1;
create trigger trg1
after insert on t2
for each row
insert into t1 values (new.y);
set global init_connect="insert into t2 values (13), (17), (19)";
+connect con1,localhost,mysqltest1,,;
+connection con1;
select * from t1;
x
3
@@ -133,6 +193,9 @@ x
13
17
19
+connection default;
+disconnect con0;
+disconnect con1;
drop trigger trg1;
set global init_connect="set @a='a\\0c'";
revoke all privileges, grant option from mysqltest1@localhost;
diff --git a/mysql-test/r/init_connection_query_cache.result b/mysql-test/r/init_connection_query_cache.result
index 5a1e5c5244f..eacc06c05f6 100644
--- a/mysql-test/r/init_connection_query_cache.result
+++ b/mysql-test/r/init_connection_query_cache.result
@@ -6,6 +6,8 @@ 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;
# This explain put here to be sure that init connection query
# has 'Impossible WHERE'.
explain extended select * from test.t1 where 0;
@@ -13,6 +15,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
+connection default;
+disconnect con1;
revoke all privileges, grant option from mysqltest1@localhost;
drop user mysqltest1@localhost;
drop table t1;
diff --git a/mysql-test/r/innodb_ext_key.result b/mysql-test/r/innodb_ext_key.result
index de1323e00f8..c55e8d138f8 100644
--- a/mysql-test/r/innodb_ext_key.result
+++ b/mysql-test/r/innodb_ext_key.result
@@ -1136,10 +1136,6 @@ drop table t0,t1,t2;
#
# MDEV-11196: Error:Run-Time Check Failure #2 - Stack around the variable 'key_buff'
# was corrupted, server crashes in opt_sum_query
-set @save_innodb_file_format= @@innodb_file_format;
-set @save_innodb_large_prefix= @@innodb_large_prefix;
-set global innodb_file_format = BARRACUDA;
-set global innodb_large_prefix = ON;
CREATE TABLE t1 (
pk INT,
f1 VARCHAR(3),
@@ -1176,8 +1172,8 @@ EXPLAIN
"used_key_parts": ["f2", "pk1"],
"rows": 1,
"filtered": 100,
- "index_condition": "((t1.pk1 <= 5) and (t1.pk2 <= 5) and (t1.f2 = 'abc'))",
- "attached_condition": "(t1.f1 <= '3')"
+ "index_condition": "t1.pk1 <= 5 and t1.pk2 <= 5 and t1.f2 = 'abc'",
+ "attached_condition": "t1.f1 <= '3'"
}
}
}
@@ -1206,13 +1202,9 @@ EXPLAIN
"used_key_parts": ["pk1", "f2", "pk2"],
"rows": 1,
"filtered": 100,
- "index_condition": "((t1.f2 <= 5) and (t1.pk2 <= 5) and (t1.pk1 = 'abc'))",
- "attached_condition": "(t1.f1 <= '3')"
+ "index_condition": "t1.f2 <= 5 and t1.pk2 <= 5 and t1.pk1 = 'abc'",
+ "attached_condition": "t1.f1 <= '3'"
}
}
}
drop table t1;
-set optimizer_switch=@save_ext_key_optimizer_switch;
-set global innodb_file_format = @save_innodb_file_format;
-set global innodb_large_prefix = @save_innodb_large_prefix;
-SET SESSION STORAGE_ENGINE=DEFAULT;
diff --git a/mysql-test/r/innodb_icp.result b/mysql-test/r/innodb_icp.result
index a5215bf9f0d..8a58a769ed9 100644
--- a/mysql-test/r/innodb_icp.result
+++ b/mysql-test/r/innodb_icp.result
@@ -409,7 +409,7 @@ WHERE (pk BETWEEN 4 AND 5 OR pk < 2) AND c1 < 240
ORDER BY c1
LIMIT 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range PRIMARY,k1 k1 5 NULL 3 Using where; Using index
+1 SIMPLE t1 range PRIMARY,k1 k1 5 NULL 4 Using where; Using index
DROP TABLE t1;
#
#
@@ -474,7 +474,7 @@ CREATE TABLE t2 (
t2_int int PRIMARY KEY,
t2_int2 INT
);
-INSERT INTO t2 VALUES ();
+INSERT IGNORE INTO t2 VALUES ();
INSERT INTO t1 VALUES ();
SELECT * FROM t1 AS t1a
WHERE NOT EXISTS (SELECT * FROM t1 AS t1b
@@ -568,7 +568,7 @@ COL1000 VARBINARY(179) NOT NULL,
col1003 DATE DEFAULT NULL,
KEY idx4267 (col1000, col1003)
);
-INSERT INTO t1 VALUES (),();
+INSERT IGNORE INTO t1 VALUES (),();
Warnings:
Warning 1364 Field 'col999' doesn't have a default value
Warning 1364 Field 'COL1000' doesn't have a default value
@@ -722,8 +722,8 @@ b INT, c INT, d DATE NOT NULL, e VARCHAR(1),
KEY (c), KEY (d), KEY k2(b), KEY k3(b), KEY k4(b)
);
Warnings:
-Note 1831 Duplicate index `k3`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `k4`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `k3`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `k4`. This is deprecated and will be disallowed in a future release
INSERT INTO t1 (b,c,d,e) VALUES
(6,5,'2006-05-25','y'),(1,5,'2008-01-23','t'),
(6,5,'2007-06-18','d'),(4,5,'1900-01-01','r'),
@@ -849,7 +849,7 @@ Handler_icp_attempts 2
Handler_icp_match 1
DROP TABLE t1;
create table t1 (a int,b char(5),primary key (a), key (b(1)));
-insert into t1 values ('a','b');
+insert ignore into t1 values ('a','b');
Warnings:
Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1
select 1 from t1 where a and b >= 'aa';
diff --git a/mysql-test/r/innodb_mysql_lock.result b/mysql-test/r/innodb_mysql_lock.result
index 70b86017008..584ab19b2ee 100644
--- a/mysql-test/r/innodb_mysql_lock.result
+++ b/mysql-test/r/innodb_mysql_lock.result
@@ -1,33 +1,44 @@
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");
#
# Bug #22876 Four-way deadlock
#
DROP TABLE IF EXISTS t1;
-# Connection 1
+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 2
+connection con2;
set @@autocommit=0;
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (1);
-# Connection 3
+connection con3;
set @@autocommit=0;
DROP TABLE t1;
-# Connection 1
+connection con1;
# Connection 1 is now holding the lock.
# Issuing insert from connection 1 while connection 2&3
# is waiting for the lock should give a deadlock error.
INSERT INTO t1 VALUES (2);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
# Cleanup
+connection con2;
commit;
set @@autocommit=1;
+connection con1;
commit;
set @@autocommit=1;
+connection con3;
set @@autocommit=1;
+connection default;
+disconnect con1;
+disconnect con2;
+disconnect con3;
#
# Test for bug #37346 "innodb does not detect deadlock between update
# and alter table".
@@ -39,14 +50,15 @@ begin;
# Run statement which acquires X-lock on one of table's rows.
update t1 set c3=c3+1 where c2=3;
#
-# Switching to connection 'con37346'.
+connect con37346,localhost,root,,test,,;
+connection con37346;
# The below ALTER TABLE statement should wait till transaction
# in connection 'default' is complete and then succeed.
# It should not deadlock or fail with ER_LOCK_DEADLOCK error.
# Sending:
alter table t1 add column c4 int;;
#
-# Switching to connection 'default'.
+connection default;
# Wait until the above ALTER TABLE gets blocked because this
# connection holds SW metadata lock on table to be altered.
# The below statement should succeed. It should not
@@ -55,69 +67,42 @@ update t1 set c3=c3+1 where c2=4;
# Unblock ALTER TABLE by committing transaction.
commit;
#
-# Switching to connection 'con37346'.
+connection con37346;
# Reaping ALTER TABLE.
#
-# Switching to connection 'default'.
+connection default;
+disconnect con37346;
drop table t1;
#
-# Bug #42147 Concurrent DML and LOCK TABLE ... READ for InnoDB
-# table cause warnings in errlog
-#
-#
-# Note that this test for now relies on a global suppression of
-# the warning "Found lock of type 6 that is write and read locked"
-# This suppression rule can be removed once Bug#42147 is properly
-# fixed. See bug page for more info.
-#
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (i INT) engine= innodb;
-# Connection 2
-# Get user-level lock
-SELECT get_lock('bug42147_lock', 60);
-get_lock('bug42147_lock', 60)
-1
-# Connection 1
-INSERT INTO t1 SELECT get_lock('bug42147_lock', 60);
-# Connection 2
-LOCK TABLES t1 READ;
-SELECT release_lock('bug42147_lock');
-release_lock('bug42147_lock')
-1
-# Connection 1
-# Connection 2
-UNLOCK TABLES;
-# Connection 1
-DROP TABLE t1;
-#
# Bug#53798 OPTIMIZE TABLE breaks repeatable read
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT) engine=innodb;
INSERT INTO t1 VALUES (1), (2), (3);
-# Connection con1
+connect con1, localhost, root;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
SELECT * FROM t1;
a
1
2
3
-# Connection default
+connection default;
# This should block
# Sending:
OPTIMIZE TABLE t1;
-# Connection con1
+connection con1;
SELECT * FROM t1;
a
1
2
3
COMMIT;
-# Connection default
+connection default;
# Reaping OPTIMIZE TABLE t1
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
+disconnect con1;
DROP TABLE t1;
#
# Bug#49891 View DDL breaks REPEATABLE READ
@@ -127,52 +112,58 @@ DROP VIEW IF EXISTS v2;
CREATE TABLE t1 ( f1 INTEGER ) ENGINE = innodb;
CREATE TABLE t2 ( f1 INTEGER );
CREATE VIEW v1 AS SELECT 1 FROM t1;
-# Connection con3
+connect con2, localhost, root;
+connect con3, localhost, root;
+connection con3;
LOCK TABLE t1 WRITE;
-# Connection default
+connection default;
START TRANSACTION;
# Sending:
SELECT * FROM v1;
-# Connection con2
+connection con2;
# Waiting for 'SELECT * FROM v1' to sync in.
# Sending:
ALTER VIEW v1 AS SELECT 2 FROM t2;
-# Connection con3
+connection con3;
# Waiting for 'ALTER VIEW v1 AS SELECT 2 FROM t2' to sync in.
UNLOCK TABLES;
-# Connection default;
+connection default;
# Reaping: SELECT * FROM v1
1
SELECT * FROM v1;
1
COMMIT;
-# Connection con2
+connection con2;
# Reaping: ALTER VIEW v1 AS SELECT 2 FROM t2
-# Connection default
+connection default;
DROP TABLE t1, t2;
DROP VIEW v1;
+disconnect con2;
+disconnect con3;
#
# Bug#11815600 [ERROR] INNODB COULD NOT FIND INDEX PRIMARY
# KEY NO 0 FOR TABLE IN ERROR LOG
#
DROP TABLE IF EXISTS t1;
-# Connection default
+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;
id value
1 12345
-# Connection con1
+connection con1;
SET lock_wait_timeout=1;
ALTER TABLE t1 ADD INDEX idx(value);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
ALTER TABLE t1 ADD INDEX idx(value);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-# Connection default
+connection default;
SELECT * FROM t1;
id value
1 12345
COMMIT;
DROP TABLE t1;
+disconnect con1;
set global innodb_lock_wait_timeout=@old_innodb_lock_wait_timeout;
diff --git a/mysql-test/r/innodb_mysql_lock2.result b/mysql-test/r/innodb_mysql_lock2.result
index 54203c140a2..df97b32a41c 100644
--- a/mysql-test/r/innodb_mysql_lock2.result
+++ b/mysql-test/r/innodb_mysql_lock2.result
@@ -17,6 +17,8 @@ select @@session.tx_isolation;
REPEATABLE-READ
# Prepare playground by creating tables, views,
# routines and triggers used in tests.
+connect con1, localhost, root,,;
+connection default;
drop table if exists t0, t1, t2, t3, t4, t5;
drop view if exists v1, v2;
drop procedure if exists p1;
@@ -179,6 +181,7 @@ end|
#
# No locks are necessary as this statement won't be written
# to the binary log and InnoDB supports snapshots.
+connection default;
Success: 'select * from t1' doesn't take row locks on 't1'.
#
# 1.2 Multi-UPDATE statement.
@@ -186,11 +189,13 @@ Success: 'select * from t1' doesn't take row locks on 't1'.
# Has to take shared locks on rows in the table being read as this
# statement will be written to the binary log and therefore should
# be serialized with concurrent statements.
+connection default;
Success: 'update t2, t1 set j= j - 1 where i = j' takes shared row locks on 't1'.
#
# 1.3 Multi-DELETE statement.
#
# The above is true for this statement as well.
+connection default;
Success: 'delete t2 from t1, t2 where i = j' takes shared row locks on 't1'.
#
# 1.4 DESCRIBE statement.
@@ -198,12 +203,15 @@ Success: 'delete t2 from t1, t2 where i = j' takes shared row locks on 't1'.
# This statement does not really read data from the
# target table and thus does not take any lock on it.
# We check this for completeness of coverage.
+connection default;
Success: 'describe t1' doesn't take row locks on 't1'.
#
# 1.5 SHOW statements.
#
# The above is true for SHOW statements as well.
+connection default;
Success: 'show create table t1' doesn't take row locks on 't1'.
+connection default;
Success: 'show keys from t1' doesn't take row locks on 't1'.
#
# 2. Statements which read tables through subqueries.
@@ -218,6 +226,7 @@ Success: 'show keys from t1' doesn't take row locks on 't1'.
# But in practice InnoDB does locking reads for all statements
# other than SELECT (unless it is a READ-COMITTED mode or
# innodb_locks_unsafe_for_binlog is ON).
+connection default;
Success: 'call p1((select i + 5 from t1 where i = 1))' takes shared row locks on 't1'.
#
# 2.2 CREATE TABLE with a subquery.
@@ -225,25 +234,30 @@ Success: 'call p1((select i + 5 from t1 where i = 1))' takes shared row locks on
# Has to take shared locks on rows in the table being read as
# this statement is written to the binary log and therefore
# should be serialized with concurrent statements.
+connection default;
Success: 'create table t0 engine=innodb select * from t1' takes shared row locks on 't1'.
drop table t0;
+connection default;
Success: 'create table t0 engine=innodb select j from t2 where j in (select i from t1)' takes shared row locks on 't1'.
drop table t0;
#
# 2.3 DELETE with a subquery.
#
# The above is true for this statement as well.
+connection default;
Success: 'delete from t2 where j in (select i from t1)' takes shared row locks on 't1'.
#
# 2.4 MULTI-DELETE with a subquery.
#
# Same is true for this statement as well.
+connection default;
Success: 'delete t2 from t3, t2 where k = j and j in (select i from t1)' takes shared row locks on 't1'.
#
# 2.5 DO with a subquery.
#
# In theory should not take row locks as it is not logged.
# In practice InnoDB takes shared row locks.
+connection default;
Success: 'do (select i from t1 where i = 1)' takes shared row locks on 't1'.
#
# 2.6 INSERT with a subquery.
@@ -251,18 +265,23 @@ Success: 'do (select i from t1 where i = 1)' takes shared row locks on 't1'.
# Has to take shared locks on rows in the table being read as
# this statement is written to the binary log and therefore
# should be serialized with concurrent statements.
+connection default;
Success: 'insert into t2 select i+5 from t1' takes shared row locks on 't1'.
+connection default;
Success: 'insert into t2 values ((select i+5 from t1 where i = 4))' takes shared row locks on 't1'.
#
# 2.7 LOAD DATA with a subquery.
#
# The above is true for this statement as well.
+connection default;
Success: 'load data infile '../../std_data/rpl_loaddata.dat' into table t2 (@a, @b) set j= @b + (select i from t1 where i = 1)' takes shared row locks on 't1'.
#
# 2.8 REPLACE with a subquery.
#
# Same is true for this statement as well.
+connection default;
Success: 'replace into t2 select i+5 from t1' takes shared row locks on 't1'.
+connection default;
Success: 'replace into t2 values ((select i+5 from t1 where i = 4))' takes shared row locks on 't1'.
#
# 2.9 SELECT with a subquery.
@@ -273,6 +292,7 @@ Success: 'replace into t2 values ((select i+5 from t1 where i = 4))' takes share
#
# Also serves as a test case for bug #46947 "Embedded SELECT
# without FOR UPDATE is causing a lock".
+connection default;
Success: 'select * from t2 where j in (select i from t1)' doesn't take row locks on 't1'.
#
# 2.10 SET with a subquery.
@@ -280,6 +300,7 @@ Success: 'select * from t2 where j in (select i from t1)' doesn't take row locks
# In theory should not require locking as it is not written
# to the binary log. In practice InnoDB acquires shared row
# locks.
+connection default;
Success: 'set @a:= (select i from t1 where i = 1)' takes shared row locks on 't1'.
#
# 2.11 SHOW with a subquery.
@@ -287,7 +308,9 @@ Success: 'set @a:= (select i from t1 where i = 1)' takes shared row locks on 't1
# Similarly to the previous case, in theory should not require locking
# as it is not written to the binary log. In practice InnoDB
# acquires shared row locks.
+connection default;
Success: 'show tables from test where Tables_in_test = 't2' and (select i from t1 where i = 1)' takes shared row locks on 't1'.
+connection default;
Success: 'show columns from t2 where (select i from t1 where i = 1)' takes shared row locks on 't1'.
#
# 2.12 UPDATE with a subquery.
@@ -295,11 +318,13 @@ Success: 'show columns from t2 where (select i from t1 where i = 1)' takes share
# Has to take shared locks on rows in the table being read as
# this statement is written to the binary log and therefore
# should be serialized with concurrent statements.
+connection default;
Success: 'update t2 set j= j-10 where j in (select i from t1)' takes shared row locks on 't1'.
#
# 2.13 MULTI-UPDATE with a subquery.
#
# Same is true for this statement as well.
+connection default;
Success: 'update t2, t3 set j= j -10 where j=k and j in (select i from t1)' takes shared row locks on 't1'.
#
# 3. Statements which read tables through a view.
@@ -310,9 +335,13 @@ Success: 'update t2, t3 set j= j -10 where j=k and j in (select i from t1)' take
# Since this statement is not written to the binary log
# and old version of rows are accessible thanks to MVCC,
# no locking is necessary.
+connection default;
Success: 'select * from v1' doesn't take row locks on 't1'.
+connection default;
Success: 'select * from v2' doesn't take row locks on 't1'.
+connection default;
Success: 'select * from t2 where j in (select i from v1)' doesn't take row locks on 't1'.
+connection default;
Success: 'select * from t3 where k in (select j from v2)' doesn't take row locks on 't1'.
#
# 3.2 Statements which modify a table and use views.
@@ -320,9 +349,13 @@ Success: 'select * from t3 where k in (select j from v2)' doesn't take row locks
# Since such statements are going to be written to the binary
# log they need to be serialized against concurrent statements
# and therefore should take shared row locks on data read.
+connection default;
Success: 'update t2 set j= j-10 where j in (select i from v1)' takes shared row locks on 't1'.
+connection default;
Success: 'update t3 set k= k-10 where k in (select j from v2)' takes shared row locks on 't1'.
+connection default;
Success: 'update t2, v1 set j= j-10 where j = i' takes shared row locks on 't1'.
+connection default;
Success: 'update v2 set j= j-10 where j = 3' takes shared row locks on 't1'.
#
# 4. Statements which read tables through stored functions.
@@ -338,7 +371,9 @@ Success: 'update v2 set j= j-10 where j = 3' takes shared row locks on 't1'.
# However in practice innodb takes strong lock on tables
# being selected from within SF, when SF is called from
# non SELECT statements like 'set' statement below.
+connection default;
Success: 'select f1()' doesn't take row locks on 't1'.
+connection default;
Success: 'set @a:= f1()' takes shared row locks on 't1'.
#
# 4.2 INSERT (or other statement which modifies data) with
@@ -349,6 +384,7 @@ Success: 'set @a:= f1()' takes shared row locks on 't1'.
# be serialized with concurrent statements affecting the data
# it uses. Therefore it should take row locks on the data
# it reads.
+connection default;
Success: 'insert into t2 values (f1() + 5)' takes shared row locks on 't1'.
#
# 4.3 SELECT/SET with a stored function which
@@ -358,7 +394,9 @@ Success: 'insert into t2 values (f1() + 5)' takes shared row locks on 't1'.
# it should be serialized with concurrent statements affecting
# the data it uses. Hence, row locks on the data read
# should be taken.
+connection default;
Success: 'select f2()' takes shared row locks on 't1'.
+connection default;
Success: 'set @a:= f2()' takes shared row locks on 't1'.
#
# 4.4. SELECT/SET with a stored function which does not
@@ -371,9 +409,13 @@ Success: 'set @a:= f2()' takes shared row locks on 't1'.
# However in practice innodb takes strong lock on tables
# being selected from within SF, when SF is called from
# non SELECT statements like 'set' statement below.
+connection default;
Success: 'select f3()' doesn't take row locks on 't1'.
+connection default;
Success: 'set @a:= f3()' takes shared row locks on 't1'.
+connection default;
Success: 'select f4()' doesn't take row locks on 't1'.
+connection default;
Success: 'set @a:= f4()' takes shared row locks on 't1'.
#
# 4.5. INSERT (or other statement which modifies data) with
@@ -385,7 +427,9 @@ Success: 'set @a:= f4()' takes shared row locks on 't1'.
# be serialized with concurrent statements affecting data it
# uses. Therefore it should take row locks on the data
# it reads.
+connection default;
Success: 'insert into t2 values (f3() + 5)' takes shared row locks on 't1'.
+connection default;
Success: 'insert into t2 values (f4() + 6)' takes shared row locks on 't1'.
#
# 4.6 SELECT/SET which uses a stored function with
@@ -394,7 +438,9 @@ Success: 'insert into t2 values (f4() + 6)' takes shared row locks on 't1'.
# Since call to such function is written to the binary log
# it should be serialized with concurrent statements.
# Hence reads should take row locks.
+connection default;
Success: 'select f5()' takes shared row locks on 't1'.
+connection default;
Success: 'set @a:= f5()' takes shared row locks on 't1'.
#
# 4.7 SELECT/SET which uses a stored function which
@@ -407,9 +453,13 @@ Success: 'set @a:= f5()' takes shared row locks on 't1'.
# However in practice innodb takes strong lock on tables
# being selected from within SF, when SF is called from
# non SELECT statements like 'set' statement below.
+connection default;
Success: 'select f6()' doesn't take row locks on 't1'.
+connection default;
Success: 'set @a:= f6()' takes shared row locks on 't1'.
+connection default;
Success: 'select f7()' doesn't take row locks on 't1'.
+connection default;
Success: 'set @a:= f7()' takes shared row locks on 't1'.
#
# 4.8 INSERT which uses stored function which
@@ -420,7 +470,9 @@ Success: 'set @a:= f7()' takes shared row locks on 't1'.
# should be serialized with concurrent statements affecting
# the data it uses. Therefore it should take row locks on
# the rows it reads.
+connection default;
Success: 'insert into t3 values (f6() + 5)' takes shared row locks on 't1'.
+connection default;
Success: 'insert into t3 values (f7() + 5)' takes shared row locks on 't1'.
#
# 4.9 SELECT which uses a stored function which
@@ -429,7 +481,9 @@ Success: 'insert into t3 values (f7() + 5)' takes shared row locks on 't1'.
# Since a call to such function is written to the binary log
# it should be serialized with concurrent statements.
# Hence, reads should take row locks.
+connection default;
Success: 'select f8()' takes shared row locks on 't1'.
+connection default;
Success: 'select f9()' takes shared row locks on 't1'.
#
# 4.10 SELECT which uses stored function which doesn't modify
@@ -438,6 +492,7 @@ Success: 'select f9()' takes shared row locks on 't1'.
#
# Calls to such functions won't get into the binary
# log and thus don't need to acquire row locks.
+connection default;
Success: 'select f10()' doesn't take row locks on 't1'.
#
# 4.11 INSERT which uses a stored function which doesn't modify
@@ -447,6 +502,7 @@ Success: 'select f10()' doesn't take row locks on 't1'.
# Since such statement is written to the binary log, it should
# be serialized with concurrent statements affecting the data it
# uses. Therefore it should take row locks on data it reads.
+connection default;
Success: 'insert into t2 values (f10() + 5)' takes shared row locks on 't1'.
#
# 4.12 SELECT which uses a stored function which modifies
@@ -456,6 +512,7 @@ Success: 'insert into t2 values (f10() + 5)' takes shared row locks on 't1'.
# Since a call to such function is written to the binary log
# it should be serialized from concurrent statements.
# Hence, reads should take row locks.
+connection default;
Success: 'select f11()' takes shared row locks on 't1'.
#
# 4.13 SELECT that reads a table through a subquery passed
@@ -466,6 +523,7 @@ Success: 'select f11()' takes shared row locks on 't1'.
# binary log, values of its parameters are written as literals.
# So there is no need to acquire row locks on rows used in
# the subquery.
+connection default;
Success: 'select f12((select i+10 from t1 where i=1))' doesn't take row locks on 't1'.
#
# 4.14 INSERT that reads a table via a subquery passed
@@ -475,6 +533,7 @@ Success: 'select f12((select i+10 from t1 where i=1))' doesn't take row locks on
# Since this statement is written to the binary log it should
# be serialized with concurrent statements affecting the data it
# uses. Therefore it should take row locks on the data it reads.
+connection default;
Success: 'insert into t2 values (f13((select i+10 from t1 where i=1)))' takes shared row locks on 't1'.
#
# 5. Statements that read tables through stored procedures.
@@ -485,6 +544,7 @@ Success: 'insert into t2 values (f13((select i+10 from t1 where i=1)))' takes sh
# Since neither this statement nor its components are
# written to the binary log, there is no need to take
# row locks on the data it reads.
+connection default;
Success: 'call p2(@a)' doesn't take row locks on 't1'.
#
# 5.2 Function that modifies data and uses CALL,
@@ -493,6 +553,7 @@ Success: 'call p2(@a)' doesn't take row locks on 't1'.
# Since a call to such function is written to the binary
# log, it should be serialized with concurrent statements.
# Hence, in this case reads should take row locks on data.
+connection default;
Success: 'select f14()' takes shared row locks on 't1'.
#
# 5.3 SELECT that calls a function that doesn't modify data and
@@ -500,6 +561,7 @@ Success: 'select f14()' takes shared row locks on 't1'.
#
# Calls to such functions won't get into the binary
# log and thus don't need to acquire row locks.
+connection default;
Success: 'select f15()' doesn't take row locks on 't1'.
#
# 5.4 INSERT which calls function which doesn't modify data and
@@ -508,6 +570,7 @@ Success: 'select f15()' doesn't take row locks on 't1'.
# Since such statement is written to the binary log it should
# be serialized with concurrent statements affecting data it
# uses. Therefore it should take row locks on data it reads.
+connection default;
Success: 'insert into t2 values (f15()+5)' takes shared row locks on 't1'.
#
# 6. Statements that use triggers.
@@ -519,30 +582,35 @@ Success: 'insert into t2 values (f15()+5)' takes shared row locks on 't1'.
# be serialized with concurrent statements affecting the data
# it uses. Therefore, it should take row locks on the data
# it reads.
+connection default;
Success: 'insert into t4 values (2)' takes shared row locks on 't1'.
#
# 6.2 Statement invoking a trigger that reads table through
# a subquery in a control construct.
#
# The above is true for this statement as well.
+connection default;
Success: 'update t4 set l= 2 where l = 1' takes shared row locks on 't1'.
#
# 6.3 Statement invoking a trigger that reads a table through
# a view.
#
# And for this statement.
+connection default;
Success: 'delete from t4 where l = 1' takes shared row locks on 't1'.
#
# 6.4 Statement invoking a trigger that reads a table through
# a stored function.
#
# And for this statement.
+connection default;
Success: 'insert into t5 values (2)' takes shared row locks on 't1'.
#
# 6.5 Statement invoking a trigger that reads a table through
# stored procedure.
#
# And for this statement.
+connection default;
Success: 'update t5 set l= 2 where l = 1' takes shared row locks on 't1'.
# Clean-up.
drop function f1;
@@ -564,10 +632,13 @@ drop view v1, v2;
drop procedure p1;
drop procedure p2;
drop table t1, t2, t3, t4, t5;
+disconnect con1;
#
# Test for bug#51263 "Deadlock between transactional SELECT
# and ALTER TABLE ... REBUILD PARTITION".
#
+connect con1,localhost,root,,test,,;
+connection default;
drop table if exists t1, t2;
create table t1 (i int auto_increment not null primary key) engine=innodb;
create table t2 (i int) engine=innodb;
@@ -575,10 +646,10 @@ insert into t1 values (1), (2), (3), (4), (5);
begin;
# Acquire SR metadata lock on t1 and LOCK_S row-locks on its rows.
insert into t2 select count(*) from t1;
-# Switching to connection 'con1'.
+connection con1;
# Sending:
alter table t1 add column j int;
-# Switching to connection 'default'.
+connection default;
# Wait until ALTER is blocked because it tries to upgrade SNW
# metadata lock to X lock.
# It should not be blocked during copying data to new version of
@@ -593,9 +664,9 @@ insert into t1 values (6);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
# Unblock ALTER TABLE.
commit;
-# Switching to connection 'con1'.
+connection con1;
# Reaping ALTER TABLE.
-# Switching to connection 'default'.
+connection default;
#
# Now test for scenario in which bug was reported originally.
#
@@ -613,10 +684,10 @@ i
3
4
5
-# Switching to connection 'con1'.
+connection con1;
# Sending:
alter table t1 rebuild partition p0;
-# Switching to connection 'default'.
+connection default;
# Wait until ALTER is blocked because of active SR lock.
# The below statement should succeed as transaction
# has SR metadata lock on t1 and only going to read
@@ -624,8 +695,9 @@ alter table t1 rebuild partition p0;
insert into t2 select count(*) from t1;
# Unblock ALTER TABLE.
commit;
-# Switching to connection 'con1'.
+connection con1;
# Reaping ALTER TABLE.
-# Switching to connection 'default'.
+connection default;
+disconnect con1;
# Clean-up.
drop tables t1, t2;
diff --git a/mysql-test/r/innodb_mysql_sync.result b/mysql-test/r/innodb_mysql_sync.result
index cfe855fbb76..a8a264d6580 100644
--- a/mysql-test/r/innodb_mysql_sync.result
+++ b/mysql-test/r/innodb_mysql_sync.result
@@ -5,23 +5,25 @@
DROP TABLE IF EXISTS t1;
# Create InnoDB table
CREATE TABLE t1 (id INT) engine=innodb;
-# Connection 1
+connect con2, localhost, root;
# Start optimizing table
+connection default;
SET DEBUG_SYNC='ha_admin_try_alter SIGNAL optimize_started WAIT_FOR table_altered';
OPTIMIZE TABLE t1;
-# Connection 2
# 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';
-# Connection 1
# Complete optimization
+connection default;
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize error Got error -1 "Internal error < 0 (Not system error)" from storage engine MEMORY
test.t1 optimize status Operation failed
Warnings:
Error 1030 Got error -1 "Internal error < 0 (Not system error)" from storage engine MEMORY
+disconnect con2;
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
#
@@ -29,16 +31,18 @@ SET DEBUG_SYNC='RESET';
# OPTIMIZE TABLE
#
DROP TABLE IF EXISTS t1;
+connect con1, localhost, root;
+connection default;
CREATE TABLE t1(a INT) ENGINE= InnoDB;
-# Connection con1
+connection con1;
SET DEBUG_SYNC= "ha_admin_open_ltable SIGNAL opening WAIT_FOR dropped";
# Sending:
OPTIMIZE TABLE t1;
-# Connection default
+connection default;
SET DEBUG_SYNC= "now WAIT_FOR opening";
DROP TABLE t1;
SET DEBUG_SYNC= "now SIGNAL dropped";
-# Connection con1
+connection con1;
# Reaping: OPTIMIZE TABLE t1
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
@@ -46,7 +50,8 @@ test.t1 optimize error Table 'test.t1' doesn't exist
test.t1 optimize status Operation failed
Warnings:
Error 1146 Table 'test.t1' doesn't exist
-# Connection default
+connection default;
+disconnect con1;
SET DEBUG_SYNC= "RESET";
#
# Bug#53757 assert in mysql_truncate_by_delete
@@ -55,10 +60,12 @@ DROP TABLE IF EXISTS t1, t2;
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";
# Sending: (not reaped since connection is killed later)
TRUNCATE t1;
+connection default;
SET DEBUG_SYNC= "now WAIT_FOR opening";
SELECT ((@id := id) - id) FROM t2;
((@id := id) - id)
@@ -66,6 +73,7 @@ SELECT ((@id := id) - id) FROM t2;
KILL @id;
SET DEBUG_SYNC= "now SIGNAL killed";
DROP TABLE t1, t2;
+disconnect con1;
SET DEBUG_SYNC= "RESET";
#
# Bug#58933 Assertion `thd- >is_error()' fails on shutdown with ongoing
@@ -74,15 +82,15 @@ SET DEBUG_SYNC= "RESET";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1), (2);
-# Connection con1
+connect con1,localhost,root;
SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL waiting WAIT_FOR killed';
# Sending:
OPTIMIZE TABLE t1;
-# Connection default
+connection default;
SET DEBUG_SYNC= 'now WAIT_FOR waiting';
KILL QUERY ID;
SET DEBUG_SYNC= 'now SIGNAL killed';
-# Connection con1
+connection con1;
# Reaping: OPTIMIZE TABLE t1
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
@@ -90,24 +98,27 @@ test.t1 optimize error Query execution was interrupted
test.t1 optimize status Operation failed
Warnings:
Error 1317 Query execution was interrupted
-# Connection default
+connection default;
DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';
+disconnect con1;
#
# Bug#42230 during add index, cannot do queries on storage engines
# that implement add_index
#
DROP DATABASE IF EXISTS db1;
DROP TABLE IF EXISTS t1;
+connect con1,localhost,root;
+connect con2,localhost,root;
# Test 1: Secondary index, should not block reads (original test case).
-# Connection default
+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";
# Sending:
ALTER TABLE db1.t1 ADD INDEX(value);
-# Connection con1
+connection con1;
SET DEBUG_SYNC= "now WAIT_FOR manage";
USE db1;
SELECT * FROM t1;
@@ -115,7 +126,7 @@ id value
1 1
2 2
SET DEBUG_SYNC= "now SIGNAL query";
-# Connection default
+connection default;
# Reaping: ALTER TABLE db1.t1 ADD INDEX(value)
DROP DATABASE db1;
# Test 2: Primary index (implicit), should block writes.
@@ -123,51 +134,53 @@ 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";
# Sending:
ALTER TABLE t1 ADD UNIQUE INDEX(a), LOCK=SHARED;
-# Connection con1
+connection con1;
SET DEBUG_SYNC= "now WAIT_FOR manage";
USE test;
SELECT * FROM t1;
a b
# Sending:
UPDATE t1 SET a=NULL;
-# Connection con2
+connection con2;
# Waiting for SELECT to be blocked by the metadata lock on t1
SET DEBUG_SYNC= "now SIGNAL query";
-# Connection default
+connection default;
# Reaping: ALTER TABLE t1 ADD UNIQUE INDEX(a)
-# Connection con1
+connection con1;
# Reaping: UPDATE t1 SET a=NULL
# Test 3: Primary index (explicit), should block writes.
-# Connection default
+connection default;
ALTER TABLE t1 DROP INDEX a;
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
# Sending:
ALTER TABLE t1 ADD PRIMARY KEY (a), LOCK=SHARED;
-# Connection con1
+connection con1;
SET DEBUG_SYNC= "now WAIT_FOR manage";
SELECT * FROM t1;
a b
# Sending:
UPDATE t1 SET a=NULL;
-# Connection con2
+connection con2;
# Waiting for SELECT to be blocked by the metadata lock on t1
SET DEBUG_SYNC= "now SIGNAL query";
-# Connection default
+connection default;
# Reaping: ALTER TABLE t1 ADD PRIMARY KEY (a)
-# Connection con1
+connection con1;
# Reaping: UPDATE t1 SET a=NULL
# Test 4: Secondary unique index, should not block reads.
-# Connection default
+connection default;
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
# Sending:
ALTER TABLE t1 ADD UNIQUE (b);
-# Connection con1
+connection con1;
SET DEBUG_SYNC= "now WAIT_FOR manage";
SELECT * FROM t1;
a b
SET DEBUG_SYNC= "now SIGNAL query";
-# Connection default
+connection default;
# Reaping: ALTER TABLE t1 ADD UNIQUE (b)
+disconnect con1;
+disconnect con2;
SET DEBUG_SYNC= "RESET";
DROP TABLE t1;
#
@@ -177,7 +190,7 @@ DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb;
INSERT INTO t1 VALUES (1, 12345), (2, 23456);
-# Connection con1
+connect con1,localhost,root;
SET SESSION debug_dbug= "+d,alter_table_rollback_new_index";
ALTER TABLE t1 ADD PRIMARY KEY(a);
ERROR HY000: Unknown error
@@ -185,12 +198,13 @@ SELECT * FROM t1;
a b
1 12345
2 23456
-# Connection default
+connection default;
SELECT * FROM t1;
a b
1 12345
2 23456
DROP TABLE t1;
+disconnect con1;
#
# Bug#13417754 ASSERT IN ROW_DROP_DATABASE_FOR_MYSQL DURING DROP SCHEMA
#
@@ -198,25 +212,29 @@ DROP TABLE IF EXISTS t1;
DROP DATABASE IF EXISTS db1;
CREATE TABLE t1(a int) engine=InnoDB;
CREATE DATABASE db1;
-# Connection con1
+connect con1, localhost, root;
+connect con2, localhost, root;
+connection con1;
SET DEBUG_SYNC= 'after_innobase_rename_table SIGNAL locked WAIT_FOR continue';
# Sending:
ALTER TABLE t1 RENAME db1.t1;
-# Connection con2
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# DROP DATABASE db1 should now be blocked by ALTER TABLE
# Sending:
DROP DATABASE db1;
-# Connection default
+connection default;
# Check that DROP DATABASE is blocked by IX lock on db1
# Resume ALTER TABLE
SET DEBUG_SYNC= 'now SIGNAL continue';
-# Connection con1
+connection con1;
# Reaping: ALTER TABLE t1 RENAME db1.t1;
-# Connection con2
+connection con2;
# Reaping: DROP DATABASE db1
-# Connection default;
+connection default;
SET DEBUG_SYNC= 'RESET';
+disconnect con1;
+disconnect con2;
#
# WL#5534 Online ALTER, Phase 1
#
@@ -226,18 +244,19 @@ DROP TABLE IF EXISTS t1;
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;
#
# 1: In-place + writes blocked.
#
-# Connection default
+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';
# Sending:
ALTER TABLE t1 ADD INDEX i1(b), ALGORITHM= INPLACE, LOCK= SHARED;
-# Connection con1;
+connection con1;
SET DEBUG_SYNC= 'now WAIT_FOR opened';
# At this point, neither reads nor writes should be blocked.
SELECT * FROM t1;
@@ -267,7 +286,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 VALUES (6,6);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET DEBUG_SYNC= 'now SIGNAL continue4';
-# Connection default
+connection default;
# Reaping ALTER TABLE ...
SET DEBUG_SYNC= 'RESET';
DELETE FROM t1 WHERE a= 3;
@@ -279,7 +298,7 @@ SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded WAIT_FOR co
SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL binlog WAIT_FOR continue3';
# Sending:
ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= COPY, LOCK= SHARED;
-# Connection con1;
+connection con1;
SET DEBUG_SYNC= 'now WAIT_FOR opened';
# At this point, neither reads nor writes should be blocked.
SELECT * FROM t1;
@@ -305,10 +324,10 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 VALUES (5,5);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET DEBUG_SYNC= 'now SIGNAL continue3';
-# Connection default
+connection default;
# Reaping ALTER TABLE ...
Warnings:
-Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release
SET DEBUG_SYNC= 'RESET';
DELETE FROM t1 WHERE a= 3;
#
@@ -318,14 +337,14 @@ DELETE FROM t1 WHERE a= 3;
#
# 4: In-place + reads and writes blocked.
#
-# Connection default
+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';
# Sending:
ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= INPLACE, LOCK= EXCLUSIVE;
-# Connection con1;
+connection con1;
SET DEBUG_SYNC= 'now WAIT_FOR opened';
# At this point, neither reads nor writes should be blocked.
SELECT * FROM t1;
@@ -355,17 +374,20 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 VALUES (6,6);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET DEBUG_SYNC= 'now SIGNAL continue4';
-# Connection default
+connection default;
# Reaping ALTER TABLE ...
Warnings:
-Note 1831 Duplicate index `i4`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i4`. This is deprecated and will be disallowed in a future release
SET DEBUG_SYNC= 'RESET';
+connection default;
+disconnect con1;
DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';
#
#BUG#13975225:ONLINE OPTIMIZE TABLE FOR INNODB TABLES
#
SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL downgraded WAIT_FOR continue';
+connect con1,localhost,root,,;
#Setting up INNODB table.
CREATE TABLE t1(fld1 INT, fld2 INT, fld3 INT) ENGINE= INNODB;
INSERT INTO t1 VALUES (155, 45, 55);
@@ -542,5 +564,6 @@ ALTER TABLE t1 FORCE;
connection con1;
SET DEBUG_SYNC= 'now WAIT_FOR rebuild';
connection default;
+disconnect con1;
SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;
diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result
index 5a0b6b10db8..736aa917cae 100644
--- a/mysql-test/r/insert.result
+++ b/mysql-test/r/insert.result
@@ -90,7 +90,7 @@ drop database mysqltest;
use test;
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 into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1366 Incorrect double value: 'aa' for column 'f_double' at row 1
Warning 1366 Incorrect double value: 'aa' for column 'f_float' at row 1
@@ -112,7 +112,7 @@ f_float_u 0
f_double_15_1_u 0.0
f_float_3_1_u 0.0
set @value= "1aa";
-insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1265 Data truncated for column 'f_double' at row 1
Warning 1265 Data truncated for column 'f_float' at row 1
@@ -134,7 +134,7 @@ f_float_u 1
f_double_15_1_u 1.0
f_float_3_1_u 1.0
set @value= "aa1";
-insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1366 Incorrect double value: 'aa1' for column 'f_double' at row 1
Warning 1366 Incorrect double value: 'aa1' for column 'f_float' at row 1
@@ -156,7 +156,7 @@ f_float_u 0
f_double_15_1_u 0.0
f_float_3_1_u 0.0
set @value= "1e+1111111111a";
-insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1264 Out of range value for column 'f_double' at row 1
Warning 1264 Out of range value for column 'f_float' at row 1
@@ -184,7 +184,7 @@ f_float_u 3.40282e38
f_double_15_1_u 99999999999999.9
f_float_3_1_u 99.9
set @value= "-1e+1111111111a";
-insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1264 Out of range value for column 'f_double' at row 1
Warning 1264 Out of range value for column 'f_float' at row 1
@@ -217,7 +217,7 @@ ERROR 22007: Illegal double '1e+1111111111' value found during parsing
set @value= -1e+1111111111;
ERROR 22007: Illegal double '1e+1111111111' value found during parsing
set @value= 1e+111;
-insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1264 Out of range value for column 'f_float' at row 1
Warning 1264 Out of range value for column 'f_double_7_2' at row 1
@@ -237,7 +237,7 @@ f_float_u 3.40282e38
f_double_15_1_u 99999999999999.9
f_float_3_1_u 99.9
set @value= -1e+111;
-insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1264 Out of range value for column 'f_float' at row 1
Warning 1264 Out of range value for column 'f_double_7_2' at row 1
@@ -271,7 +271,7 @@ f_float_u 1
f_double_15_1_u 1.0
f_float_3_1_u 1.0
set @value= -1;
-insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1264 Out of range value for column 'f_double_u' at row 1
Warning 1264 Out of range value for column 'f_float_u' at row 1
@@ -417,19 +417,19 @@ f2()
INSERT INTO t1 VALUES (3);
INSERT DELAYED INTO t1 VALUES (4);
INSERT INTO t1 VALUES (f1());
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
INSERT DELAYED INTO t1 VALUES (f1());
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
INSERT INTO t1 VALUES (f2());
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
INSERT DELAYED INTO t1 VALUES (f2());
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
INSERT INTO t1 VALUES (NEW.i);
INSERT INTO t1 VALUES (1);
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
INSERT DELAYED INTO t1 VALUES (1);
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
SELECT * FROM t1;
i
1
@@ -515,7 +515,7 @@ 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 INTO t1(a,b,c) VALUES (1.225e-05, 1.225e-05, 1.225e-05);
+INSERT IGNORE INTO t1(a,b,c) VALUES (1.225e-05, 1.225e-05, 1.225e-05);
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
INSERT INTO t1(a,b) VALUES (1.225e-04, 1.225e-04);
@@ -534,7 +534,7 @@ 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 IGNORE INTO t1(a,c) VALUES (1.87e-3, 1.87e-3);
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2);
@@ -748,6 +748,6 @@ SET @@sql_mode= @save_mode;
CREATE TABLE t1 (f INT);
CREATE VIEW v1 AS SELECT * FROM t1 WHERE f <=> 'foo' WITH CHECK OPTION;
REPLACE INTO v1 SET f = NULL;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 22007: Truncated incorrect DOUBLE value: 'foo'
DROP VIEW v1;
DROP TABLE t1;
diff --git a/mysql-test/r/insert_notembedded.result b/mysql-test/r/insert_notembedded.result
index 41e31508fe0..d2733eac061 100644
--- a/mysql-test/r/insert_notembedded.result
+++ b/mysql-test/r/insert_notembedded.result
@@ -8,6 +8,8 @@ ERROR HY000: 'test.v1' is not BASE TABLE
drop table t1;
drop view v1;
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));
@@ -27,6 +29,8 @@ 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;
REPLACE INTO table_target
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
FROM table_source
@@ -51,9 +55,13 @@ ON table_source.id = stations.icao
LEFT JOIN view_target3 AS old
USING (mexs_id);
ERROR HY000: View 'meow.view_target3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+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
@@ -86,6 +94,8 @@ 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;
mexs_id messzeit
87654321 2006-07-12 07:50:00
@@ -106,26 +116,8 @@ DROP TABLE table_target3;
DROP VIEW view_target2;
DROP VIEW view_target3;
DROP USER user20989@localhost;
+disconnect root;
+connection default;
DROP DATABASE meow;
-connection: default
-set low_priority_updates=1;
-drop table if exists t1;
-create table t1 (a int, b int, unique key t1$a (a));
-lock table t1 read;
-connection: update
-set low_priority_updates=1;
-show variables like 'low_priority_updates';
-Variable_name Value
-low_priority_updates ON
-insert into t1 values (1, 2) ON DUPLICATE KEY UPDATE b = 2;;
-connection: select
-select * from t1;
-a b
-connection: default
-select * from t1;
-a b
-unlock tables;
-drop table t1;
-set low_priority_updates=default;
set local sql_mode=default;
set global sql_mode=default;
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index 3f4a26a728e..1a3a38b1f35 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -608,7 +608,7 @@ NULL Field Count
NULL 1 100
NULL 2 100
create table t2(No int not null, Field int not null, Count int not null);
-insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2;
+insert ignore into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2;
Warnings:
Warning 1048 Column 'No' cannot be null
Warning 1048 Column 'No' cannot be null
@@ -772,11 +772,13 @@ f1 f2
101 1
2 2
DROP TABLE t1, t2;
+SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
CREATE TABLE t1 ( a INT KEY, b INT );
INSERT INTO t1 VALUES ( 0, 1 );
INSERT INTO t1 ( b ) SELECT MAX( b ) FROM t1 WHERE b = 2;
ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
DROP TABLE t1;
+SET sql_mode = DEFAULT;
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));
diff --git a/mysql-test/r/ipv4_and_ipv6.result b/mysql-test/r/ipv4_and_ipv6.result
index f15aeba65fa..447c20536e2 100644
--- a/mysql-test/r/ipv4_and_ipv6.result
+++ b/mysql-test/r/ipv4_and_ipv6.result
@@ -20,6 +20,9 @@ SELECT current_user();
current_user()
root@localhost
SHOW PROCESSLIST;
+connect con1, $IPv6, root, , test, $MASTER_MYPORT;
+connection default;
+disconnect con1;
REVOKE ALL ON test.* FROM testuser@'::1';
RENAME USER testuser@'::1' to testuser1@'::1';
SET PASSWORD FOR testuser1@'::1' = PASSWORD ('9876');
@@ -49,6 +52,9 @@ SELECT current_user();
current_user()
root@localhost
SHOW PROCESSLIST;
+connect con1, $IPv6, root, , test, $MASTER_MYPORT;
+connection default;
+disconnect con1;
REVOKE ALL ON test.* FROM testuser@'127.0.0.1';
RENAME USER testuser@'127.0.0.1' to testuser1@'127.0.0.1';
SET PASSWORD FOR testuser1@'127.0.0.1' = PASSWORD ('9876');
diff --git a/mysql-test/r/ipv4_as_ipv6.result b/mysql-test/r/ipv4_as_ipv6.result
index 82bca393d71..b92b545da86 100644
--- a/mysql-test/r/ipv4_as_ipv6.result
+++ b/mysql-test/r/ipv4_as_ipv6.result
@@ -20,6 +20,9 @@ SELECT current_user();
current_user()
root@localhost
SHOW PROCESSLIST;
+connect con1, $IPv6, root, , test, $MASTER_MYPORT;
+connection default;
+disconnect con1;
REVOKE ALL ON test.* FROM testuser@'127.0.0.1';
RENAME USER testuser@'127.0.0.1' to testuser1@'127.0.0.1';
SET PASSWORD FOR testuser1@'127.0.0.1' = PASSWORD ('9876');
@@ -49,6 +52,9 @@ SELECT current_user();
current_user()
root@localhost
SHOW PROCESSLIST;
+connect con1, $IPv6, root, , test, $MASTER_MYPORT;
+connection default;
+disconnect con1;
REVOKE ALL ON test.* FROM testuser@'0:0:0:0:0:FFFF:127.0.0.1';
RENAME USER testuser@'0:0:0:0:0:FFFF:127.0.0.1' to testuser1@'0:0:0:0:0:FFFF:127.0.0.1';
SET PASSWORD FOR testuser1@'0:0:0:0:0:FFFF:127.0.0.1' = PASSWORD ('9876');
@@ -78,6 +84,9 @@ SELECT current_user();
current_user()
root@localhost
SHOW PROCESSLIST;
+connect con1, $IPv6, root, , test, $MASTER_MYPORT;
+connection default;
+disconnect con1;
REVOKE ALL ON test.* FROM testuser@'0000:0000:0000:0000:0000:FFFF:127.0.0.1';
RENAME USER testuser@'0000:0000:0000:0000:0000:FFFF:127.0.0.1' to testuser1@'0000:0000:0000:0000:0000:FFFF:127.0.0.1';
SET PASSWORD FOR testuser1@'0000:0000:0000:0000:0000:FFFF:127.0.0.1' = PASSWORD ('9876');
@@ -107,6 +116,9 @@ SELECT current_user();
current_user()
root@localhost
SHOW PROCESSLIST;
+connect con1, $IPv6, root, , test, $MASTER_MYPORT;
+connection default;
+disconnect con1;
REVOKE ALL ON test.* FROM testuser@'0:0000:0000:0:0000:FFFF:127.0.0.1';
RENAME USER testuser@'0:0000:0000:0:0000:FFFF:127.0.0.1' to testuser1@'0:0000:0000:0:0000:FFFF:127.0.0.1';
SET PASSWORD FOR testuser1@'0:0000:0000:0:0000:FFFF:127.0.0.1' = PASSWORD ('9876');
@@ -136,6 +148,9 @@ SELECT current_user();
current_user()
root@localhost
SHOW PROCESSLIST;
+connect con1, $IPv6, root, , test, $MASTER_MYPORT;
+connection default;
+disconnect con1;
REVOKE ALL ON test.* FROM testuser@'0::0000:FFFF:127.0.0.1';
RENAME USER testuser@'0::0000:FFFF:127.0.0.1' to testuser1@'0::0000:FFFF:127.0.0.1';
SET PASSWORD FOR testuser1@'0::0000:FFFF:127.0.0.1' = PASSWORD ('9876');
@@ -166,6 +181,9 @@ SELECT current_user();
current_user()
root@localhost
SHOW PROCESSLIST;
+connect con1, $IPv6, root, , test, $MASTER_MYPORT;
+connection default;
+disconnect con1;
REVOKE ALL ON test.* FROM testuser@'::FFFF:127.0.0.1';
RENAME USER testuser@'::FFFF:127.0.0.1' to testuser1@'::FFFF:127.0.0.1';
SET PASSWORD FOR testuser1@'::FFFF:127.0.0.1' = PASSWORD ('9876');
diff --git a/mysql-test/r/ipv6.result b/mysql-test/r/ipv6.result
index 1ff51fcc831..1540b4825e5 100644
--- a/mysql-test/r/ipv6.result
+++ b/mysql-test/r/ipv6.result
@@ -20,6 +20,9 @@ SELECT current_user();
current_user()
root@localhost
SHOW PROCESSLIST;
+connect con1, $IPv6, root, , test, $MASTER_MYPORT;
+connection default;
+disconnect con1;
REVOKE ALL ON test.* FROM testuser@'::1';
RENAME USER testuser@'::1' to testuser1@'::1';
SET PASSWORD FOR testuser1@'::1' = PASSWORD ('9876');
@@ -50,6 +53,9 @@ SELECT current_user();
current_user()
root@localhost
SHOW PROCESSLIST;
+connect con1, $IPv6, root, , test, $MASTER_MYPORT;
+connection default;
+disconnect con1;
REVOKE ALL ON test.* FROM testuser@'0000:0000:0000:0000:0000:0000:0000:0001';
RENAME USER testuser@'0000:0000:0000:0000:0000:0000:0000:0001' to testuser1@'0000:0000:0000:0000:0000:0000:0000:0001';
SET PASSWORD FOR testuser1@'0000:0000:0000:0000:0000:0000:0000:0001' = PASSWORD ('9876');
@@ -79,6 +85,9 @@ SELECT current_user();
current_user()
root@localhost
SHOW PROCESSLIST;
+connect con1, $IPv6, root, , test, $MASTER_MYPORT;
+connection default;
+disconnect con1;
REVOKE ALL ON test.* FROM testuser@'0:0:0:0:0:0:0:1';
RENAME USER testuser@'0:0:0:0:0:0:0:1' to testuser1@'0:0:0:0:0:0:0:1';
SET PASSWORD FOR testuser1@'0:0:0:0:0:0:0:1' = PASSWORD ('9876');
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index 3e39c95fe16..596cecfa8b2 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -168,6 +168,8 @@ SELECT * FROM t1 WHERE 1/0 IS NULL;
d
2001-08-01
0000-00-00
+Warnings:
+Warning 1365 Division by 0
DROP TABLE t1,t2;
CREATE TABLE t1 (
Document_ID varchar(50) NOT NULL default '',
@@ -755,8 +757,8 @@ statistics.TABLE_NAME, statistics.COLUMN_NAME, statistics.TABLE_CATALOG, statist
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';
TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA COLUMN_COMMENT
-user Host def mysql 0 mysql PRIMARY 1 A NULL NULL BTREE def mysql NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI
-user User def mysql 0 mysql PRIMARY 2 A NULL NULL BTREE def mysql NO char 80 240 NULL NULL utf8 utf8_bin char(80) PRI
+user Host def mysql 0 mysql PRIMARY 1 A NULL NULL BTREE def mysql '' NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI
+user User def mysql 0 mysql PRIMARY 2 A NULL NULL BTREE def mysql '' NO char 80 240 NULL NULL utf8 utf8_bin char(80) PRI
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
@@ -1140,7 +1142,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` left join `test`.`t1` `t2` on((1 = 1)) left join (`test`.`t1` left join `test`.`t1` `t2` on((1 = 1))) on(rand()) where 1
+Note 1003 select 1 AS `1` from `test`.`t1` left join `test`.`t1` `t2` on(1 = 1) left join (`test`.`t1` left join `test`.`t1` `t2` on(1 = 1)) on(rand()) where 1
DROP VIEW v1;
DROP TABLE t1;
#
@@ -1481,7 +1483,7 @@ DROP TABLE t1,t2,t3,t4,t5;
# MDEV-4752: Segfault during parsing of illegal query
#
SELECT * FROM t5 JOIN (t1 JOIN t2 UNION SELECT * FROM t3 JOIN t4);
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT * FROM t3 JOIN t4)' at line 1
#
# MDEV-4959: join of const table with NULL fields
#
@@ -1496,9 +1498,9 @@ EXPLAIN EXTENDED
SELECT * FROM t1 JOIN v2 ON i1 = i2 WHERE a < b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00
+2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select NULL AS `i1`,`v2`.`i2` AS `i2`,`v2`.`a` AS `a`,`v2`.`b` AS `b` from `test`.`v2` where ((`v2`.`i2` = NULL) and (`v2`.`a` < `v2`.`b`))
+Note 1003 select NULL AS `i1`,`v2`.`i2` AS `i2`,`v2`.`a` AS `a`,`v2`.`b` AS `b` from `test`.`v2` where `v2`.`i2` = NULL and `v2`.`a` < `v2`.`b`
DROP VIEW v2;
DROP TABLE t1,t2;
SET optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/r/join_cache.result b/mysql-test/r/join_cache.result
index 9eb1654e2cc..eea397402ad 100644
--- a/mysql-test/r/join_cache.result
+++ b/mysql-test/r/join_cache.result
@@ -4450,7 +4450,7 @@ EXPLAIN
SELECT t2.i FROM t1,t2 WHERE t1.cu = t2.cl ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6
-1 SIMPLE t1 hash_index cu #hash#cu:cu 33:33 func 10 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t1 hash_index cu #hash#cu:cu 33:33 func 10 Using where; Using index; Using join buffer (flat, BNLH join)
SELECT t2.i FROM t1,t2 WHERE t1.cu = t2.cl ;
i
6
@@ -4691,6 +4691,9 @@ 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;
a
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'h'
+Warning 1292 Truncated incorrect INTEGER value: 'j'
SET SESSION optimizer_switch = 'outer_join_with_cache=off';
SET SESSION join_cache_level = DEFAULT;
DROP TABLE t1,t2,t3;
@@ -4773,7 +4776,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t4 ref idx idx 5 test.t1.a1 2 100.00 Using where
1 SIMPLE t5 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a1` AS `a1`,`test`.`t2`.`pk` AS `pk`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`c2` AS `c2`,`test`.`t2`.`d2` AS `d2`,`test`.`t3`.`pk` AS `pk`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3`,`test`.`t4`.`pk` AS `pk`,`test`.`t4`.`a4` AS `a4`,`test`.`t5`.`pk` AS `pk`,`test`.`t5`.`a5` AS `a5` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`d2` = `test`.`t1`.`pk`) and (`test`.`t3`.`a3` = `test`.`t2`.`c2`))) left join `test`.`t4` on(((`test`.`t4`.`a4` = `test`.`t1`.`a1`) and (`test`.`t1`.`a1` is not null))) left join `test`.`t5` on((`test`.`t5`.`a5` = `test`.`t3`.`a3`)) where 1
+Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a1` AS `a1`,`test`.`t2`.`pk` AS `pk`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`c2` AS `c2`,`test`.`t2`.`d2` AS `d2`,`test`.`t3`.`pk` AS `pk`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3`,`test`.`t4`.`pk` AS `pk`,`test`.`t4`.`a4` AS `a4`,`test`.`t5`.`pk` AS `pk`,`test`.`t5`.`a5` AS `a5` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`d2` = `test`.`t1`.`pk` and `test`.`t3`.`a3` = `test`.`t2`.`c2`) left join `test`.`t4` on(`test`.`t4`.`a4` = `test`.`t1`.`a1` and `test`.`t1`.`a1` is not null) left join `test`.`t5` on(`test`.`t5`.`a5` = `test`.`t3`.`a3`) where 1
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;
@@ -4795,7 +4798,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t4 ref idx idx 5 test.t1.a1 2 100.00 Using where
1 SIMPLE t5 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a1` AS `a1`,`test`.`t2`.`pk` AS `pk`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`c2` AS `c2`,`test`.`t2`.`d2` AS `d2`,`test`.`t3`.`pk` AS `pk`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3`,`test`.`t4`.`pk` AS `pk`,`test`.`t4`.`a4` AS `a4`,`test`.`t5`.`pk` AS `pk`,`test`.`t5`.`a5` AS `a5` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`d2` = `test`.`t1`.`pk`) and (`test`.`t3`.`a3` = `test`.`t2`.`c2`))) left join `test`.`t4` on(((`test`.`t4`.`a4` = `test`.`t1`.`a1`) and (`test`.`t1`.`a1` is not null))) left join `test`.`t5` on((`test`.`t5`.`a5` = `test`.`t3`.`a3`)) where 1
+Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a1` AS `a1`,`test`.`t2`.`pk` AS `pk`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`c2` AS `c2`,`test`.`t2`.`d2` AS `d2`,`test`.`t3`.`pk` AS `pk`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3`,`test`.`t4`.`pk` AS `pk`,`test`.`t4`.`a4` AS `a4`,`test`.`t5`.`pk` AS `pk`,`test`.`t5`.`a5` AS `a5` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`d2` = `test`.`t1`.`pk` and `test`.`t3`.`a3` = `test`.`t2`.`c2`) left join `test`.`t4` on(`test`.`t4`.`a4` = `test`.`t1`.`a1` and `test`.`t1`.`a1` is not null) left join `test`.`t5` on(`test`.`t5`.`a5` = `test`.`t3`.`a3`) where 1
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;
@@ -4817,7 +4820,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t4 ref idx idx 5 test.t1.a1 2 100.00 Using where
1 SIMPLE t5 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a1` AS `a1`,`test`.`t2`.`pk` AS `pk`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`c2` AS `c2`,`test`.`t2`.`d2` AS `d2`,`test`.`t3`.`pk` AS `pk`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3`,`test`.`t4`.`pk` AS `pk`,`test`.`t4`.`a4` AS `a4`,`test`.`t5`.`pk` AS `pk`,`test`.`t5`.`a5` AS `a5` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`d2` = `test`.`t1`.`pk`) and (`test`.`t3`.`a3` = `test`.`t2`.`c2`))) left join `test`.`t4` on(((`test`.`t4`.`a4` = `test`.`t1`.`a1`) and (`test`.`t1`.`a1` is not null))) left join `test`.`t5` on((`test`.`t5`.`a5` = `test`.`t3`.`a3`)) where 1
+Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a1` AS `a1`,`test`.`t2`.`pk` AS `pk`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`c2` AS `c2`,`test`.`t2`.`d2` AS `d2`,`test`.`t3`.`pk` AS `pk`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3`,`test`.`t4`.`pk` AS `pk`,`test`.`t4`.`a4` AS `a4`,`test`.`t5`.`pk` AS `pk`,`test`.`t5`.`a5` AS `a5` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`d2` = `test`.`t1`.`pk` and `test`.`t3`.`a3` = `test`.`t2`.`c2`) left join `test`.`t4` on(`test`.`t4`.`a4` = `test`.`t1`.`a1` and `test`.`t1`.`a1` is not null) left join `test`.`t5` on(`test`.`t5`.`a5` = `test`.`t3`.`a3`) where 1
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;
@@ -5239,7 +5242,7 @@ EXPLAIN
SELECT * FROM t1 WHERE (t1.b) IN (SELECT c FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
-1 PRIMARY t2 hash_index c #hash#c:c 5:5 test.t1.b 8 Start temporary; End temporary; Using join buffer (flat, BNLH join)
+1 PRIMARY t2 hash_index c #hash#c:c 5:5 test.t1.b 8 Using index; Start temporary; End temporary; Using join buffer (flat, BNLH join)
SELECT * FROM t1 WHERE (t1.b) IN (SELECT c FROM t2);
a b
3914 17
@@ -5409,9 +5412,9 @@ WHERE t2.c IN (SELECT c FROM t3,t4 WHERE t4.a < 10) AND
t2.a BETWEEN 4 and 5
ORDER BY t2.b;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 1 Using filesort
+1 PRIMARY t1 system NULL NULL NULL NULL 1
1 PRIMARY t3 system NULL NULL NULL NULL 1
-1 PRIMARY t2 range a,c a 5 NULL 1 Using index condition; Using where
+1 PRIMARY t2 range a,c a 5 NULL 1 Using index condition; Using where; Using filesort
1 PRIMARY t4 ref c c 5 test.t2.c 2 Using where; Start temporary; End temporary
SELECT * FROM t1,t2
WHERE t2.c IN (SELECT c FROM t3,t4 WHERE t4.a < 10) AND
@@ -5606,8 +5609,8 @@ set join_cache_level = default;
set optimizer_switch=@tmp_optimizer_switch;
DROP TABLE t1,t2,t3;
#
-# Bug #925985: LEFT JOIN with optimize_join_buffer_size=off +
-# join_buffer_size > join_buffer_space_limit
+# lp:925985 LEFT JOIN with optimize_join_buffer_size=off +
+# join_buffer_size > join_buffer_space_limit
#
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (5), (3);
@@ -6004,4 +6007,13 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL Using where
1 SIMPLE user hash_ALL NULL #hash#$hj 1 information_schema.PROFILING.PAGE_FAULTS_MINOR 4 Using where; Using join buffer (flat, BNLH join)
set join_cache_level=default;
+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;
+f2
+drop table t1, t2;
+set join_buffer_size = default;
set @@optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/r/join_nested.result b/mysql-test/r/join_nested.result
index 6ddd39cbfec..917a31e2a79 100644
--- a/mysql-test/r/join_nested.result
+++ b/mysql-test/r/join_nested.result
@@ -79,7 +79,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where ((`test`.`t3`.`a` = 1) or isnull(`test`.`t3`.`c`))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t4`.`b` = `test`.`t2`.`b`) where `test`.`t3`.`a` = 1 or `test`.`t3`.`c` is null
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
FROM t2
LEFT JOIN
@@ -156,7 +156,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where ((`test`.`t3`.`a` > 1) or isnull(`test`.`t3`.`c`))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(`test`.`t4`.`b` = `test`.`t2`.`b`) where `test`.`t3`.`a` > 1 or `test`.`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
@@ -186,7 +186,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on((`test`.`t4`.`b` = `test`.`t2`.`b`)) where (((`test`.`t3`.`a` > 1) or isnull(`test`.`t3`.`c`)) and ((`test`.`t5`.`a` < 3) or isnull(`test`.`t5`.`c`)))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(`test`.`t4`.`b` = `test`.`t2`.`b`) where (`test`.`t3`.`a` > 1 or `test`.`t3`.`c` is null) and (`test`.`t5`.`a` < 3 or `test`.`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
@@ -235,7 +235,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t7`.`b`) and (`test`.`t6`.`b` < 10))) where 1
+Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t7`.`b` and `test`.`t6`.`b` < 10) where 1
SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
FROM (t6, t7)
LEFT JOIN
@@ -556,7 +556,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b`) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and (`test`.`t2`.`a` >= 4 or `test`.`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
@@ -652,7 +652,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b`) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null)
SELECT t9.a,t9.b
FROM t9;
a b
@@ -843,7 +843,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`))) where (`test`.`t1`.`a` <= 2)
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b`) where `test`.`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
@@ -858,7 +858,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2 100.00 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t3`.`b` is not null))) where 1
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t3`.`b` and `test`.`t2`.`b` = `test`.`t3`.`b` and `test`.`t2`.`a` > 0 and `test`.`t3`.`b` is not null) where 1
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
FROM (t3,t4)
LEFT JOIN
@@ -920,7 +920,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t3`.`b` = `test`.`t4`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null)
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);
@@ -972,7 +972,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t4`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`a` > 0)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`c` is null)
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
@@ -1022,7 +1022,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t8`.`a` >= 0) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t4`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t8`.`a` >= 0 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`a` > 0)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`c` is null)
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);
@@ -1073,7 +1073,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2) and (`test`.`t1`.`a` > 0))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2 and `test`.`t1`.`a` > 0) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`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,t9.a,t9.b
FROM t0,t1
@@ -1843,7 +1843,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 1 100.00 Using where; Not exists
1 SIMPLE t4 ALL NULL NULL NULL NULL 0 0.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on((`test`.`t3`.`b` = `test`.`t1`.`a`)) left join `test`.`t4` on((`test`.`t4`.`b` = `test`.`t3`.`a`))) on((`test`.`t2`.`a` = `test`.`t1`.`a`)) where isnull(`test`.`t3`.`a`)
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t1`.`a`) left join `test`.`t4` on(`test`.`t4`.`b` = `test`.`t3`.`a`)) on(`test`.`t2`.`a` = `test`.`t1`.`a`) where `test`.`t3`.`a` is null
DROP TABLE t1,t2,t3,t4;
SET optimizer_switch=@save_optimizer_switch;
End of 5.0 tests
@@ -1923,7 +1923,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
Warnings:
-Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`test`.`t2a`.`K2` AS `K2`,`test`.`t2a`.`K1r` AS `K1r`,`test`.`t2a`.`rowTimestamp` AS `rowTimestamp`,`test`.`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on((`test`.`t2i`.`K1r` = 1))) on(((`test`.`t1i`.`K1` = 1) and (((`test`.`t2i`.`K1r` = 1) and (`test`.`t2i`.`rowTimestamp` > `test`.`t2a`.`rowTimestamp`)) or ((`test`.`t2i`.`rowTimestamp` = `test`.`t2a`.`rowTimestamp`) and (`test`.`t2i`.`K2` > `test`.`t2a`.`K2`)) or isnull(`test`.`t2i`.`K2`)))) where ((`test`.`t2a`.`K1r` = 1) and isnull(`test`.`t2i`.`K2`))
+Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`test`.`t2a`.`K2` AS `K2`,`test`.`t2a`.`K1r` AS `K1r`,`test`.`t2a`.`rowTimestamp` AS `rowTimestamp`,`test`.`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on(`test`.`t2i`.`K1r` = 1)) on(`test`.`t1i`.`K1` = 1 and (`test`.`t2i`.`K1r` = 1 and `test`.`t2i`.`rowTimestamp` > `test`.`t2a`.`rowTimestamp` or `test`.`t2i`.`rowTimestamp` = `test`.`t2a`.`rowTimestamp` and `test`.`t2i`.`K2` > `test`.`t2a`.`K2` or `test`.`t2i`.`K2` is null)) where `test`.`t2a`.`K1r` = 1 and `test`.`t2i`.`K2` is null
CREATE VIEW v1 AS
SELECT t2i.*
FROM t1 as t1i LEFT JOIN t2 as t2i ON t2i.K1r = t1i.K1
@@ -1962,7 +1962,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
Warnings:
-Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`t2a`.`K2` AS `K2`,`t2a`.`K1r` AS `K1r`,`t2a`.`rowTimestamp` AS `rowTimestamp`,`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on((`test`.`t2i`.`K1r` = 1))) on(((`test`.`t1i`.`K1` = 1) and (((`test`.`t2i`.`K1r` = 1) and (`test`.`t2i`.`rowTimestamp` > `t2a`.`rowTimestamp`)) or ((`test`.`t2i`.`rowTimestamp` = `t2a`.`rowTimestamp`) and (`test`.`t2i`.`K2` > `t2a`.`K2`)) or isnull(`test`.`t2i`.`K2`)))) where ((`t2a`.`K1r` = 1) and isnull(`test`.`t2i`.`K2`))
+Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`t2a`.`K2` AS `K2`,`t2a`.`K1r` AS `K1r`,`t2a`.`rowTimestamp` AS `rowTimestamp`,`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on(`test`.`t2i`.`K1r` = 1)) on(`test`.`t1i`.`K1` = 1 and (`test`.`t2i`.`K1r` = 1 and `test`.`t2i`.`rowTimestamp` > `t2a`.`rowTimestamp` or `test`.`t2i`.`rowTimestamp` = `t2a`.`rowTimestamp` and `test`.`t2i`.`K2` > `t2a`.`K2` or `test`.`t2i`.`K2` is null)) where `t2a`.`K1r` = 1 and `test`.`t2i`.`K2` is null
DROP VIEW v1;
DROP TABLE t1,t2;
set optimizer_search_depth= @tmp_mdev621;
diff --git a/mysql-test/r/join_nested_jcl6.result b/mysql-test/r/join_nested_jcl6.result
index bac8e1cb7db..1ffd94547cc 100644
--- a/mysql-test/r/join_nested_jcl6.result
+++ b/mysql-test/r/join_nested_jcl6.result
@@ -90,7 +90,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) where ((`test`.`t3`.`a` = 1) or isnull(`test`.`t3`.`c`))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) where `test`.`t3`.`a` = 1 or `test`.`t3`.`c` is null
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
FROM t2
LEFT JOIN
@@ -167,7 +167,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) where ((`test`.`t3`.`a` > 1) or isnull(`test`.`t3`.`c`))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(`test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) where `test`.`t3`.`a` > 1 or `test`.`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
@@ -197,7 +197,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) where (((`test`.`t3`.`a` > 1) or isnull(`test`.`t3`.`c`)) and ((`test`.`t5`.`a` < 3) or isnull(`test`.`t5`.`c`)))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(`test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) where (`test`.`t3`.`a` > 1 or `test`.`t3`.`c` is null) and (`test`.`t5`.`a` < 3 or `test`.`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
@@ -246,7 +246,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t7.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
Warnings:
-Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t7`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t7`.`b` is not null))) where 1
+Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t7`.`b` and `test`.`t6`.`b` < 10 and `test`.`t7`.`b` is not null) where 1
SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
FROM (t6, t7)
LEFT JOIN
@@ -567,7 +567,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and (`test`.`t2`.`a` >= 4 or `test`.`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
@@ -663,7 +663,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null)
SELECT t9.a,t9.b
FROM t9;
a b
@@ -854,7 +854,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) where (`test`.`t1`.`a` <= 2)
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) where `test`.`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
@@ -869,7 +869,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t3`.`b` is not null))) where 1
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t3`.`b` and `test`.`t2`.`b` = `test`.`t3`.`b` and `test`.`t2`.`a` > 0 and `test`.`t3`.`b` is not null) where 1
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
FROM (t3,t4)
LEFT JOIN
@@ -931,7 +931,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t3`.`b` = `test`.`t4`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null)
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);
@@ -983,7 +983,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t4`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`a` > 0 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`c` is null)
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
@@ -1033,7 +1033,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t8`.`a` >= 0) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t4`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t8`.`a` >= 0 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`a` > 0 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`c` is null)
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);
@@ -1084,7 +1084,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2) and (`test`.`t1`.`a` > 0))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2 and `test`.`t1`.`a` > 0) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`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,t9.a,t9.b
FROM t0,t1
@@ -1854,7 +1854,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.a 1 100.00 Using where; Not exists; Using join buffer (incremental, BNLH join)
1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t3.a 0 0.00 Using where; Using join buffer (incremental, BNLH join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on((`test`.`t3`.`b` = `test`.`t1`.`a`)) left join `test`.`t4` on(((`test`.`t4`.`b` = `test`.`t3`.`a`) and (`test`.`t3`.`a` is not null)))) on((`test`.`t2`.`a` = `test`.`t1`.`a`)) where isnull(`test`.`t3`.`a`)
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t1`.`a`) left join `test`.`t4` on(`test`.`t4`.`b` = `test`.`t3`.`a` and `test`.`t3`.`a` is not null)) on(`test`.`t2`.`a` = `test`.`t1`.`a`) where `test`.`t3`.`a` is null
DROP TABLE t1,t2,t3,t4;
SET optimizer_switch=@save_optimizer_switch;
End of 5.0 tests
@@ -1934,7 +1934,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
Warnings:
-Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`test`.`t2a`.`K2` AS `K2`,`test`.`t2a`.`K1r` AS `K1r`,`test`.`t2a`.`rowTimestamp` AS `rowTimestamp`,`test`.`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on((`test`.`t2i`.`K1r` = 1))) on(((`test`.`t1i`.`K1` = 1) and (((`test`.`t2i`.`K1r` = 1) and (`test`.`t2i`.`rowTimestamp` > `test`.`t2a`.`rowTimestamp`)) or ((`test`.`t2i`.`rowTimestamp` = `test`.`t2a`.`rowTimestamp`) and (`test`.`t2i`.`K2` > `test`.`t2a`.`K2`)) or isnull(`test`.`t2i`.`K2`)))) where ((`test`.`t2a`.`K1r` = 1) and isnull(`test`.`t2i`.`K2`))
+Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`test`.`t2a`.`K2` AS `K2`,`test`.`t2a`.`K1r` AS `K1r`,`test`.`t2a`.`rowTimestamp` AS `rowTimestamp`,`test`.`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on(`test`.`t2i`.`K1r` = 1)) on(`test`.`t1i`.`K1` = 1 and (`test`.`t2i`.`K1r` = 1 and `test`.`t2i`.`rowTimestamp` > `test`.`t2a`.`rowTimestamp` or `test`.`t2i`.`rowTimestamp` = `test`.`t2a`.`rowTimestamp` and `test`.`t2i`.`K2` > `test`.`t2a`.`K2` or `test`.`t2i`.`K2` is null)) where `test`.`t2a`.`K1r` = 1 and `test`.`t2i`.`K2` is null
CREATE VIEW v1 AS
SELECT t2i.*
FROM t1 as t1i LEFT JOIN t2 as t2i ON t2i.K1r = t1i.K1
@@ -1973,7 +1973,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
Warnings:
-Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`t2a`.`K2` AS `K2`,`t2a`.`K1r` AS `K1r`,`t2a`.`rowTimestamp` AS `rowTimestamp`,`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on((`test`.`t2i`.`K1r` = 1))) on(((`test`.`t1i`.`K1` = 1) and (((`test`.`t2i`.`K1r` = 1) and (`test`.`t2i`.`rowTimestamp` > `t2a`.`rowTimestamp`)) or ((`test`.`t2i`.`rowTimestamp` = `t2a`.`rowTimestamp`) and (`test`.`t2i`.`K2` > `t2a`.`K2`)) or isnull(`test`.`t2i`.`K2`)))) where ((`t2a`.`K1r` = 1) and isnull(`test`.`t2i`.`K2`))
+Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`t2a`.`K2` AS `K2`,`t2a`.`K1r` AS `K1r`,`t2a`.`rowTimestamp` AS `rowTimestamp`,`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on(`test`.`t2i`.`K1r` = 1)) on(`test`.`t1i`.`K1` = 1 and (`test`.`t2i`.`K1r` = 1 and `test`.`t2i`.`rowTimestamp` > `t2a`.`rowTimestamp` or `test`.`t2i`.`rowTimestamp` = `t2a`.`rowTimestamp` and `test`.`t2i`.`K2` > `t2a`.`K2` or `test`.`t2i`.`K2` is null)) where `t2a`.`K1r` = 1 and `test`.`t2i`.`K2` is null
DROP VIEW v1;
DROP TABLE t1,t2;
set optimizer_search_depth= @tmp_mdev621;
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 312b36c16ca..3905ec8a7d4 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -601,8 +601,6 @@ id int(11) DEFAULT '0' NOT NULL,
name tinytext DEFAULT '' NOT NULL,
UNIQUE id (id)
);
-Warnings:
-Warning 1101 BLOB/TEXT column 'name' can't have a default value
INSERT INTO t1 VALUES (1,'yes'),(2,'no');
CREATE TABLE t2 (
id int(11) DEFAULT '0' NOT NULL,
@@ -1290,8 +1288,8 @@ SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b )
FROM t1 JOIN t2 USING( a )
GROUP BY t1.a WITH ROLLUP;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 1 Using filesort
-1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using where
+1 SIMPLE t1 system NULL NULL NULL NULL 1
+1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using where; Using filesort
SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b )
FROM t1 JOIN t2 USING( a )
GROUP BY t1.a WITH ROLLUP;
@@ -1388,7 +1386,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE jt5 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index
1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index
Warnings:
-Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt1` left join (`test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(((`test`.`jt6`.`f1` <> 0) and 1))) on(1) where 1
+Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt1` left join (`test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` <> 0 and 1)) on(1) where 1
EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1
RIGHT JOIN t1 AS jt2
RIGHT JOIN t1 AS jt3
@@ -1405,7 +1403,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index
1 SIMPLE jt1 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index
Warnings:
-Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(((`test`.`jt6`.`f1` <> 0) and 1)) left join `test`.`t1` `jt1` on(1) where 1
+Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` <> 0 and 1) left join `test`.`t1` `jt1` on(1) where 1
DROP TABLE t1;
#
# Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
@@ -1430,8 +1428,8 @@ 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;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 Using filesort
-1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using where; Using index
+1 SIMPLE t1 system PRIMARY NULL NULL NULL 1
+1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using where; Using index; Using filesort
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;
@@ -1748,7 +1746,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 test.t3.pk 1 100.00 Using index
Warnings:
Note 1276 Field or reference 'test.t2.pk' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`pk` AS `pk`,<expr_cache><`test`.`t2`.`pk`>((select (`test`.`t3`.`pk` + if(isnull(`test`.`t4`.`pk`),0,`test`.`t4`.`pk`)) from `test`.`t3` left join `test`.`t4` on((`test`.`t4`.`pk` = `test`.`t3`.`pk`)) where (`test`.`t3`.`pk` = (`test`.`t2`.`pk` + 1000)) limit 1)) AS `t` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`pk` = (`test`.`t1`.`pk` + 1000)) and (`test`.`t1`.`pk` > 1000)) group by `test`.`t2`.`pk`
+Note 1003 select `test`.`t2`.`pk` AS `pk`,<expr_cache><`test`.`t2`.`pk`>((select `test`.`t3`.`pk` + if(`test`.`t4`.`pk` is null,0,`test`.`t4`.`pk`) from `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`pk` = `test`.`t3`.`pk`) where `test`.`t3`.`pk` = `test`.`t2`.`pk` + 1000 limit 1)) AS `t` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`pk` = `test`.`t1`.`pk` + 1000 and `test`.`t1`.`pk` > 1000 group by `test`.`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
@@ -1849,8 +1847,8 @@ 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;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 Using filesort
-1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using where; Using index
+1 SIMPLE t1 system PRIMARY NULL NULL NULL 1
+1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using where; Using index; Using filesort
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;
@@ -2008,9 +2006,9 @@ SELECT * FROM (t2 LEFT JOIN t1 ON t1.b = t2.b) JOIN t3 ON t1.b = t3.b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t3 hash_ALL PRIMARY #hash#PRIMARY 4 test.t1.b 10 10.00 Using join buffer (flat, BNLH join)
-1 SIMPLE t2 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t1.b 27 3.70 Using join buffer (incremental, BNLH join)
+1 SIMPLE t2 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t1.b 27 3.70 Using index; Using join buffer (incremental, BNLH join)
Warnings:
-Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t2` join `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t1`.`b`))
+Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t2` join `test`.`t1` join `test`.`t3` where `test`.`t3`.`b` = `test`.`t1`.`b` and `test`.`t2`.`b` = `test`.`t1`.`b`
PREPARE stmt FROM
'SELECT * FROM (t2 LEFT JOIN t1 ON t1.b = t2.b) JOIN t3 ON t1.b = t3.b';
EXECUTE stmt;
@@ -2079,7 +2077,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ref idx idx 4 const 2 100.00 Using where
1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00
Warnings:
-Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b`
+Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`b` = 5 order by `test`.`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;
@@ -2096,7 +2094,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where
1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00
Warnings:
-Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b`
+Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`b` = 5 order by `test`.`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;
@@ -2223,7 +2221,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`i2` = `test`.`t1`.`i1`) and (`test`.`t3`.`i3` = `test`.`t1`.`i1`))) where ((`test`.`t3`.`d3` = 0) or isnull(`test`.`t3`.`d3`))
+Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`i2` = `test`.`t1`.`i1` and `test`.`t3`.`i3` = `test`.`t1`.`i1`) where `test`.`t3`.`d3` = 0 or `test`.`t3`.`d3` is null
DROP TABLE t1,t2,t3;
#
# Bug mdev-6705: wrong on expression after constant row substitution
@@ -2243,7 +2241,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`d` = 10)) where ((`test`.`t2`.`c` = 8) and (`test`.`t3`.`d` = 8))
+Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`d` = 10) where `test`.`t2`.`c` = 8 and `test`.`t3`.`d` = 8
SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a
WHERE b IN (1,2,3) OR b = d;
a b c d
@@ -2319,7 +2317,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00
Warnings:
-Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`v3` = 4) and (`test`.`t1`.`i1` = `test`.`t3`.`i3`) and (`test`.`t2`.`i2` = `test`.`t3`.`i3`))
+Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3`
# This should have the same join order like the query above:
EXPLAIN EXTENDED
SELECT * FROM
@@ -2337,7 +2335,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00
Warnings:
-Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`v3` = 4) and (`test`.`t1`.`i1` = `test`.`t3`.`i3`) and (`test`.`t2`.`i2` = `test`.`t3`.`i3`))
+Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3`
drop table t1,t2,t3;
#
# MDEV-11958: LEFT JOIN with stored routine produces incorrect result
@@ -2360,7 +2358,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on((`test`.`t2`.`x` = `test`.`t1`.`x`)) where (ifnull(`test`.`t2`.`x`,0) = 0)
+Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x`) where ifnull(`test`.`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
@@ -2376,7 +2374,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on((`test`.`t2`.`x` = `test`.`t1`.`x`)) where (`f`(`test`.`t2`.`x`,0) = 0)
+Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x`) where `f`(`test`.`t2`.`x`,0) = 0
drop function f;
drop table t;
CREATE TABLE t1 (
@@ -2416,7 +2414,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on((`test`.`t2`.`col2` = `test`.`t1`.`col1`)) where (ifnull(`test`.`t2`.`col3`,0) = 0)
+Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where ifnull(`test`.`t2`.`col3`,0) = 0
SELECT t1.col1, t2.col1, t2.col3
FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
WHERE f1(t2.col3,0) = 0;
@@ -2430,7 +2428,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on((`test`.`t2`.`col2` = `test`.`t1`.`col1`)) where (`f1`(`test`.`t2`.`col3`,0) = 0)
+Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where `f1`(`test`.`t2`.`col3`,0) = 0
DROP FUNCTION f1;
DROP TABLE t1,t2;
#
diff --git a/mysql-test/r/join_outer_innodb.result b/mysql-test/r/join_outer_innodb.result
index 339cc59ed69..6f3fb09329d 100644
--- a/mysql-test/r/join_outer_innodb.result
+++ b/mysql-test/r/join_outer_innodb.result
@@ -196,7 +196,7 @@ 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 INTO t1 VALUES
+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);
diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result
index a006bafcfc0..6e2bbc25aa0 100644
--- a/mysql-test/r/join_outer_jcl6.result
+++ b/mysql-test/r/join_outer_jcl6.result
@@ -612,8 +612,6 @@ id int(11) DEFAULT '0' NOT NULL,
name tinytext DEFAULT '' NOT NULL,
UNIQUE id (id)
);
-Warnings:
-Warning 1101 BLOB/TEXT column 'name' can't have a default value
INSERT INTO t1 VALUES (1,'yes'),(2,'no');
CREATE TABLE t2 (
id int(11) DEFAULT '0' NOT NULL,
@@ -1301,8 +1299,8 @@ SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b )
FROM t1 JOIN t2 USING( a )
GROUP BY t1.a WITH ROLLUP;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 1 Using filesort
-1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using where
+1 SIMPLE t1 system NULL NULL NULL NULL 1
+1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using where; Using filesort
SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b )
FROM t1 JOIN t2 USING( a )
GROUP BY t1.a WITH ROLLUP;
@@ -1399,7 +1397,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE jt5 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join)
1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join)
Warnings:
-Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt1` left join (`test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(((`test`.`jt6`.`f1` <> 0) and 1))) on(1) where 1
+Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt1` left join (`test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` <> 0 and 1)) on(1) where 1
EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1
RIGHT JOIN t1 AS jt2
RIGHT JOIN t1 AS jt3
@@ -1416,7 +1414,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join)
1 SIMPLE jt1 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join)
Warnings:
-Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(((`test`.`jt6`.`f1` <> 0) and 1)) left join `test`.`t1` `jt1` on(1) where 1
+Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` <> 0 and 1) left join `test`.`t1` `jt1` on(1) where 1
DROP TABLE t1;
#
# Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
@@ -1441,8 +1439,8 @@ 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;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 Using filesort
-1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using where; Using index
+1 SIMPLE t1 system PRIMARY NULL NULL NULL 1
+1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using where; Using index; Using filesort
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;
@@ -1759,7 +1757,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 test.t3.pk 1 100.00 Using index
Warnings:
Note 1276 Field or reference 'test.t2.pk' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`pk` AS `pk`,<expr_cache><`test`.`t2`.`pk`>((select (`test`.`t3`.`pk` + if(isnull(`test`.`t4`.`pk`),0,`test`.`t4`.`pk`)) from `test`.`t3` left join `test`.`t4` on((`test`.`t4`.`pk` = `test`.`t3`.`pk`)) where (`test`.`t3`.`pk` = (`test`.`t2`.`pk` + 1000)) limit 1)) AS `t` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`pk` = (`test`.`t1`.`pk` + 1000)) and (`test`.`t1`.`pk` > 1000)) group by `test`.`t2`.`pk`
+Note 1003 select `test`.`t2`.`pk` AS `pk`,<expr_cache><`test`.`t2`.`pk`>((select `test`.`t3`.`pk` + if(`test`.`t4`.`pk` is null,0,`test`.`t4`.`pk`) from `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`pk` = `test`.`t3`.`pk`) where `test`.`t3`.`pk` = `test`.`t2`.`pk` + 1000 limit 1)) AS `t` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`pk` = `test`.`t1`.`pk` + 1000 and `test`.`t1`.`pk` > 1000 group by `test`.`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
@@ -1860,8 +1858,8 @@ 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;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 Using filesort
-1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using where; Using index
+1 SIMPLE t1 system PRIMARY NULL NULL NULL 1
+1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using where; Using index; Using filesort
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;
@@ -2019,9 +2017,9 @@ SELECT * FROM (t2 LEFT JOIN t1 ON t1.b = t2.b) JOIN t3 ON t1.b = t3.b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t3 hash_ALL PRIMARY #hash#PRIMARY 4 test.t1.b 10 10.00 Using join buffer (flat, BNLH join)
-1 SIMPLE t2 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t1.b 27 3.70 Using join buffer (incremental, BNLH join)
+1 SIMPLE t2 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t1.b 27 3.70 Using index; Using join buffer (incremental, BNLH join)
Warnings:
-Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t2` join `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t1`.`b`))
+Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t2` join `test`.`t1` join `test`.`t3` where `test`.`t3`.`b` = `test`.`t1`.`b` and `test`.`t2`.`b` = `test`.`t1`.`b`
PREPARE stmt FROM
'SELECT * FROM (t2 LEFT JOIN t1 ON t1.b = t2.b) JOIN t3 ON t1.b = t3.b';
EXECUTE stmt;
@@ -2090,7 +2088,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ref idx idx 4 const 2 100.00 Using where
1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00
Warnings:
-Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b`
+Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`b` = 5 order by `test`.`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;
@@ -2107,7 +2105,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where
1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00
Warnings:
-Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b`
+Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`b` = 5 order by `test`.`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;
@@ -2234,7 +2232,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`i2` = `test`.`t1`.`i1`) and (`test`.`t3`.`i3` = `test`.`t1`.`i1`))) where ((`test`.`t3`.`d3` = 0) or isnull(`test`.`t3`.`d3`))
+Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`i2` = `test`.`t1`.`i1` and `test`.`t3`.`i3` = `test`.`t1`.`i1`) where `test`.`t3`.`d3` = 0 or `test`.`t3`.`d3` is null
DROP TABLE t1,t2,t3;
#
# Bug mdev-6705: wrong on expression after constant row substitution
@@ -2254,7 +2252,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`d` = 10)) where ((`test`.`t2`.`c` = 8) and (`test`.`t3`.`d` = 8))
+Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`d` = 10) where `test`.`t2`.`c` = 8 and `test`.`t3`.`d` = 8
SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a
WHERE b IN (1,2,3) OR b = d;
a b c d
@@ -2330,7 +2328,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00
Warnings:
-Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`v3` = 4) and (`test`.`t1`.`i1` = `test`.`t3`.`i3`) and (`test`.`t2`.`i2` = `test`.`t3`.`i3`))
+Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3`
# This should have the same join order like the query above:
EXPLAIN EXTENDED
SELECT * FROM
@@ -2348,7 +2346,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00
Warnings:
-Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`v3` = 4) and (`test`.`t1`.`i1` = `test`.`t3`.`i3`) and (`test`.`t2`.`i2` = `test`.`t3`.`i3`))
+Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3`
drop table t1,t2,t3;
#
# MDEV-11958: LEFT JOIN with stored routine produces incorrect result
@@ -2371,7 +2369,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on((`test`.`t2`.`x` = `test`.`t1`.`x`)) where (ifnull(`test`.`t2`.`x`,0) = 0)
+Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x`) where ifnull(`test`.`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
@@ -2387,7 +2385,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on((`test`.`t2`.`x` = `test`.`t1`.`x`)) where (`f`(`test`.`t2`.`x`,0) = 0)
+Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x`) where `f`(`test`.`t2`.`x`,0) = 0
drop function f;
drop table t;
CREATE TABLE t1 (
@@ -2427,7 +2425,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on((`test`.`t2`.`col2` = `test`.`t1`.`col1`)) where (ifnull(`test`.`t2`.`col3`,0) = 0)
+Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where ifnull(`test`.`t2`.`col3`,0) = 0
SELECT t1.col1, t2.col1, t2.col3
FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
WHERE f1(t2.col3,0) = 0;
@@ -2441,7 +2439,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on((`test`.`t2`.`col2` = `test`.`t1`.`col1`)) where (`f1`(`test`.`t2`.`col3`,0) = 0)
+Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where `f1`(`test`.`t2`.`col3`,0) = 0
DROP FUNCTION f1;
DROP TABLE t1,t2;
#
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index ed541c791e1..ba1124aaa14 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -32,7 +32,7 @@ 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 INTO t1 VALUES (900,'Vancouver','Shared/Roomate','','','','');
+INSERT IGNORE INTO t1 VALUES (900,'Vancouver','Shared/Roomate','','','','');
Warnings:
Warning 1265 Data truncated for column 'transityes' at row 1
Warning 1265 Data truncated for column 'shopsyes' at row 1
@@ -157,7 +157,7 @@ t1 1 c 1 c A NULL NULL NULL YES BTREE
drop table t1;
CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT,
UNIQUE (c,i));
-INSERT INTO t1 (c) VALUES (NULL),(NULL);
+INSERT IGNORE INTO t1 (c) VALUES (NULL),(NULL);
Warnings:
Warning 1048 Column 'c' cannot be null
Warning 1048 Column 'c' cannot be null
@@ -189,10 +189,10 @@ a 1
a 2
drop table t1;
create table t1 (i int, a char(200), b text, unique (a), unique (b(300))) charset utf8;
-insert t1 values (1, repeat('a',210), repeat('b', 310));
+insert ignore t1 values (1, repeat('a',210), repeat('b', 310));
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
-insert t1 values (2, repeat(0xD0B1,215), repeat(0xD0B1, 310));
+insert ignore t1 values (2, repeat(0xD0B1,215), repeat(0xD0B1, 310));
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select i, length(a), length(b), char_length(a), char_length(b) from t1;
@@ -243,7 +243,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` varchar(30) CHARACTER SET utf8 DEFAULT NULL,
- `t` text CHARACTER SET utf8,
+ `t` text CHARACTER SET utf8 DEFAULT NULL,
UNIQUE KEY `c` (`c`(2)),
UNIQUE KEY `t` (`t`(3))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
@@ -428,14 +428,14 @@ index i5 (c1, c2, c3, c4),
primary key (c2, c3),
index (c2, c4));
Warnings:
-Note 1831 Duplicate index `i1`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i1`. This is deprecated and will be disallowed in a future release
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) DEFAULT NULL,
`c2` char(12) NOT NULL,
`c3` varchar(123) NOT NULL,
- `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`c2`,`c3`),
UNIQUE KEY `i4` (`c4`),
KEY `c1` (`c1`),
@@ -448,17 +448,17 @@ t1 CREATE TABLE `t1` (
alter table t1 drop index c1;
alter table t1 add index (c1);
Warnings:
-Note 1831 Duplicate index `c1`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `c1`. This is deprecated and will be disallowed in a future release
alter table t1 add index (c1);
Warnings:
-Note 1831 Duplicate index `c1_2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `c1_2`. This is deprecated and will be disallowed in a future release
alter table t1 drop index i3;
alter table t1 add index i3 (c3);
alter table t1 drop index i2, drop index i4;
alter table t1 add index i2 (c2), add index i4 (c4);
alter table t1 drop index i2, drop index i4, add index i6 (c2, c4);
Warnings:
-Note 1831 Duplicate index `i6`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i6`. This is deprecated and will be disallowed in a future release
alter table t1 add index i2 (c2), add index i4 (c4), drop index i6;
alter table t1 drop index i2, drop index i4, add unique i4 (c4);
alter table t1 add index i2 (c2), drop index i4, add index i4 (c4);
@@ -467,14 +467,14 @@ alter table t1 drop index c2, add index (c2(4),c3(7));
alter table t1 add primary key (c1, c2), drop primary key;
alter table t1 drop primary key;
alter table t1 add primary key (c1, c2), drop primary key;
-ERROR 42000: Can't DROP 'PRIMARY'; check that column/key exists
+ERROR 42000: Can't DROP INDEX `PRIMARY`; check that it exists
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` char(12) NOT NULL,
`c3` varchar(123) NOT NULL,
- `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
KEY `i1` (`c1`),
KEY `i5` (`c1`,`c2`,`c3`,`c4`),
KEY `c1` (`c1`),
diff --git a/mysql-test/r/keyread.result b/mysql-test/r/keyread.result
new file mode 100644
index 00000000000..d8e9659d4bb
--- /dev/null
+++ b/mysql-test/r/keyread.result
@@ -0,0 +1,6 @@
+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;
+f1
+drop view v1;
+drop table t1;
diff --git a/mysql-test/r/keywords.result b/mysql-test/r/keywords.result
index a3588017e97..8c510b712ce 100644
--- a/mysql-test/r/keywords.result
+++ b/mysql-test/r/keywords.result
@@ -275,3 +275,59 @@ set option=1;
ERROR HY000: Unknown system variable 'option'
set option option=1;
ERROR HY000: Unknown system variable 'option'
+#
+# MDEV-9979 Keywords UNBOUNDED, PRECEDING, FOLLOWING, TIES, OTHERS should be non-reserved
+#
+CREATE TABLE EXCLUDE (EXCLUDE INT);
+SELECT EXCLUDE FROM EXCLUDE;
+EXCLUDE
+SELECT EXCLUDE EXCLUDE FROM EXCLUDE;
+EXCLUDE
+SELECT EXCLUDE AS EXCLUDE FROM EXCLUDE;
+EXCLUDE
+DROP TABLE EXCLUDE;
+CREATE TABLE UNBOUNDED (UNBOUNDED INT);
+SELECT UNBOUNDED FROM UNBOUNDED;
+UNBOUNDED
+SELECT UNBOUNDED UNBOUNDEX FROM UNBOUNDED;
+UNBOUNDEX
+SELECT UNBOUNDED AS UNBOUNDEX FROM UNBOUNDED;
+UNBOUNDEX
+DROP TABLE UNBOUNDED;
+CREATE TABLE PRECEDING (PRECEDING INT);
+SELECT PRECEDING FROM PRECEDING;
+PRECEDING
+SELECT PRECEDING PRECEDING FROM PRECEDING;
+PRECEDING
+SELECT PRECEDING AS PRECEDING FROM PRECEDING;
+PRECEDING
+DROP TABLE PRECEDING;
+CREATE TABLE FOLLOWING (FOLLOWING INT);
+SELECT FOLLOWING FROM FOLLOWING;
+FOLLOWING
+SELECT FOLLOWING FOLLOWING FROM FOLLOWING;
+FOLLOWING
+SELECT FOLLOWING AS FOLLOWING FROM FOLLOWING;
+FOLLOWING
+DROP TABLE FOLLOWING;
+CREATE TABLE TIES (TIES INT);
+SELECT TIES FROM TIES;
+TIES
+SELECT TIES TIES FROM TIES;
+TIES
+SELECT TIES AS TIES FROM TIES;
+TIES
+DROP TABLE TIES;
+CREATE TABLE OTHERS (OTHERS INT);
+SELECT OTHERS FROM OTHERS;
+OTHERS
+SELECT OTHERS OTHERS FROM OTHERS;
+OTHERS
+SELECT OTHERS AS OTHERS FROM OTHERS;
+OTHERS
+DROP TABLE OTHERS;
+#
+# MDEV-10585 EXECUTE IMMEDIATE statement
+#
+CREATE TABLE immediate (immediate int);
+DROP TABLE immediate;
diff --git a/mysql-test/r/kill-2.result b/mysql-test/r/kill-2.result
index c2bcc979441..daaba2c092a 100644
--- a/mysql-test/r/kill-2.result
+++ b/mysql-test/r/kill-2.result
@@ -2,6 +2,8 @@
# MDEV-6896 kill user command cause MariaDB crash!
#
create user foo@'127.0.0.1';
+connect con1,127.0.0.1,foo,,;
+connection default;
select user from information_schema.processlist;
user
foo
diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result
index d40c4ee758c..dc1cb9252da 100644
--- a/mysql-test/r/kill.result
+++ b/mysql-test/r/kill.result
@@ -9,11 +9,18 @@ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
KILL tid;
RETURN (SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID = tid);
END|
+connect con1, localhost, root,,;
+connect con2, localhost, root,,;
+connection con1;
+connection con2;
+connection con1;
SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read';
+connection con2;
SET DEBUG_SYNC='now WAIT_FOR con1_read';
SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
SET DEBUG_SYNC = 'RESET';
+connection con1;
SELECT 1;
Got one of the listed errors
SELECT 1;
@@ -22,16 +29,23 @@ SELECT 1;
SELECT @id != CONNECTION_ID();
@id != CONNECTION_ID()
1
+connection con2;
SELECT 4;
4
4
+connection default;
KILL (SELECT COUNT(*) FROM mysql.user);
-ERROR 42000: KILL does not support subqueries or stored functions.
+ERROR 42000: KILL does not support subqueries or stored functions
+connection con1;
+connection con2;
+connection con1;
SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read WAIT_FOR kill';
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR con1_read';
SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
SET DEBUG_SYNC = 'RESET';
+connection con1;
SELECT 1;
Got one of the listed errors
SELECT 1;
@@ -40,9 +54,11 @@ SELECT 1;
SELECT @id != CONNECTION_ID();
@id != CONNECTION_ID()
1
+connection con2;
SELECT 4;
4
4
+connection default;
CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT);
CREATE TABLE t2 (id INT UNSIGNED NOT NULL);
INSERT INTO t1 VALUES
@@ -52,25 +68,36 @@ INSERT INTO t1 VALUES
(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;
+connection con2;
+connection con1;
SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync';
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;
Got one of the listed errors
SELECT 1;
1
1
+connection default;
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1, t2;
+connection con1;
+connection con2;
+connection con1;
SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync WAIT_FOR kill';
SELECT ACOS(0);
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
KILL QUERY @id;
+connection con1;
ACOS(0)
1.5707963267948966
SELECT 1;
@@ -79,6 +106,7 @@ SELECT 1;
SELECT @id = CONNECTION_ID();
@id = CONNECTION_ID()
1
+connection default;
SET DEBUG_SYNC = 'RESET';
CREATE TABLE t1 (f1 INT);
CREATE FUNCTION bug27563() RETURNS INT(11)
@@ -89,40 +117,58 @@ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill';
RETURN 1;
END|
+connection con1;
+connection con2;
+connection con1;
INSERT INTO t1 VALUES (bug27563());
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
KILL QUERY @id;
+connection con1;
ERROR 70100: Query execution was interrupted
SELECT * FROM t1;
f1
+connection default;
SET DEBUG_SYNC = 'RESET';
INSERT INTO t1 VALUES(0);
+connection con1;
UPDATE t1 SET f1= bug27563();
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
KILL QUERY @id;
+connection con1;
ERROR 70100: Query execution was interrupted
SELECT * FROM t1;
f1
0
+connection default;
SET DEBUG_SYNC = 'RESET';
INSERT INTO t1 VALUES(1);
+connection con1;
DELETE FROM t1 WHERE bug27563() IS NULL;
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
KILL QUERY @id;
+connection con1;
ERROR 70100: Query execution was interrupted
SELECT * FROM t1;
f1
0
1
+connection default;
SET DEBUG_SYNC = 'RESET';
+connection con1;
SELECT * FROM t1 WHERE f1= bug27563();
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
KILL QUERY @id;
+connection con1;
ERROR 70100: Query execution was interrupted
SELECT * FROM t1;
f1
0
1
+connection default;
SET DEBUG_SYNC = 'RESET';
DROP FUNCTION bug27563;
CREATE TABLE t2 (f2 INT);
@@ -134,9 +180,12 @@ INSERT INTO t2 VALUES(0);
SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill';
INSERT INTO t2 VALUES(1);
END|
+connection con1;
INSERT INTO t1 VALUES(2),(3);
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
KILL QUERY @id;
+connection con1;
ERROR 70100: Query execution was interrupted
SELECT * FROM t1;
f1
@@ -145,26 +194,34 @@ f1
SELECT * FROM t2;
f2
0
+connection default;
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1, t2;
+connection con1;
+connection con2;
+connection con1;
SET SESSION optimizer_search_depth=0;
SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync';
PREPARE stmt FROM 'EXPLAIN SELECT * FROM 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 WHERE a1=a2 AND a2=a3 AND a3=a4 AND a4=a5 AND a5=a6 AND a6=a7 AND a7=a8 AND a8=a9 AND a9=a10 AND a10=a11 AND a11=a12 AND a12=a13 AND a13=a14 AND a14=a15 AND a15=a16 AND a16=a17 AND a17=a18 AND a18=a19 AND a19=a20 AND a20=a21 AND a21=a22 AND a22=a23 AND a23=a24 AND a24=a25 AND a25=a26 AND a26=a27 AND a27=a28 AND a28=a29 AND a29=a30 AND a30=a31 AND a31=a32 AND a32=a33 AND a33=a34 AND a34=a35 AND a35=a36 AND a36=a37 AND a37=a38 AND a38=a39 AND a39=a40 ';
EXECUTE stmt;
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
KILL QUERY @id;
+connection con1;
ERROR 70100: Query execution was interrupted
+connection default;
SET DEBUG_SYNC = 'RESET';
#
# Bug#19723: kill of active connection yields different error code
# depending on platform.
#
-
-# Connection: con1.
+connection con1;
SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
KILL @id;
ERROR 70100: Connection was killed
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
+connection con1;
# ER_SERVER_SHUTDOWN, CR_SERVER_GONE_ERROR, CR_SERVER_LOST,
# depending on the timing of close of the connection socket
SELECT 1;
@@ -175,6 +232,7 @@ SELECT 1;
SELECT @id != CONNECTION_ID();
@id != CONNECTION_ID()
1
+connection default;
SET DEBUG_SYNC = 'RESET';
#
# Additional test for WL#3726 "DDL locking for all metadata objects"
@@ -185,96 +243,99 @@ SET DEBUG_SYNC = 'RESET';
#
drop tables if exists t1, t2, t3;
create table t1 (i int primary key);
+connect blocker, localhost, root, , ;
+connect dml, localhost, root, , ;
+connect ddl, localhost, root, , ;
# Test for RENAME TABLE
-# Switching to connection 'blocker'
+connection blocker;
lock table t1 read;
-# Switching to connection 'ddl'
+connection ddl;
rename table t1 to t2;
-# Switching to connection 'default'
+connection default;
kill query ID;
-# Switching to connection 'ddl'
+connection ddl;
ERROR 70100: Query execution was interrupted
# Test for DROP TABLE
drop table t1;
-# Switching to connection 'default'
+connection default;
kill query ID;
-# Switching to connection 'ddl'
+connection ddl;
ERROR 70100: Query execution was interrupted
# Test for CREATE TRIGGER
create trigger t1_bi before insert on t1 for each row set @a:=1;
-# Switching to connection 'default'
+connection default;
kill query ID;
-# Switching to connection 'ddl'
+connection ddl;
ERROR 70100: Query execution was interrupted
#
# Tests for various kinds of ALTER TABLE
#
# Full-blown ALTER which should copy table
alter table t1 add column j int;
-# Switching to connection 'default'
+connection default;
kill query ID;
-# Switching to connection 'ddl'
+connection ddl;
ERROR 70100: Query execution was interrupted
# Two kinds of simple ALTER
alter table t1 rename to t2;
-# Switching to connection 'default'
+connection default;
kill query ID;
-# Switching to connection 'ddl'
+connection ddl;
ERROR 70100: Query execution was interrupted
alter table t1 disable keys;
-# Switching to connection 'default'
+connection default;
kill query ID;
-# Switching to connection 'ddl'
+connection ddl;
ERROR 70100: Query execution was interrupted
# Fast ALTER
alter table t1 alter column i set default 100;
-# Switching to connection 'default'
+connection default;
kill query ID;
-# Switching to connection 'ddl'
+connection ddl;
ERROR 70100: Query execution was interrupted
# Special case which is triggered only for MERGE tables.
-# Switching to connection 'blocker'
+connection blocker;
unlock tables;
create table t2 (i int primary key) engine=merge union=(t1);
lock tables t2 read;
-# Switching to connection 'ddl'
+connection ddl;
alter table t2 alter column i set default 100;
-# Switching to connection 'default'
+connection default;
kill query ID;
-# Switching to connection 'ddl'
+connection ddl;
ERROR 70100: Query execution was interrupted
# Test for DML waiting for meta-data lock
-# Switching to connection 'blocker'
+connection blocker;
unlock tables;
lock tables t1 read;
-# Switching to connection 'ddl'
+connection ddl;
truncate table t1;
-# Switching to connection 'dml'
+connection dml;
insert into t1 values (1);
-# Switching to connection 'default'
+connection default;
kill query ID2;
-# Switching to connection 'dml'
+connection dml;
ERROR 70100: Query execution was interrupted
-# Switching to connection 'blocker'
+connection blocker;
unlock tables;
-# Switching to connection 'ddl'
+connection ddl;
# Test for DML waiting for tables to be flushed
-# Switching to connection 'blocker'
+connection blocker;
lock tables t1 read;
-# Switching to connection 'ddl'
+connection ddl;
# Let us mark locked table t1 as old
flush tables;
-# Switching to connection 'dml'
+connection dml;
select * from t1;
-# Switching to connection 'default'
+connection default;
kill query ID2;
-# Switching to connection 'dml'
+connection dml;
ERROR 70100: Query execution was interrupted
-# Switching to connection 'blocker'
+connection blocker;
unlock tables;
-# Switching to connection 'ddl'
+connection ddl;
# Cleanup.
-# Switching to connection 'default'
+connection default;
drop table t1;
drop table t2;
#
@@ -282,6 +343,9 @@ drop table t2;
#
grant ALL on test.* to test@localhost;
grant ALL on test.* to test2@localhost;
+connect con3, localhost, test,,;
+connect con4, localhost, test2,,;
+connection default;
kill hard query user test2@nohost;
affected rows: 0
kill soft query user test@localhost;
@@ -296,16 +360,21 @@ 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;
select 1;
Got one of the listed errors
+connection con4;
select 1;
Got one of the listed errors
+connection default;
#
# MDEV-4911 - add KILL query id, and add query id information to
# processlist
#
SELECT SLEEP(1000);
+connection con1;
KILL QUERY ID @id;
+connection default;
SLEEP(1000)
1
KILL QUERY ID 0;
@@ -316,11 +385,16 @@ ERROR HY000: Unknown query id: 0
#
CREATE USER u1@localhost;
SELECT SLEEP(1000);
+connection con1;
+connect con5, localhost, u1,,;
KILL QUERY ID ID;
ERROR HY000: You are not owner of query ID
+connection con1;
KILL QUERY ID @id;
+connection default;
SLEEP(1000)
1
+disconnect con5;
DROP USER u1@localhost;
SET DEBUG_SYNC = 'RESET';
DROP FUNCTION MY_KILL;
diff --git a/mysql-test/r/last_value.result b/mysql-test/r/last_value.result
index 6222eacd4f0..b11ee6eaadb 100644
--- a/mysql-test/r/last_value.result
+++ b/mysql-test/r/last_value.result
@@ -36,17 +36,17 @@ LAST_VALUE(@last_a:=1,@last_b:=1.0)
1.0
select @last_b;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def @last_b 246 83 3 Y 32896 30 63
+def @last_b 246 83 3 Y 32896 38 63
@last_b
1.0
SELECT LAST_VALUE(@last_a:=1,@last_b:="hello");
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def LAST_VALUE(@last_a:=1,@last_b:="hello") 253 5 5 N 1 31 8
+def LAST_VALUE(@last_a:=1,@last_b:="hello") 253 5 5 N 1 39 8
LAST_VALUE(@last_a:=1,@last_b:="hello")
hello
select @last_b;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def @last_b 250 16777215 5 Y 0 31 8
+def @last_b 250 16777215 5 Y 0 39 8
@last_b
hello
SELECT date(LAST_VALUE(@last_a:=1,@last_b:="2001-02-03"));
@@ -56,7 +56,7 @@ date(LAST_VALUE(@last_a:=1,@last_b:="2001-02-03"))
2001-02-03
select @last_b;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def @last_b 250 16777215 10 Y 0 31 8
+def @last_b 250 16777215 10 Y 0 39 8
@last_b
2001-02-03
SELECT LAST_VALUE(@last_a:=1,@last_b:="2001-02-03",NULL);
@@ -66,7 +66,7 @@ LAST_VALUE(@last_a:=1,@last_b:="2001-02-03",NULL)
NULL
select @last_b;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def @last_b 250 16777215 10 Y 0 31 8
+def @last_b 250 16777215 10 Y 0 39 8
@last_b
2001-02-03
SELECT LAST_VALUE();
diff --git a/mysql-test/r/limit.result b/mysql-test/r/limit.result
index 176a93c7a46..064fa5a18a7 100644
--- a/mysql-test/r/limit.result
+++ b/mysql-test/r/limit.result
@@ -80,13 +80,13 @@ 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;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using temporary
+1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
c
7
explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using temporary
+1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
c
28
diff --git a/mysql-test/r/limit_rows_examined.result b/mysql-test/r/limit_rows_examined.result
index 0b3bc196a31..2b5bca2fb47 100644
--- a/mysql-test/r/limit_rows_examined.result
+++ b/mysql-test/r/limit_rows_examined.result
@@ -1,3 +1,4 @@
+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));
@@ -21,7 +22,7 @@ select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 2;
c1 c2
bb bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete
explain
select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 4;
id select_type table type possible_keys key key_len ref rows Extra
@@ -31,7 +32,7 @@ select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 4;
c1 c2
bb bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 5 rows, which exceeds LIMIT ROWS EXAMINED (4). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 5 rows, which exceeds LIMIT ROWS EXAMINED (4). The query result may be incomplete
Blocked nested loops join, empty result set because of blocking
set @@join_cache_level=1;
explain
@@ -43,7 +44,7 @@ select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 6;
c1 c2
bb bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
explain
select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
id select_type table type possible_keys key key_len ref rows Extra
@@ -53,7 +54,7 @@ select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
c1 c2
bb bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
set @@join_cache_level=6;
explain
select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 3;
@@ -63,7 +64,7 @@ id select_type table type possible_keys key key_len ref rows Extra
select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 3;
c1 c2
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 4 rows, which exceeds LIMIT ROWS EXAMINED (3). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 4 rows, which exceeds LIMIT ROWS EXAMINED (3). The query result may be incomplete
explain
select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
id select_type table type possible_keys key key_len ref rows Extra
@@ -73,7 +74,7 @@ select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
c1 c2
bb bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
Mix LIMIT ROWS EXAMINED with LIMIT
set @@join_cache_level=0;
explain
@@ -122,7 +123,7 @@ id select_type table type possible_keys key key_len ref rows Extra
select * from t0, t1 where c0 = 'bb' and c1 > c0 LIMIT ROWS EXAMINED 0;
c0 c1
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 2 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 2 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete
set @@join_cache_level = @save_join_cache_level;
drop table t0;
=========================================================================
@@ -136,7 +137,7 @@ execute st1 using @l;
c1 c2
bb bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete
deallocate prepare st1;
User variable (not supported for LIMIT in MariaDB 5.3/MySQL 5.1)
select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED @l;
@@ -150,7 +151,7 @@ call test_limit_rows(3);
c1 c2
bb bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 4 rows, which exceeds LIMIT ROWS EXAMINED (3). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 4 rows, which exceeds LIMIT ROWS EXAMINED (3). The query result may be incomplete
drop procedure test_limit_rows;
set @@join_cache_level = @save_join_cache_level;
=========================================================================
@@ -162,21 +163,19 @@ UNION
c1 c2
bb bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 8 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 8 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
(select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 0)
UNION
(select * from t1, t2 where c1 < c2 LIMIT ROWS EXAMINED 6);
c1 c2
bb bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 8 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 8 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 0
UNION
select * from t1, t2 where c1 < c2 LIMIT ROWS EXAMINED 6;
-c1 c2
-bb bb
-Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 8 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete.
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION
+select * from t1, t2 where c1 < c2 LIMIT ROWS EXAMINED 6' at line 2
(select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 0)
UNION
(select * from t1, t2 where c1 < c2 LIMIT ROWS EXAMINED 0)
@@ -184,7 +183,7 @@ LIMIT ROWS EXAMINED 6;
c1 c2
bb bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 8 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 8 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
(select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 0)
UNION
(select * from t1, t2 where c1 < c2 LIMIT ROWS EXAMINED 0)
@@ -192,7 +191,7 @@ LIMIT 1 ROWS EXAMINED 6;
c1 c2
bb bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 8 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 8 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
(select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 0)
UNION
(select * from t1, t2 where c1 < c2 LIMIT ROWS EXAMINED 0)
@@ -201,7 +200,7 @@ c1 c2
bb bb
cc cc
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (10). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (10). The query result may be incomplete
=========================================================================
Subqueries (with several LIMIT ROWS EXAMINED clauses)
=========================================================================
@@ -218,7 +217,7 @@ where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 11);
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (11). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (11). The query result may be incomplete
explain
select * from t1
where c1 IN (select * from t2 where c2 > ' ')
@@ -233,7 +232,7 @@ LIMIT ROWS EXAMINED 11;
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (11). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (11). The query result may be incomplete
explain
select * from t1
where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)
@@ -248,7 +247,7 @@ LIMIT ROWS EXAMINED 11;
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (11). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (11). The query result may be incomplete
explain
select * from t1i
where c1 IN (select * from t2i where c2 > ' ')
@@ -262,7 +261,7 @@ LIMIT ROWS EXAMINED 6;
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
Subqueries with IN-TO-EXISTS
set @@optimizer_switch='semijoin=off,in_to_exists=on,materialization=off';
explain
@@ -276,7 +275,7 @@ where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 4);
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 5 rows, which exceeds LIMIT ROWS EXAMINED (4). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 5 rows, which exceeds LIMIT ROWS EXAMINED (4). The query result may be incomplete
explain
select * from t1
where c1 IN (select * from t2 where c2 > ' ')
@@ -290,7 +289,7 @@ LIMIT ROWS EXAMINED 4;
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 5 rows, which exceeds LIMIT ROWS EXAMINED (4). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 5 rows, which exceeds LIMIT ROWS EXAMINED (4). The query result may be incomplete
explain
select * from t1
where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)
@@ -304,7 +303,7 @@ LIMIT ROWS EXAMINED 4;
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 5 rows, which exceeds LIMIT ROWS EXAMINED (4). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 5 rows, which exceeds LIMIT ROWS EXAMINED (4). The query result may be incomplete
explain
select * from t1i
where c1 IN (select * from t2i where c2 > ' ')
@@ -318,7 +317,7 @@ LIMIT ROWS EXAMINED 9;
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (9). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (9). The query result may be incomplete
Same as above, without subquery cache
set @@optimizer_switch='subquery_cache=off';
select * from t1
@@ -326,28 +325,28 @@ where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 2);
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete
select * from t1
where c1 IN (select * from t2 where c2 > ' ')
LIMIT ROWS EXAMINED 2;
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete
select * from t1
where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)
LIMIT ROWS EXAMINED 2;
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete
select * from t1i
where c1 IN (select * from t2i where c2 > ' ')
LIMIT ROWS EXAMINED 5;
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete
Subqueries with materialization
set @@optimizer_switch='semijoin=off,in_to_exists=off,materialization=on,subquery_cache=on';
explain
@@ -361,7 +360,7 @@ where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 13);
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 14 rows, which exceeds LIMIT ROWS EXAMINED (13). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 14 rows, which exceeds LIMIT ROWS EXAMINED (13). The query result may be incomplete
explain
select * from t1
where c1 IN (select * from t2 where c2 > ' ') LIMIT ROWS EXAMINED 13;
@@ -373,7 +372,7 @@ where c1 IN (select * from t2 where c2 > ' ') LIMIT ROWS EXAMINED 13;
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 14 rows, which exceeds LIMIT ROWS EXAMINED (13). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 14 rows, which exceeds LIMIT ROWS EXAMINED (13). The query result may be incomplete
explain
select * from t1
where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)
@@ -387,7 +386,7 @@ LIMIT ROWS EXAMINED 13;
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 14 rows, which exceeds LIMIT ROWS EXAMINED (13). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 14 rows, which exceeds LIMIT ROWS EXAMINED (13). The query result may be incomplete
explain
select * from t1i
where c1 IN (select * from t2i where c2 > ' ') LIMIT ROWS EXAMINED 17;
@@ -399,7 +398,7 @@ where c1 IN (select * from t2i where c2 > ' ') LIMIT ROWS EXAMINED 17;
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 18 rows, which exceeds LIMIT ROWS EXAMINED (17). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 18 rows, which exceeds LIMIT ROWS EXAMINED (17). The query result may be incomplete
set @@optimizer_switch='default';
=========================================================================
Views and derived tables
@@ -420,18 +419,18 @@ bb
cc
dd
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 18 rows, which exceeds LIMIT ROWS EXAMINED (17). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 18 rows, which exceeds LIMIT ROWS EXAMINED (17). The query result may be incomplete
select * from v1 LIMIT ROWS EXAMINED 16;
c1
bb
cc
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 17 rows, which exceeds LIMIT ROWS EXAMINED (16). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 17 rows, which exceeds LIMIT ROWS EXAMINED (16). The query result may be incomplete
select * from v1 LIMIT ROWS EXAMINED 11;
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (11). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (11). The query result may be incomplete
drop view v1;
explain
select *
@@ -449,7 +448,7 @@ LIMIT ROWS EXAMINED 11;
c1
bb
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (11). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (11). The query result may be incomplete
=========================================================================
Aggregation
=========================================================================
@@ -472,14 +471,16 @@ id select_type table type possible_keys key key_len ref rows Extra
select c1, sum(c2) from t3 group by c1 LIMIT ROWS EXAMINED 0;
c1 sum(c2)
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 2 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete
select c1, sum(c2) from t3 group by c1 LIMIT ROWS EXAMINED 1;
-ERROR HY000: Sort aborted:
+c1 sum(c2)
+Warnings:
+Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (1). The query result may be incomplete
select c1, sum(c2) from t3 group by c1 LIMIT ROWS EXAMINED 20;
c1 sum(c2)
aa 3
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 21 rows, which exceeds LIMIT ROWS EXAMINED (20). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 21 rows, which exceeds LIMIT ROWS EXAMINED (20). The query result may be incomplete
select c1, sum(c2) from t3 group by c1 LIMIT ROWS EXAMINED 21;
c1 sum(c2)
aa 3
@@ -497,14 +498,16 @@ id select_type table type possible_keys key key_len ref rows Extra
select c1, sum(c2) from t3i group by c1 LIMIT ROWS EXAMINED 0;
c1 sum(c2)
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 2 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete
select c1, sum(c2) from t3i group by c1 LIMIT ROWS EXAMINED 1;
-ERROR HY000: Sort aborted:
+c1 sum(c2)
+Warnings:
+Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (1). The query result may be incomplete
select c1, sum(c2) from t3i group by c1 LIMIT ROWS EXAMINED 20;
c1 sum(c2)
aa 3
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 21 rows, which exceeds LIMIT ROWS EXAMINED (20). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 21 rows, which exceeds LIMIT ROWS EXAMINED (20). The query result may be incomplete
select c1, sum(c2) from t3i group by c1 LIMIT ROWS EXAMINED 21;
c1 sum(c2)
aa 3
@@ -517,14 +520,14 @@ id select_type table type possible_keys key key_len ref rows Extra
select min(c2) from t3 LIMIT ROWS EXAMINED 5;
min(c2)
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 6 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 6 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete
select max(c2) from t3 LIMIT ROWS EXAMINED 6;
max(c2)
5
select max(c2) from t3 LIMIT ROWS EXAMINED 0;
max(c2)
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete
explain
select max(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 5;
id select_type table type possible_keys key key_len ref rows Extra
@@ -532,14 +535,14 @@ id select_type table type possible_keys key key_len ref rows Extra
select max(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 5;
max(c2)
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 6 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 6 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete
select max(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 6;
max(c2)
NULL
select max(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 0;
max(c2)
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete
explain
select count(c2) from t3 LIMIT ROWS EXAMINED 5;
id select_type table type possible_keys key key_len ref rows Extra
@@ -547,14 +550,14 @@ id select_type table type possible_keys key key_len ref rows Extra
select count(c2) from t3 LIMIT ROWS EXAMINED 5;
count(c2)
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 6 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 6 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete
select count(c2) from t3 LIMIT ROWS EXAMINED 6;
count(c2)
5
select count(c2) from t3 LIMIT ROWS EXAMINED 0;
count(c2)
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete
explain
select count(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 5;
id select_type table type possible_keys key key_len ref rows Extra
@@ -562,7 +565,7 @@ id select_type table type possible_keys key key_len ref rows Extra
select count(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 5;
count(c2)
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 6 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 6 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete
select count(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 6;
count(c2)
0
@@ -573,7 +576,7 @@ id select_type table type possible_keys key key_len ref rows Extra
select sum(c2) from t3 LIMIT ROWS EXAMINED 5;
sum(c2)
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 6 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 6 rows, which exceeds LIMIT ROWS EXAMINED (5). The query result may be incomplete
select sum(c2) from t3 LIMIT ROWS EXAMINED 6;
sum(c2)
15
@@ -612,7 +615,7 @@ c1 c2
aa 1
aa 2
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete
explain
select c1, c2 from t3i order by c2, c1 desc LIMIT ROWS EXAMINED 2;
id select_type table type possible_keys key key_len ref rows Extra
@@ -626,16 +629,16 @@ INSERT/DELETE/UPDATE
INSERT ... SELECT
CREATE TABLE t4 (a int);
INSERT INTO t4 values (1), (2);
-INSERT INTO t4 SELECT a + 2 FROM t4 LIMIT ROWS EXAMINED 0;
+INSERT IGNORE INTO t4 SELECT a + 2 FROM t4 LIMIT ROWS EXAMINED 0;
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 2 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete
select * from t4;
a
1
2
INSERT INTO t4 SELECT a + 2 FROM t4 LIMIT ROWS EXAMINED 6;
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 8 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 8 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete
select * from t4;
a
1
@@ -667,7 +670,7 @@ MDEV-115
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');
+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 );
@@ -677,8 +680,8 @@ 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;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 1 Using temporary
-1 PRIMARY t2 ALL NULL NULL NULL NULL 3 Distinct
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
SELECT DISTINCT a AS field1 FROM t1, t2
@@ -686,26 +689,29 @@ WHERE EXISTS (SELECT c FROM t3 LEFT JOIN t2 ON b = d)
HAVING field1 > 'aaa' LIMIT ROWS EXAMINED 20;
field1
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 23 rows, which exceeds LIMIT ROWS EXAMINED (20). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 21 rows, which exceeds LIMIT ROWS EXAMINED (20). The query result may be incomplete
EXPLAIN
SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 14;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary
-1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Distinct
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 14;
a
+USA
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 15 rows, which exceeds LIMIT ROWS EXAMINED (14). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 15 rows, which exceeds LIMIT ROWS EXAMINED (14). The query result may be incomplete
SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 15;
a
USA
+CAN
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 16 rows, which exceeds LIMIT ROWS EXAMINED (15). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 16 rows, which exceeds LIMIT ROWS EXAMINED (15). The query result may be incomplete
SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 16;
a
USA
+CAN
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 17 rows, which exceeds LIMIT ROWS EXAMINED (16). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 17 rows, which exceeds LIMIT ROWS EXAMINED (16). The query result may be incomplete
drop table t1,t2,t3;
set @@optimizer_switch='default';
@@ -744,13 +750,15 @@ 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;
-ERROR HY000: Sort aborted:
+field1 field2 field3 field4 field5
+Warnings:
+Warning 1931 Query execution was interrupted. The query examined at least 121 rows, which exceeds LIMIT ROWS EXAMINED (120). The query result may be incomplete
SHOW STATUS LIKE 'Handler_read%';
Variable_name Value
-Handler_read_first 0
-Handler_read_key 5
+Handler_read_first 1
+Handler_read_key 4
Handler_read_last 0
-Handler_read_next 0
+Handler_read_next 4
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
@@ -759,7 +767,7 @@ Handler_read_rnd_next 46
SHOW STATUS LIKE 'Handler_tmp%';
Variable_name Value
Handler_tmp_update 0
-Handler_tmp_write 70
+Handler_tmp_write 66
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
@@ -767,20 +775,20 @@ WHERE alias3.c IN ( SELECT 1 UNION SELECT 6 )
GROUP BY field1, field2, field3, field4, field5
LIMIT ROWS EXAMINED 124;
field1 field2 field3 field4 field5
-00:21:38 06:07:10 a 2007-06-08 04:35:26 2007-05-28 00:00:00
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 125 rows, which exceeds LIMIT ROWS EXAMINED (124). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 125 rows, which exceeds LIMIT ROWS EXAMINED (124). The query result may be incomplete
+Warning 1931 Query execution was interrupted. The query examined at least 127 rows, which exceeds LIMIT ROWS EXAMINED (124). The query result may be incomplete
SHOW STATUS LIKE 'Handler_read%';
Variable_name Value
-Handler_read_first 0
-Handler_read_key 5
+Handler_read_first 1
+Handler_read_key 4
Handler_read_last 0
-Handler_read_next 0
+Handler_read_next 4
Handler_read_prev 0
Handler_read_retry 0
-Handler_read_rnd 2
-Handler_read_rnd_deleted 1
-Handler_read_rnd_next 47
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 48
SHOW STATUS LIKE 'Handler_tmp%';
Variable_name Value
Handler_tmp_update 0
@@ -811,7 +819,7 @@ WHERE b <= alias1.b OR e != alias2.c
) LIMIT ROWS EXAMINED 20;
a b c
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 25 rows, which exceeds LIMIT ROWS EXAMINED (20). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 25 rows, which exceeds LIMIT ROWS EXAMINED (20). The query result may be incomplete
drop table t1, t2, t3;
MDEV-174: LIMIT ROWS EXAMINED: Assertion `0' failed in net_end_statement(THD*)
@@ -828,7 +836,7 @@ WHERE c = (SELECT MAX(b) FROM t2)
LIMIT ROWS EXAMINED 3;
(SELECT MAX(c) FROM t1, t2)
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 10 rows, which exceeds LIMIT ROWS EXAMINED (3). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 10 rows, which exceeds LIMIT ROWS EXAMINED (3). The query result may be incomplete
drop table t1, t2;
MDEV-178: LIMIT ROWS EXAMINED: Assertion `0' failed in net_end_statement(THD*) on the
@@ -845,11 +853,11 @@ EXECUTE ps;
a
3
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 22 rows, which exceeds LIMIT ROWS EXAMINED (21). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 22 rows, which exceeds LIMIT ROWS EXAMINED (21). The query result may be incomplete
EXECUTE ps;
a
3
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 22 rows, which exceeds LIMIT ROWS EXAMINED (21). The query result may be incomplete.
+Warning 1931 Query execution was interrupted. The query examined at least 22 rows, which exceeds LIMIT ROWS EXAMINED (21). The query result may be incomplete
drop view v;
drop table t1, t2;
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index 42f919d0cfb..4f59e9cdbe3 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -1,6 +1,6 @@
drop table if exists t1, t2;
create table t1 (a date, b date, c date not null, d date);
-load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
+load data infile '../../std_data/loaddata1.dat' ignore into table t1 fields terminated by ',';
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'c' at row 1
@@ -16,7 +16,7 @@ a b c d
2003-03-03 2003-03-03 2003-03-03 NULL
2003-03-03 2003-03-03 2003-03-03 NULL
truncate table t1;
-load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
+load data infile '../../std_data/loaddata1.dat' ignore into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
Warning 1265 Data truncated for column 'd' at row 1
@@ -178,7 +178,7 @@ select @a, @b;
@a @b
NULL 15
truncate table t1;
-load data infile '../../std_data/rpl_loaddata.dat' into table t1 set c=b;
+load data infile '../../std_data/rpl_loaddata.dat' ignore into table t1 set c=b;
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1261 Row 2 doesn't contain data for all columns
@@ -524,9 +524,15 @@ DROP TABLE t1;
# Bug #52512 : Assertion `! is_set()' in
# Diagnostics_area::set_ok_status on LOAD DATA
#
+connect con1,localhost,root,,test;
CREATE TABLE t1 (id INT NOT NULL);
LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1;
+connection default;
+disconnect con1;
+connect con1,localhost,root,,test;
DROP TABLE t1;
+connection default;
+disconnect con1;
#
# Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
#
diff --git a/mysql-test/r/loaddata_autocom_innodb.result b/mysql-test/r/loaddata_autocom_innodb.result
index c1e6b7f2fba..9f5a0809f2a 100644
--- a/mysql-test/r/loaddata_autocom_innodb.result
+++ b/mysql-test/r/loaddata_autocom_innodb.result
@@ -2,7 +2,7 @@ SET SESSION STORAGE_ENGINE = InnoDB;
drop table if exists t1;
create table t1 (id int unsigned not null auto_increment primary key, a text, b text);
start transaction;
-load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''' (a, b);
+load data infile 'LOAD_FILE' ignore into table t1 fields terminated by ',' enclosed by '''' (a, b);
Warnings:
Warning 1261 Row 3 doesn't contain data for all columns
commit;
@@ -11,7 +11,7 @@ count(*)
4
truncate table t1;
start transaction;
-load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''' (a, b);
+load data infile 'LOAD_FILE' ignore into table t1 fields terminated by ',' enclosed by '''' (a, b);
Warnings:
Warning 1261 Row 3 doesn't contain data for all columns
rollback;
diff --git a/mysql-test/r/loadxml.result b/mysql-test/r/loadxml.result
index 94db3cc913f..1d7af4f8b38 100644
--- a/mysql-test/r/loadxml.result
+++ b/mysql-test/r/loadxml.result
@@ -57,8 +57,11 @@ a b
select 1 as xml;
xml
1
+connect addconroot, localhost, root,,;
+connection addconroot;
create table t2(fl text);
LOAD XML LOCAL INFILE "MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO TABLE t2 ROWS IDENTIFIED BY '<person>';;
+connection default;
drop table t1;
drop table t2;
create table t1 (
diff --git a/mysql-test/r/locale.result b/mysql-test/r/locale.result
index 95c1f51fd87..a02e80ed21e 100644
--- a/mysql-test/r/locale.result
+++ b/mysql-test/r/locale.result
@@ -223,5 +223,21 @@ SELECT * FROM non_existent;
ERROR 42S02: Table 'test.non_existent' doesn't exist
SET lc_time_names=@old_50915_lc_time_names;
#
-# End of 5.6 tests
+# End of 10.0 tests
+#
+#
+# End of 10.1 tests
+#
+create view v1 as select
+format(123456789,2) as b,
+format(123456789,2,'rm_CH') as b1;
+select * from v1;
+b b1
+123,456,789.00 123'456'789,00
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select format(123456789,2) AS `b`,format(123456789,2,'rm_CH') AS `b1` utf8 utf8_general_ci
+drop view v1;
+#
+# End of 10.2 tests
#
diff --git a/mysql-test/r/lock.result b/mysql-test/r/lock.result
index 501c379b257..e3fd16ee59a 100644
--- a/mysql-test/r/lock.result
+++ b/mysql-test/r/lock.result
@@ -272,20 +272,24 @@ drop view v1;
#
drop table if exists t1;
create table t1 (a int);
+connect con1,localhost,root,,;
set autocommit= 0;
insert into t1 values (1);
lock table t1 write;
-# Disconnect
# Ensure that metadata locks will be released if there is an open
# transaction (autocommit=off) in conjunction with lock tables.
+disconnect con1;
+connection default;
drop table t1;
# Same problem but now for BEGIN
drop table if exists t1;
create table t1 (a int);
+connect con1,localhost,root,,;
begin;
insert into t1 values (1);
-# Disconnect
# Ensure that metadata locks held by the transaction are released.
+disconnect con1;
+connection default;
drop table t1;
#
# Coverage for situations when we try to execute DDL on tables
@@ -376,12 +380,7 @@ alter table t1 add column j int;
unlock tables;
drop table t1;
create temporary table t1 (i int);
-#
-# This is just for test coverage purposes,
-# when this is allowed, remove the --error.
-#
lock tables t1 write, t1 as a read, t1 as b read;
-ERROR HY000: Can't reopen table: 't1'
alter table t1 add column j int;
unlock tables;
drop table t1;
@@ -445,38 +444,64 @@ UPDATE LOW_PRIORITY t1 SET f2 = 7;
# Statement below should fail with ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
# error instead of failing on assertion in table-level locking subsystem.
INSERT INTO t1(f1) VALUES(0);
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
DROP TABLE t1;
#
# Bug#43685 Lock table affects other non-related tables
#
DROP TABLE IF EXISTS t1, t2;
+connect con2, localhost, root;
CREATE TABLE t1 (id INT);
CREATE TABLE t2 (id INT);
-# Connection default
+connection default;
LOCK TABLE t1 WRITE;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
-# Connection con2
+connection con2;
LOCK TABLE t2 WRITE;
# This used to hang until the first connection
# unlocked t1.
FLUSH TABLE t2;
UNLOCK TABLES;
-# Connection default
+connection default;
UNLOCK TABLES;
DROP TABLE t1, t2;
+disconnect con2;
#
# End of 6.0 tests.
#
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;
+#
+# MDEV-15769: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed in Diagnostics_area::set_ok_status
+#
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT);
+LOCK TABLE t1 READ;
+connect con1,localhost,root,,test;
+LOCK TABLE t2 WRITE;
+SET lock_wait_timeout= 1;
+FLUSH TABLES;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+UNLOCK TABLES;
+disconnect con1;
+connection default;
+UNLOCK TABLES;
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result
index 12960a4f5f6..d4e0edaf1c2 100644
--- a/mysql-test/r/lock_multi.result
+++ b/mysql-test/r/lock_multi.result
@@ -1,85 +1,125 @@
drop table if exists t1,t2;
drop DATABASE if exists mysqltest_1;
+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);
get_lock("mysqltest_lock", 100)
1
+connection locker;
update t1 set n = 2 and get_lock('mysqltest_lock', 100);
+connection writer;
update low_priority t1 set n = 4;
+connection reader;
select n from t1;
+connection locker2;
select release_lock("mysqltest_lock");
release_lock("mysqltest_lock")
1
+connection locker;
select release_lock("mysqltest_lock");
release_lock("mysqltest_lock")
1
+connection writer;
+connection reader;
n
4
drop table t1;
+connection locker;
create table t1(n int);
insert into t1 values (1),(2);
+connection locker2;
select get_lock("mysqltest_lock", 100);
get_lock("mysqltest_lock", 100)
1
+connection locker;
select n from t1 where get_lock('mysqltest_lock', 100);
+connection writer;
update low_priority t1 set n = 4;
+connection reader;
select n from t1;
n
1
2
+connection locker2;
select release_lock("mysqltest_lock");
release_lock("mysqltest_lock")
1
+connection locker;
n
1
2
select release_lock("mysqltest_lock");
release_lock("mysqltest_lock")
1
+connection writer;
drop table t1;
+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;
c
2
+connection locker;
unlock tables;
drop table t1;
drop table t2;
+connection locker;
create table t1 (a int);
create table t2 (a int);
lock table t1 write, t2 write;
+connection reader;
insert t1 select * from t2;
+connection locker;
drop table t2;
unlock tables;
+connection reader;
ERROR 42S02: Table 'test.t2' doesn't exist
+connection locker;
drop table t1;
+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;
insert t1 select * from t2;
+connection locker;
drop table t2;
unlock tables;
+connection reader;
ERROR 42S02: Table 'test.t2' doesn't exist
+connection locker;
drop table t1;
End of 4.1 tests
create table t1(a int);
lock tables t1 write;
+connection reader;
show columns from t1;
Field Type Null Key Default Extra
a int(11) YES NULL
+connection locker;
unlock tables;
drop table t1;
+connection locker;
USE mysql;
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
FLUSH TABLES;
+connection reader;
USE mysql;
SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
+connection locker;
OPTIMIZE TABLES columns_priv, db, host, user;
Table Op Msg_type Msg_text
mysql.columns_priv optimize status OK
@@ -87,157 +127,238 @@ mysql.db optimize status OK
mysql.host optimize status OK
mysql.user optimize status OK
UNLOCK TABLES;
+connection reader;
Select_priv
N
USE test;
+connection locker;
use test;
+connection default;
+connection writer;
CREATE TABLE t1 (c1 int);
LOCK TABLE t1 WRITE;
+connection locker;
FLUSH TABLES WITH READ LOCK;
+connection writer;
CREATE TABLE t2 (c1 int);
ERROR HY000: Table 't2' was not locked with LOCK TABLES
UNLOCK TABLES;
+connection locker;
UNLOCK TABLES;
+connection default;
DROP TABLE t1;
+connection writer;
CREATE TABLE t1 (c1 int);
LOCK TABLE t1 WRITE;
+connection locker;
FLUSH TABLES WITH READ LOCK;
+connection writer;
CREATE TABLE t2 AS SELECT * FROM t1;
ERROR HY000: Table 't2' was not locked with LOCK TABLES
UNLOCK TABLES;
+connection locker;
UNLOCK TABLES;
+connection default;
DROP TABLE t1;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
CREATE DATABASE mysqltest_1;
FLUSH TABLES WITH READ LOCK;
+connection con2;
DROP DATABASE mysqltest_1;
+connection con1;
DROP DATABASE mysqltest_1;
ERROR HY000: Can't execute the query because you have a conflicting read lock
UNLOCK TABLES;
+connection con2;
+connection default;
+disconnect con1;
+disconnect con2;
DROP DATABASE mysqltest_1;
ERROR HY000: Can't drop database 'mysqltest_1'; database doesn't exist
+connection locker;
set sql_mode="";
create table t1 (f1 int(12) unsigned not null auto_increment, primary key(f1)) engine=innodb;
set sql_mode=default;
lock tables t1 write;
+connection writer;
alter table t1 auto_increment=0;
+connection reader;
alter table t1 auto_increment=0;
+connection locker;
unlock tables;
+connection writer;
+connection reader;
+connection locker;
drop table t1;
+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;
-# con1
+connection con1;
lock tables t1 write;
-# con2
+connection con2;
flush tables with read lock;
-# con5
+connection con5;
# global read lock is taken
-# con3
+connection con3;
select * from t2 for update;
+connection con5;
# waiting for release of read lock
-# con4
+connection con4;
# would hang and later cause a deadlock
flush tables t2;
+connection con1;
# clean up
unlock tables;
+connection con2;
unlock tables;
+connection con3;
a
+connection default;
+disconnect con5;
+disconnect con4;
+disconnect con3;
+disconnect con2;
+disconnect con1;
drop table t1,t2;
#
# Lightweight version:
# Ensure that the wait for a GRL is done before opening tables.
#
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
create table t1 (a int);
create table t2 like t1;
#
# UPDATE
#
-# default
+connection default;
flush tables with read lock;
-# con1
+connection con1;
update t2 set a = 1;
-# default
+connection default;
# statement is waiting for release of read lock
-# con2
+connection con2;
flush table t2;
-# default
+connection default;
unlock tables;
-# con1
+connection con1;
#
# LOCK TABLES .. WRITE
#
-# default
+connection default;
flush tables with read lock;
-# con1
+connection con1;
lock tables t2 write;
-# default
+connection default;
# statement is waiting for release of read lock
-# con2
+connection con2;
flush table t2;
-# default
+connection default;
unlock tables;
-# con1
+connection con1;
unlock tables;
+connection default;
+disconnect con2;
+disconnect con1;
drop table t1,t2;
End of 5.0 tests
create table t1 (i int);
+connection locker;
lock table t1 read;
+connection writer;
update t1 set i= 10;
+connection reader;
select * from t1;
+connection default;
kill query ID;
+connection reader;
i
+connection writer;
ERROR 70100: Query execution was interrupted
+connection locker;
unlock tables;
+connection default;
drop table t1;
+disconnect locker;
+disconnect locker2;
+disconnect reader;
+disconnect writer;
drop table if exists t1;
create table t1 (i int);
-connection: default
+connect flush,localhost,root,,test,,;
+connection default;
lock tables t1 write;
-connection: flush
+connection flush;
flush tables with read lock;;
-connection: default
+connection default;
alter table t1 add column j int;
-connection: insert
+connect insert,localhost,root,,test,,;
+connection insert;
insert into t1 values (1,2);;
-connection: default
+connection default;
unlock tables;
-connection: flush
+connection flush;
select * from t1;
i j
unlock tables;
+connection insert;
+connection default;
select * from t1;
i j
1 2
drop table t1;
+disconnect flush;
+disconnect insert;
drop table if exists t1;
create table t1 (i int);
-connection: default
+connect flush,localhost,root,,test,,;
+connection default;
lock tables t1 write;
-connection: flush
+connection flush;
flush tables with read lock;;
-connection: default
+connection default;
flush tables;
unlock tables;
+connection flush;
+connection default;
+disconnect flush;
drop table t1;
drop table if exists t1,t2;
create table t1 (a int);
flush status;
lock tables t1 read;
+connect waiter,localhost,root,,;
+connection waiter;
insert into t1 values(1);
+connection default;
unlock tables;
+connection waiter;
+connection default;
drop table t1;
+disconnect waiter;
select @tlwa < @tlwb;
@tlwa < @tlwb
1
End of 5.1 tests
drop table if exists t1;
create table t1 (i int);
-connection: default
+connect flush,localhost,root,,test,,;
+connection default;
lock tables t1 write;
-connection: flush
+connection flush;
flush tables with read lock;;
-connection: default
+connection default;
flush tables;
drop table t1;
+connection flush;
+connection default;
+disconnect flush;
#
# Test for bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock".
#
@@ -246,15 +367,14 @@ 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;
-#
-# Switching to connection 'con46272'.
+connect con46272,localhost,root,,test,,;
+connection con46272;
# The below ALTER TABLE statement should wait till transaction
# in connection 'default' is complete and then succeed.
# It should not deadlock or fail with ER_LOCK_DEADLOCK error.
# Sending:
alter table t1 add column c4 int;;
-#
-# Switching to connection 'default'.
+connection default;
# Wait until the above ALTER TABLE gets blocked because this
# connection holds SW metadata lock on table to be altered.
# The below statement should succeed. It should not
@@ -262,11 +382,10 @@ alter table t1 add column c4 int;;
update t1 set c3=c3+1 where c2=4;
# Unblock ALTER TABLE by committing transaction.
commit;
-#
-# Switching to connection 'con46272'.
+connection con46272;
# Reaping ALTER TABLE.
-#
-# Switching to connection 'default'.
+connection default;
+disconnect con46272;
drop table t1;
#
# Bug#47249 assert in MDL_global_lock::is_lock_type_compatible
@@ -292,10 +411,11 @@ DROP VIEW v1;
#
CREATE TABLE t1 ( f1 integer );
CREATE VIEW v1 AS SELECT f1 FROM t1 ;
-# Connection 2
+connect con2,localhost,root;
LOCK TABLES t1 WRITE, v1 READ;
FLUSH TABLE t1;
-# Connection 1
+disconnect con2;
+connection default;
LOCK TABLES t1 WRITE;
FLUSH TABLE t1;
DROP TABLE t1;
@@ -306,15 +426,17 @@ DROP VIEW v1;
#
drop table if exists t1;
drop view if exists v1;
+connect con50913,localhost,root;
+connection default;
create table t1 (i int);
create view v1 as select i from t1;
begin;
select * from t1;
i
-# Switching to connection 'con50913'.
+connection con50913;
# Sending:
alter table t1 add column j int;
-# Switching to connection 'default'.
+connection default;
# Wait until ALTER TABLE gets blocked.
# The below statement should try to acquire SW lock on 't1'
# and therefore should get ER_LOCK_DEADLOCK error. Before
@@ -323,16 +445,16 @@ delete a from t1 as a where i = 1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
# Unblock ALTER TABLE.
commit;
-# Switching to connection 'con50913'.
+connection con50913;
# Reaping ALTER TABLE;
-# Switching to connection 'default'.
+connection default;
begin;
select * from v1;
i
-# Switching to connection 'con50913'.
+connection con50913;
# Sending:
alter table t1 drop column j;
-# Switching to connection 'default'.
+connection default;
# Wait until ALTER TABLE gets blocked.
# The below statement should try to acquire SW lock on 't1'
# and therefore should get ER_LOCK_DEADLOCK error. Before
@@ -341,9 +463,10 @@ insert into v1 values (1);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
# Unblock ALTER TABLE.
commit;
-# Switching to connection 'con50913'.
+connection con50913;
# Reaping ALTER TABLE;
-# Switching to connection 'default'.
+connection default;
+disconnect con50913;
drop view v1;
drop table t1;
#
@@ -354,113 +477,122 @@ drop table t1;
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id int);
+connect con2, localhost, root,,;
SET SESSION lock_wait_timeout= 1;
#
# Test 1: acquire exclusive lock
#
-# Connection default
+connection default;
START TRANSACTION;
INSERT INTO t1 VALUES (1);
-# Connection 2
+connection con2;
DROP TABLE t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-# Connection default
+connection default;
COMMIT;
#
# Test 2: upgrade shared lock
#
-# Connection default
+connection default;
START TRANSACTION;
SELECT * FROM t1;
id
1
-# Connection 2
+connection con2;
ALTER TABLE t1 RENAME TO t2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-# Connection default
+connection default;
COMMIT;
#
# Test 3: acquire shared lock
#
-# Connection default
+connection default;
LOCK TABLE t1 WRITE;
-# Connection 2
+connection con2;
INSERT INTO t1(id) VALUES (2);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-# Connection default
+connection default;
UNLOCK TABLES;
#
# Test 4: table level locks
#
-# Connection default
+connection default;
LOCK TABLE t1 READ;
-# Connection 2
+connection con2;
INSERT INTO t1(id) VALUES(4);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-# Connection default
+connection default;
UNLOCK TABLES;
#
# Test 5: Waiting on Table Definition Cache (TDC)
#
-# Connection default
+connect con3, localhost, root;
+connection default;
LOCK TABLE t1 READ;
-# Connection con3
+connection con3;
# Sending:
FLUSH TABLES;
-# Connection con2
+connection con2;
SELECT * FROM t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-# Connection default
+connection default;
UNLOCK TABLES;
-# Connection con3
+connection con3;
# Reaping: FLUSH TABLES
#
# Test 6: Timeouts in I_S queries
#
-# Connection default
+connection default;
CREATE TABLE t2 (id INT);
LOCK TABLE t2 WRITE;
-# Connection con3
+connection con3;
# Sending:
DROP TABLE t1, t2;
-# Connection con2
+connection con2;
SELECT table_name, table_comment FROM information_schema.tables
WHERE table_schema= 'test' AND table_name= 't1';
table_name table_comment
t1 Lock wait timeout exceeded; try restarting transaction
Warnings:
Warning 1205 Lock wait timeout exceeded; try restarting transaction
-# Connection default
+connection default;
UNLOCK TABLES;
-# Connection con3
+connection con3;
# Reaping: DROP TABLE t1, t2
-# Connection default
+connection default;
# Cleanup
+disconnect con2;
+disconnect con3;
#
# Test for bug #51134 "Crash in MDL_lock::destroy on a concurrent
# DDL workload".
#
drop tables if exists t1, t2, t3;
+connect con1, localhost, root, , ;
+connect con2, localhost, root, , ;
+connection default;
create table t3 (i int);
-# Switching to connection 'con1'
+connection con1;
# Lock 't3' so upcoming RENAME is blocked.
lock table t3 read;
-# Switching to connection 'con2'
+connection con2;
# Remember ID for this connection.
# Start statement which will try to acquire two instances
# of X metadata lock on the same object.
# Sending:
rename tables t1 to t2, t2 to t3;;
-# Switching to connection 'default'
+connection default;
# Wait until RENAME TABLE is blocked on table 't3'.
# Kill RENAME TABLE.
kill query ID;
-# Switching to connection 'con2'
+connection con2;
# RENAME TABLE should be aborted but should not crash.
ERROR 70100: Query execution was interrupted
-# Switching to connection 'con1'
+connection con1;
unlock tables;
-# Switching to connection 'default'
+connection default;
+disconnect con1;
+disconnect con2;
drop table t3;
#
# Test for the bug where upgradable metadata locks was acquired
@@ -470,9 +602,10 @@ drop table t3;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id INT);
LOCK TABLE t1 WRITE;
-# Connection con1
+connect con1, localhost, root;
CREATE TEMPORARY TABLE t1 (id INT);
ALTER TABLE t1 ADD COLUMN j INT;
-# Connection default
+connection default;
+disconnect con1;
UNLOCK TABLES;
DROP TABLE t1;
diff --git a/mysql-test/r/lock_multi_bug38499.result b/mysql-test/r/lock_multi_bug38499.result
index 6922312b298..521ea010816 100644
--- a/mysql-test/r/lock_multi_bug38499.result
+++ b/mysql-test/r/lock_multi_bug38499.result
@@ -1,5 +1,8 @@
SET @odl_sync_frm = @@global.sync_frm;
SET @@global.sync_frm = OFF;
+connect locker,localhost,root,,;
+connect writer,localhost,root,,;
+connection default;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1( a INT, b INT );
CREATE TABLE t2( a INT, b INT );
@@ -11,7 +14,9 @@ INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4);
# 1.1.2. PS mode
# 1.2. test altering of columns that multiupdate uses
# 1.2.1. normal mode
+connection default;
# 1.2.2. PS mode
+connection default;
ALTER TABLE t1 ADD COLUMN a INT;
# 2. test UNIONs
# 2.1. test altering of columns that multiupdate doesn't use
@@ -19,6 +24,10 @@ ALTER TABLE t1 ADD COLUMN a INT;
# 2.1.2. PS mode
# 2.2. test altering of columns that multiupdate uses
# 2.2.1. normal mode
+connection default;
# 2.2.2. PS mode
+connection default;
DROP TABLE t1,t2;
+disconnect locker;
+disconnect writer;
SET @@global.sync_frm = @odl_sync_frm;
diff --git a/mysql-test/r/lock_multi_bug38691.result b/mysql-test/r/lock_multi_bug38691.result
index d0aa1c0277c..55836e161f4 100644
--- a/mysql-test/r/lock_multi_bug38691.result
+++ b/mysql-test/r/lock_multi_bug38691.result
@@ -1,5 +1,8 @@
SET @odl_sync_frm = @@global.sync_frm;
SET @@global.sync_frm = OFF;
+connect locker,localhost,root,,;
+connect writer,localhost,root,,;
+connection default;
DROP TABLE IF EXISTS t1,t2,t3;
CREATE TABLE t1 (
a int(11) unsigned default NULL,
@@ -15,6 +18,10 @@ CREATE TABLE t3 SELECT * FROM t1;
# PS mode
# test altering of columns that multiupdate uses
# normal mode
+connection default;
# PS mode
+connection default;
DROP TABLE t1, t2, t3;
+disconnect locker;
+disconnect writer;
SET @@global.sync_frm = @odl_sync_frm;
diff --git a/mysql-test/r/lock_sync.result b/mysql-test/r/lock_sync.result
index 219cc08342e..7b61c5994b6 100644
--- a/mysql-test/r/lock_sync.result
+++ b/mysql-test/r/lock_sync.result
@@ -23,6 +23,9 @@ select @@global.concurrent_insert;
ALWAYS
# Prepare playground by creating tables, views,
# routines and triggers used in tests.
+connect con1, localhost, root,,;
+connect con2, localhost, root,,;
+connection default;
drop table if exists t0, t1, t2, t3, t4, t5;
drop view if exists v1, v2;
drop procedure if exists p1;
@@ -201,7 +204,7 @@ end|
# Set common variables to be used by the scripts
# called below.
#
-# Switch to connection 'con1'.
+connection con1;
# Cache all functions used in the tests below so statements
# calling them won't need to open and lock mysql.proc table
# and we can assume that each statement locks its tables
@@ -226,7 +229,7 @@ show create function f14;
show create function f15;
show create function f16;
show create function f17;
-# Switch back to connection 'default'.
+connection default;
#
# 1. Statements that read tables and do not use subqueries.
#
@@ -236,6 +239,7 @@ show create function f17;
# No locks are necessary as this statement won't be written
# to the binary log and thanks to how MyISAM works SELECT
# will see version of the table prior to concurrent insert.
+connection default;
Success: 'select * from t1' allows concurrent inserts into 't1'.
#
# 1.2 Multi-UPDATE statement.
@@ -243,11 +247,13 @@ Success: 'select * from t1' allows concurrent inserts into 't1'.
# Has to take shared locks on rows in the table being read as this
# statement will be written to the binary log and therefore should
# be serialized with concurrent statements.
+connection default;
Success: 'update t2, t1 set j= j - 1 where i = j' doesn't allow concurrent inserts into 't1'.
#
# 1.3 Multi-DELETE statement.
#
# The above is true for this statement as well.
+connection default;
Success: 'delete t2 from t1, t2 where i = j' doesn't allow concurrent inserts into 't1'.
#
# 1.4 DESCRIBE statement.
@@ -256,20 +262,20 @@ Success: 'delete t2 from t1, t2 where i = j' doesn't allow concurrent inserts in
# target table and thus does not take any lock on it.
# We check this for completeness of coverage.
lock table t1 write;
-# Switching to connection 'con1'.
+connection con1;
# This statement should not be blocked.
describe t1;
-# Switching to connection 'default'.
+connection default;
unlock tables;
#
# 1.5 SHOW statements.
#
# The above is true for SHOW statements as well.
lock table t1 write;
-# Switching to connection 'con1'.
+connection con1;
# These statements should not be blocked.
show keys from t1;
-# Switching to connection 'default'.
+connection default;
unlock tables;
#
# 2. Statements which read tables through subqueries.
@@ -280,6 +286,7 @@ unlock tables;
# A strong lock is not necessary as this statement is not
# written to the binary log as a whole (it is written
# statement-by-statement).
+connection default;
Success: 'call p1((select i + 5 from t1 where i = 1))' allows concurrent inserts into 't1'.
#
# 2.2 CREATE TABLE with a subquery.
@@ -287,24 +294,29 @@ Success: 'call p1((select i + 5 from t1 where i = 1))' allows concurrent inserts
# Has to take a strong lock on the table being read as
# this statement is written to the binary log and therefore
# should be serialized with concurrent statements.
+connection default;
Success: 'create table t0 select * from t1' doesn't allow concurrent inserts into 't1'.
drop table t0;
+connection default;
Success: 'create table t0 select j from t2 where j in (select i from t1)' doesn't allow concurrent inserts into 't1'.
drop table t0;
#
# 2.3 DELETE with a subquery.
#
# The above is true for this statement as well.
+connection default;
Success: 'delete from t2 where j in (select i from t1)' doesn't allow concurrent inserts into 't1'.
#
# 2.4 MULTI-DELETE with a subquery.
#
# Same is true for this statement as well.
+connection default;
Success: 'delete t2 from t3, t2 where k = j and j in (select i from t1)' doesn't allow concurrent inserts into 't1'.
#
# 2.5 DO with a subquery.
#
# A strong lock is not necessary as it is not logged.
+connection default;
Success: 'do (select i from t1 where i = 1)' allows concurrent inserts into 't1'.
#
# 2.6 INSERT with a subquery.
@@ -312,18 +324,24 @@ Success: 'do (select i from t1 where i = 1)' allows concurrent inserts into 't1'
# Has to take a strong lock on the table being read as
# this statement is written to the binary log and therefore
# should be serialized with concurrent inserts.
+connection default;
Success: 'insert into t2 select i+5 from t1' doesn't allow concurrent inserts into 't1'.
+connection default;
Success: 'insert into t2 values ((select i+5 from t1 where i = 4))' doesn't allow concurrent inserts into 't1'.
#
# 2.7 LOAD DATA with a subquery.
#
# The above is true for this statement as well.
+connection default;
Success: 'load data infile '../../std_data/rpl_loaddata.dat' into table t2 (@a, @b) set j= @b + (select i from t1 where i = 1)' doesn't allow concurrent inserts into 't1'.
#
# 2.8 REPLACE with a subquery.
#
# Same is true for this statement as well.
+# Suppress warnings for REPLACE ... SELECT
+connection default;
Success: 'replace into t2 select i+5 from t1' doesn't allow concurrent inserts into 't1'.
+connection default;
Success: 'replace into t2 values ((select i+5 from t1 where i = 4))' doesn't allow concurrent inserts into 't1'.
#
# 2.9 SELECT with a subquery.
@@ -331,17 +349,21 @@ Success: 'replace into t2 values ((select i+5 from t1 where i = 4))' doesn't all
# Strong locks are not necessary as this statement is not written
# to the binary log and thanks to how MyISAM works this statement
# sees a version of the table prior to the concurrent insert.
+connection default;
Success: 'select * from t2 where j in (select i from t1)' allows concurrent inserts into 't1'.
#
# 2.10 SET with a subquery.
#
# The same is true for this statement as well.
+connection default;
Success: 'set @a:= (select i from t1 where i = 1)' allows concurrent inserts into 't1'.
#
# 2.11 SHOW with a subquery.
#
# And for this statement too.
+connection default;
Success: 'show tables from test where Tables_in_test = 't2' and (select i from t1 where i = 1)' allows concurrent inserts into 't1'.
+connection default;
Success: 'show columns from t2 where (select i from t1 where i = 1)' allows concurrent inserts into 't1'.
#
# 2.12 UPDATE with a subquery.
@@ -349,11 +371,13 @@ Success: 'show columns from t2 where (select i from t1 where i = 1)' allows conc
# Has to take a strong lock on the table being read as
# this statement is written to the binary log and therefore
# should be serialized with concurrent inserts.
+connection default;
Success: 'update t2 set j= j-10 where j in (select i from t1)' doesn't allow concurrent inserts into 't1'.
#
# 2.13 MULTI-UPDATE with a subquery.
#
# Same is true for this statement as well.
+connection default;
Success: 'update t2, t3 set j= j -10 where j=k and j in (select i from t1)' doesn't allow concurrent inserts into 't1'.
#
# 3. Statements which read tables through a view.
@@ -364,9 +388,13 @@ Success: 'update t2, t3 set j= j -10 where j=k and j in (select i from t1)' does
# Since this statement is not written to the binary log and
# an old version of the table is accessible thanks to how MyISAM
# handles concurrent insert, no locking is necessary.
+connection default;
Success: 'select * from v1' allows concurrent inserts into 't1'.
+connection default;
Success: 'select * from v2' allows concurrent inserts into 't1'.
+connection default;
Success: 'select * from t2 where j in (select i from v1)' allows concurrent inserts into 't1'.
+connection default;
Success: 'select * from t3 where k in (select j from v2)' allows concurrent inserts into 't1'.
#
# 3.2 Statements which modify a table and use views.
@@ -374,9 +402,13 @@ Success: 'select * from t3 where k in (select j from v2)' allows concurrent inse
# Since such statements are going to be written to the binary
# log they need to be serialized against concurrent statements
# and therefore should take strong locks on the data read.
+connection default;
Success: 'update t2 set j= j-10 where j in (select i from v1)' doesn't allow concurrent inserts into 't1'.
+connection default;
Success: 'update t3 set k= k-10 where k in (select j from v2)' doesn't allow concurrent inserts into 't1'.
+connection default;
Success: 'update t2, v1 set j= j-10 where j = i' doesn't allow concurrent inserts into 't1'.
+connection default;
Success: 'update v2 set j= j-10 where j = 3' doesn't allow concurrent inserts into 't1'.
#
# 4. Statements which read tables through stored functions.
@@ -388,7 +420,9 @@ Success: 'update v2 set j= j-10 where j = 3' doesn't allow concurrent inserts in
# There is no need to take strong locks on the table
# being selected from in SF as the call to such function
# won't get into the binary log.
+connection default;
Success: 'select f1()' allows concurrent inserts into 't1'.
+connection default;
Success: 'set @a:= f1()' allows concurrent inserts into 't1'.
#
# 4.2 INSERT (or other statement which modifies data) with
@@ -399,6 +433,7 @@ Success: 'set @a:= f1()' allows concurrent inserts into 't1'.
# be serialized with concurrent statements affecting the data
# it uses. Therefore it should take strong lock on the data
# it reads.
+connection default;
Success: 'insert into t2 values (f1() + 5)' doesn't allow concurrent inserts into 't1'.
#
# 4.3 SELECT/SET with a stored function which
@@ -408,7 +443,9 @@ Success: 'insert into t2 values (f1() + 5)' doesn't allow concurrent inserts int
# it should be serialized with concurrent statements affecting
# the data it uses. Hence, a strong lock on the data read
# should be taken.
+connection default;
Success: 'select f2()' doesn't allow concurrent inserts into 't1'.
+connection default;
Success: 'set @a:= f2()' doesn't allow concurrent inserts into 't1'.
#
# 4.4. SELECT/SET with a stored function which does not
@@ -417,9 +454,13 @@ Success: 'set @a:= f2()' doesn't allow concurrent inserts into 't1'.
#
# Call to this function won't get to the
# binary log and thus no strong lock is needed.
+connection default;
Success: 'select f3()' allows concurrent inserts into 't1'.
+connection default;
Success: 'set @a:= f3()' allows concurrent inserts into 't1'.
+connection default;
Success: 'select f4()' allows concurrent inserts into 't1'.
+connection default;
Success: 'set @a:= f4()' allows concurrent inserts into 't1'.
#
# 4.5. INSERT (or other statement which modifies data) with
@@ -431,7 +472,9 @@ Success: 'set @a:= f4()' allows concurrent inserts into 't1'.
# be serialized with concurrent statements affecting data it
# uses. Therefore it should take a strong lock on the data
# it reads.
+connection default;
Success: 'insert into t2 values (f3() + 5)' doesn't allow concurrent inserts into 't1'.
+connection default;
Success: 'insert into t2 values (f4() + 6)' doesn't allow concurrent inserts into 't1'.
#
# 4.6 SELECT/SET which uses a stored function with
@@ -440,7 +483,9 @@ Success: 'insert into t2 values (f4() + 6)' doesn't allow concurrent inserts int
# Since call to such function is written to the binary log
# it should be serialized with concurrent statements.
# Hence reads should take a strong lock.
+connection default;
Success: 'select f5()' doesn't allow concurrent inserts into 't1'.
+connection default;
Success: 'set @a:= f5()' doesn't allow concurrent inserts into 't1'.
#
# 4.7 SELECT/SET which uses a stored function which
@@ -450,9 +495,13 @@ Success: 'set @a:= f5()' doesn't allow concurrent inserts into 't1'.
# Calls to such functions won't get into
# the binary log and thus don't need strong
# locks.
+connection default;
Success: 'select f6()' allows concurrent inserts into 't1'.
+connection default;
Success: 'set @a:= f6()' allows concurrent inserts into 't1'.
+connection default;
Success: 'select f7()' allows concurrent inserts into 't1'.
+connection default;
Success: 'set @a:= f7()' allows concurrent inserts into 't1'.
#
# 4.8 INSERT which uses stored function which
@@ -463,7 +512,9 @@ Success: 'set @a:= f7()' allows concurrent inserts into 't1'.
# should be serialized with concurrent statements affecting
# the data it uses. Therefore it should take a strong lock on
# the table it reads.
+connection default;
Success: 'insert into t3 values (f6() + 5)' doesn't allow concurrent inserts into 't1'.
+connection default;
Success: 'insert into t3 values (f7() + 5)' doesn't allow concurrent inserts into 't1'.
#
# 4.9 SELECT which uses a stored function which
@@ -472,7 +523,9 @@ Success: 'insert into t3 values (f7() + 5)' doesn't allow concurrent inserts int
# Since a call to such function is written to the binary log
# it should be serialized with concurrent statements.
# Hence, reads should take strong locks.
+connection default;
Success: 'select f8()' doesn't allow concurrent inserts into 't1'.
+connection default;
Success: 'select f9()' doesn't allow concurrent inserts into 't1'.
#
# 4.10 SELECT which uses a stored function which doesn't modify
@@ -481,6 +534,7 @@ Success: 'select f9()' doesn't allow concurrent inserts into 't1'.
#
# Calls to such functions won't get into the binary
# log and thus don't need to acquire strong locks.
+connection default;
Success: 'select f10()' allows concurrent inserts into 't1'.
#
# 4.11 INSERT which uses a stored function which doesn't modify
@@ -490,6 +544,7 @@ Success: 'select f10()' allows concurrent inserts into 't1'.
# Since such statement is written to the binary log, it should
# be serialized with concurrent statements affecting the data it
# uses. Therefore it should take strong locks on data it reads.
+connection default;
Success: 'insert into t2 values (f10() + 5)' doesn't allow concurrent inserts into 't1'.
#
# 4.12 SELECT which uses a stored function which modifies
@@ -499,6 +554,7 @@ Success: 'insert into t2 values (f10() + 5)' doesn't allow concurrent inserts in
# Since a call to such function is written to the binary log
# it should be serialized from concurrent statements.
# Hence, read should take a strong lock.
+connection default;
Success: 'select f11()' doesn't allow concurrent inserts into 't1'.
#
# 4.13 SELECT that reads a table through a subquery passed
@@ -509,6 +565,7 @@ Success: 'select f11()' doesn't allow concurrent inserts into 't1'.
# binary log, values of its parameters are written as literals.
# So there is no need to acquire strong locks for tables used in
# the subquery.
+connection default;
Success: 'select f12((select i+10 from t1 where i=1))' allows concurrent inserts into 't1'.
#
# 4.14 INSERT that reads a table via a subquery passed
@@ -518,6 +575,7 @@ Success: 'select f12((select i+10 from t1 where i=1))' allows concurrent inserts
# Since this statement is written to the binary log it should
# be serialized with concurrent statements affecting the data it
# uses. Therefore it should take strong locks on the data it reads.
+connection default;
Success: 'insert into t2 values (f13((select i+10 from t1 where i=1)))' doesn't allow concurrent inserts into 't1'.
#
# 4.15 SELECT/SET with a stored function which
@@ -527,7 +585,9 @@ Success: 'insert into t2 values (f13((select i+10 from t1 where i=1)))' doesn't
# Since this statement is written to the binary log it should
# be serialized with concurrent statements affecting the data it
# uses. Therefore it should take strong locks on the data it reads.
+connection default;
Success: 'select f16()' doesn't allow concurrent inserts into 't1'.
+connection default;
Success: 'set @a:= f16()' doesn't allow concurrent inserts into 't1'.
#
# 4.16 SELECT/SET with a stored function which call procedure
@@ -537,7 +597,9 @@ Success: 'set @a:= f16()' doesn't allow concurrent inserts into 't1'.
# Since this statement is written to the binary log it should
# be serialized with concurrent statements affecting the data it
# uses. Therefore it should take strong locks on the data it reads.
+connection default;
Success: 'select f17()' doesn't allow concurrent inserts into 't1'.
+connection default;
Success: 'set @a:= f17()' doesn't allow concurrent inserts into 't1'.
#
# 5. Statements that read tables through stored procedures.
@@ -548,6 +610,7 @@ Success: 'set @a:= f17()' doesn't allow concurrent inserts into 't1'.
# Since neither this statement nor its components are
# written to the binary log, there is no need to take
# strong locks on the data it reads.
+connection default;
Success: 'call p2(@a)' allows concurrent inserts into 't1'.
#
# 5.2 Function that modifies data and uses CALL,
@@ -556,6 +619,7 @@ Success: 'call p2(@a)' allows concurrent inserts into 't1'.
# Since a call to such function is written to the binary
# log, it should be serialized with concurrent statements.
# Hence, in this case reads should take strong locks on data.
+connection default;
Success: 'select f14()' doesn't allow concurrent inserts into 't1'.
#
# 5.3 SELECT that calls a function that doesn't modify data and
@@ -563,6 +627,7 @@ Success: 'select f14()' doesn't allow concurrent inserts into 't1'.
#
# Calls to such functions won't get into the binary
# log and thus don't need to acquire strong locks.
+connection default;
Success: 'select f15()' allows concurrent inserts into 't1'.
#
# 5.4 INSERT which calls function which doesn't modify data and
@@ -571,6 +636,7 @@ Success: 'select f15()' allows concurrent inserts into 't1'.
# Since such statement is written to the binary log it should
# be serialized with concurrent statements affecting data it
# uses. Therefore it should take strong locks on data it reads.
+connection default;
Success: 'insert into t2 values (f15()+5)' doesn't allow concurrent inserts into 't1'.
#
# 6. Statements that use triggers.
@@ -582,30 +648,35 @@ Success: 'insert into t2 values (f15()+5)' doesn't allow concurrent inserts into
# be serialized with concurrent statements affecting the data
# it uses. Therefore, it should take strong locks on the data
# it reads.
+connection default;
Success: 'insert into t4 values (2)' doesn't allow concurrent inserts into 't1'.
#
# 6.2 Statement invoking a trigger that reads table through
# a subquery in a control construct.
#
# The above is true for this statement as well.
+connection default;
Success: 'update t4 set l= 2 where l = 1' doesn't allow concurrent inserts into 't1'.
#
# 6.3 Statement invoking a trigger that reads a table through
# a view.
#
# And for this statement.
+connection default;
Success: 'delete from t4 where l = 1' doesn't allow concurrent inserts into 't1'.
#
# 6.4 Statement invoking a trigger that reads a table through
# a stored function.
#
# And for this statement.
+connection default;
Success: 'insert into t5 values (2)' doesn't allow concurrent inserts into 't1'.
#
# 6.5 Statement invoking a trigger that reads a table through
# stored procedure.
#
# And for this statement.
+connection default;
Success: 'update t5 set l= 2 where l = 1' doesn't allow concurrent inserts into 't1'.
# Clean-up.
drop function f1;
@@ -630,156 +701,52 @@ 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;
#
-# Test for bug #45143 "All connections hang on concurrent ALTER TABLE".
-#
-# Concurrent execution of statements which required weak write lock
-# (TL_WRITE_ALLOW_WRITE) on several instances of the same table and
-# statements which tried to acquire stronger write lock (TL_WRITE,
-# TL_WRITE_ALLOW_READ) on this table might have led to deadlock.
-drop table if exists t1;
-drop view if exists v1;
-# Create auxiliary connections used through the test.
-# Reset DEBUG_SYNC facility before using it.
-set debug_sync= 'RESET';
-# Turn off logging so calls to locking subsystem performed
-# for general_log table won't interfere with our test.
-set @old_general_log = @@global.general_log;
-set @@global.general_log= OFF;
-create table t1 (i int) engine=InnoDB;
-# We have to use view in order to make LOCK TABLES avoid
-# acquiring SNRW metadata lock on table.
-create view v1 as select * from t1;
-insert into t1 values (1);
-# Prepare user lock which will be used for resuming execution of
-# the first statement after it acquires TL_WRITE_ALLOW_WRITE lock.
-select get_lock("lock_bug45143_wait", 0);
-get_lock("lock_bug45143_wait", 0)
-1
-# Switch to connection 'con_bug45143_1'.
-# Sending:
-insert into t1 values (get_lock("lock_bug45143_wait", 100));;
-# Switch to connection 'con_bug45143_2'.
-# Wait until the above INSERT takes TL_WRITE_ALLOW_WRITE lock on 't1'
-# and then gets blocked on user lock 'lock_bug45143_wait'.
-# Ensure that upcoming SELECT waits after acquiring TL_WRITE_ALLOW_WRITE
-# lock for the first instance of 't1'.
-set debug_sync='thr_multi_lock_after_thr_lock SIGNAL parked WAIT_FOR go';
-# Sending:
-select count(*) > 0 from t1 as a, t1 as b for update;;
-# Switch to connection 'con_bug45143_3'.
-# Wait until the above SELECT ... FOR UPDATE is blocked after
-# acquiring lock for the the first instance of 't1'.
-set debug_sync= 'now WAIT_FOR parked';
-# Send LOCK TABLE statement which will try to get TL_WRITE lock on 't1':
-lock table v1 write;;
-# Switch to connection 'default'.
-# Wait until this LOCK TABLES statement starts waiting for table lock.
-# Allow SELECT ... FOR UPDATE to resume.
-# Since it already has TL_WRITE_ALLOW_WRITE lock on the first instance
-# of 't1' it should be able to get lock on the second instance without
-# waiting, even although there is another thread which has such lock
-# on this table and also there is a thread waiting for a TL_WRITE on it.
-set debug_sync= 'now SIGNAL go';
-# Switch to connection 'con_bug45143_2'.
-# Reap SELECT ... FOR UPDATE
-count(*) > 0
-1
-# Switch to connection 'default'.
-# Resume execution of the INSERT statement.
-select release_lock("lock_bug45143_wait");
-release_lock("lock_bug45143_wait")
-1
-# Switch to connection 'con_bug45143_1'.
-# Reap INSERT statement.
-# In Statement and Mixed replication mode we get here "Unsafe
-# for binlog" warnings. In row mode there are no warnings.
-# Hide the discrepancy.
-# Switch to connection 'con_bug45143_3'.
-# Reap LOCK TABLES statement.
-unlock tables;
-# Switch to connection 'default'.
-# Do clean-up.
-set debug_sync= 'RESET';
-set @@global.general_log= @old_general_log;
-drop view v1;
-drop table t1;
-#
# Bug#50821 Deadlock between LOCK TABLES and ALTER TABLE
#
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1(id INT);
CREATE TABLE t2(id INT);
-# Connection con2
+connect con2, localhost, root;
START TRANSACTION;
SELECT * FROM t1;
id
-# Connection default
+connection default;
# Sending:
ALTER TABLE t1 ADD COLUMN j INT;
-# Connection con2
+connection con2;
# This used to cause a deadlock.
INSERT INTO t2 SELECT * FROM t1;
COMMIT;
-# Connection default
+connection default;
# Reaping ALTER TABLE t1 ADD COLUMN j INT
DROP TABLE t1, t2;
+disconnect con2;
#
# Bug#51391 Deadlock involving events during rqg_info_schema test
#
CREATE EVENT e1 ON SCHEDULE EVERY 5 HOUR DO SELECT 1;
CREATE EVENT e2 ON SCHEDULE EVERY 5 HOUR DO SELECT 2;
-# Connection con1
+connect con1, localhost, root;
SET DEBUG_SYNC="before_lock_tables_takes_lock SIGNAL drop WAIT_FOR query";
# Sending:
DROP EVENT e1;;
-# Connection default
+connection default;
SET DEBUG_SYNC="now WAIT_FOR drop";
SELECT name FROM mysql.event, INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE definer = VARIABLE_VALUE;
name
SET DEBUG_SYNC="now SIGNAL query";
-# Connection con1
+connection con1;
# Reaping: DROP EVENT t1
-# Connection default
+disconnect con1;
+connection default;
DROP EVENT e2;
SET DEBUG_SYNC="RESET";
#
-# Bug#55930 Assertion `thd->transaction.stmt.is_empty() ||
-# thd->in_sub_stmt || (thd->state..
-#
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1(a INT) engine=InnoDB;
-INSERT INTO t1 VALUES (1), (2);
-# Connection con1
-SET SESSION lock_wait_timeout= 1;
-SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL opti_recreate WAIT_FOR opti_analyze';
-# Sending:
-OPTIMIZE TABLE t1;
-# Connection con2
-SET DEBUG_SYNC= 'now WAIT_FOR opti_recreate';
-SET DEBUG_SYNC= 'after_lock_tables_takes_lock SIGNAL thrlock WAIT_FOR release_thrlock';
-# Sending:
-INSERT INTO t1 VALUES (3);
-# Connection default
-SET DEBUG_SYNC= 'now WAIT_FOR thrlock';
-SET DEBUG_SYNC= 'now SIGNAL opti_analyze';
-# Connection con1
-# Reaping: OPTIMIZE TABLE t1
-Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
-test.t1 optimize error Lock wait timeout exceeded; try restarting transaction
-test.t1 optimize status Operation failed
-Warnings:
-Error 1205 Lock wait timeout exceeded; try restarting transaction
-SET DEBUG_SYNC= 'now SIGNAL release_thrlock';
-# Connection con2
-# Reaping: INSERT INTO t1 VALUES (3)
-# Connection default
-DROP TABLE t1;
-SET DEBUG_SYNC= 'RESET';
-#
# Bug#57130 crash in Item_field::print during SHOW CREATE TABLE or VIEW
#
DROP TABLE IF EXISTS t1;
@@ -789,28 +756,102 @@ 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;
-# Connection con1
+connect con2, localhost, root;
+connect con1, localhost, root;
SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR dropped EXECUTE 2';
# Sending:
SHOW CREATE VIEW v1;
-# Connection con2
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR opened';
SET DEBUG_SYNC= 'now SIGNAL dropped';
SET DEBUG_SYNC= 'now WAIT_FOR opened';
# Sending:
FLUSH TABLES;
-# Connection default
+connection default;
# Waiting for FLUSH TABLES to be blocked.
SET DEBUG_SYNC= 'now SIGNAL dropped';
-# Connection con1
+connection con1;
# Reaping: SHOW CREATE VIEW v1
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`f1`() = 1) latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where `f1`() = 1 latin1 latin1_swedish_ci
Warnings:
Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
-# Connection con2
+connection con2;
# Reaping: FLUSH TABLES
-# Connection default
+connection default;
SET DEBUG_SYNC= 'RESET';
DROP VIEW v1;
DROP TABLE t1;
+disconnect con1;
+disconnect con2;
+#
+# Bug#28587 SELECT is blocked by INSERT waiting on read lock, even with low_priority_updates
+#
+set low_priority_updates=1;
+drop table if exists t1;
+drop table if exists t2;
+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';
+# Sending:
+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';
+Variable_name Value
+low_priority_updates ON
+insert into t1 values (1, 2) ON DUPLICATE KEY UPDATE b = 2;;
+connect select,localhost,root,,;
+select * from t1;
+a b
+set debug_sync='now SIGNAL go';
+connection default;
+disconnect update;
+disconnect select;
+# Reaping INSERT SELECT
+drop tables t1, t2;
+set low_priority_updates=default;
+set debug_sync='RESET';
+#
+# Additional test coverage for LOCK TABLES ... READ LOCAL
+# for InnoDB tables.
+#
+# Check that we correctly handle deadlocks which can occur
+# during metadata lock upgrade which happens when one tries
+# to use LOCK TABLES ... READ LOCAL for InnoDB tables.
+CREATE TABLE t1 (i INT) ENGINE=InnoDB;
+CREATE TABLE t2 (j INT) ENGINE=InnoDB;
+# Execute LOCK TABLE READ LOCK which will pause after acquiring
+# SR metadata lock and before upgrading it to SRO lock.
+SET DEBUG_SYNC="after_open_table_mdl_shared SIGNAL locked WAIT_FOR go";
+# Sending:
+LOCK TABLE t1 READ LOCAL;
+connect con1, localhost, root;
+SET DEBUG_SYNC="now WAIT_FOR locked";
+# Execute RENAME TABLE which will try to acquire X lock.
+# Sending:
+RENAME TABLE t1 TO t3, t2 TO t1, t3 TO t2;
+connect con2, localhost, root;
+# Wait until RENAME TABLE is blocked.
+# Resume LOCK TABLE statement. It should try to
+# upgrade SR lock to SRO lock which will create
+# deadlock due to presence of pending X lock.
+# Deadlock should be detected and LOCK TABLES should
+# release its MDL and retry opening of tables.
+SET DEBUG_SYNC="now SIGNAL go";
+connection con1;
+# RENAME TABLE should be able to complete. Reap it.
+connection default;
+# Reap LOCK TABLES.
+# Check that we see new version of table.
+SELECT * FROM t1;
+j
+UNLOCK TABLES;
+# Clean-up.
+SET DEBUG_SYNC="RESET";
+disconnect con1;
+disconnect con2;
+DROP TABLES t1, t2;
diff --git a/mysql-test/r/lock_tables_lost_commit.result b/mysql-test/r/lock_tables_lost_commit.result
index df4b6eff5cf..769e9734c7a 100644
--- a/mysql-test/r/lock_tables_lost_commit.result
+++ b/mysql-test/r/lock_tables_lost_commit.result
@@ -1,8 +1,15 @@
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT) ENGINE=innodb;
LOCK TABLES t1 WRITE;
INSERT INTO t1 VALUES(10);
+disconnect con1;
+connection con2;
SELECT * FROM t1;
a
10
DROP TABLE t1;
+connection default;
+disconnect con2;
diff --git a/mysql-test/r/locked_temporary-5955.result b/mysql-test/r/locked_temporary-5955.result
index 8999bdd39c4..ee2a9f499b2 100644
--- a/mysql-test/r/locked_temporary-5955.result
+++ b/mysql-test/r/locked_temporary-5955.result
@@ -1,2 +1,4 @@
+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/r/log_slow.result b/mysql-test/r/log_slow.result
index 02e04cfbb2d..510bb929d84 100644
--- a/mysql-test/r/log_slow.result
+++ b/mysql-test/r/log_slow.result
@@ -9,10 +9,10 @@ select @@log_slow_verbosity;
show variables like "log_slow%";
Variable_name Value
-log_slow_admin_statements OFF
+log_slow_admin_statements ON
log_slow_filter admin,filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk
log_slow_rate_limit 1
-log_slow_slave_statements OFF
+log_slow_slave_statements ON
log_slow_verbosity
set @org_slow_query_log= @@global.slow_query_log;
set @@log_slow_filter= "filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk,admin";
@@ -46,7 +46,7 @@ select @@log_slow_verbosity;
innodb
show fields from mysql.slow_log;
Field Type Null Key Default Extra
-start_time timestamp(6) NO CURRENT_TIMESTAMP(6) on update CURRENT_TIMESTAMP
+start_time timestamp(6) NO current_timestamp(6) on update current_timestamp(6)
user_host mediumtext NO NULL
query_time time(6) NO NULL
lock_time time(6) NO NULL
diff --git a/mysql-test/r/log_state.result b/mysql-test/r/log_state.result
index 6e3ab8a991a..d4f98a6bde9 100644
--- a/mysql-test/r/log_state.result
+++ b/mysql-test/r/log_state.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("options .* --log_slow_queries is not set");
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;
@@ -31,8 +32,8 @@ where Variable_name = 'general_log' or Variable_name = 'slow_query_log';
Variable_name Value
general_log ON
slow_query_log OFF
-# Establish connection con1 (user=root)
-# Switch to connection con1
+connect con1,localhost,root,,;
+connection con1;
set @long_query_time = <long_query_time>;
set session long_query_time = @long_query_time;
select sleep(@long_query_time + 1);
@@ -40,10 +41,10 @@ sleep(@long_query_time + 1)
0
select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected
-# Switch to connection default
+connection default;
set global slow_query_log= ON;
set local slow_query_log= ON;
-# Switch to connection con1
+connection con1;
set session long_query_time = @long_query_time;
select sleep(@long_query_time + 1);
sleep(@long_query_time + 1)
@@ -57,7 +58,7 @@ sleep(@long_query_time + 2)
select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected
TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 select sleep(@long_query_time + 2) THREAD_ID 0
-# Switch to connection default
+connection default;
show global variables
where Variable_name = 'general_log' or Variable_name = 'slow_query_log';
Variable_name Value
@@ -226,6 +227,7 @@ 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;
@@ -242,6 +244,8 @@ rows_examined sql_text
1 UPDATE t2 set b=b+sleep(.02) limit 1
4 UPDATE t1 SET a=a+sleep(.02) WHERE a in (SELECT b from t2)
6 DELETE FROM t1 WHERE a=a+sleep(.02) ORDER BY a LIMIT 2
+disconnect con2;
+connection default;
DROP TABLE t1,t2;
TRUNCATE TABLE mysql.slow_log;
# end of bug#49756
@@ -270,7 +274,8 @@ SELECT @@general_log_file = @my_glf;
@@general_log_file = @my_glf
1
SET GLOBAL general_log_file = @old_general_log_file;
-# Close connection con1
+disconnect con1;
+connection default;
SET GLOBAL long_query_time = DEFAULT;
SET GLOBAL log_output = @old_log_output;
SET global general_log = @old_general_log;
diff --git a/mysql-test/r/log_tables-big.result b/mysql-test/r/log_tables-big.result
index 4435d6d2723..392a1bce234 100644
--- a/mysql-test/r/log_tables-big.result
+++ b/mysql-test/r/log_tables-big.result
@@ -1,9 +1,13 @@
set @log_output.saved = @@global.log_output;
set @@global.log_output = 'TABLE';
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
set session long_query_time=10;
select get_lock('bug27638', 1);
get_lock('bug27638', 1)
1
+connection con2;
set session long_query_time=1;
select get_lock('bug27638', 2);
get_lock('bug27638', 2)
@@ -26,7 +30,11 @@ select if (query_time >= '00:01:40', 'OK', concat('WRONG: ',query_time)) as qt,
where sql_text = 'select get_lock(\'bug27638\', 101)';
qt sql_text
OK select get_lock('bug27638', 101)
+connection con1;
select release_lock('bug27638');
release_lock('bug27638')
1
+connection default;
+disconnect con1;
+disconnect con2;
set @@global.log_output = @log_output.saved;
diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result
index ff5055e1ae4..126230a8765 100644
--- a/mysql-test/r/log_tables.result
+++ b/mysql-test/r/log_tables.result
@@ -42,19 +42,19 @@ on (mysql.general_log.command_type = join_test.command_type)
drop table join_test;
flush logs;
lock tables mysql.general_log WRITE;
-ERROR HY000: You can't use locks with log tables.
+ERROR HY000: You can't use locks with log tables
lock tables mysql.slow_log WRITE;
-ERROR HY000: You can't use locks with log tables.
+ERROR HY000: You can't use locks with log tables
lock tables mysql.general_log READ;
-ERROR HY000: You can't use locks with log tables.
+ERROR HY000: You can't use locks with log tables
lock tables mysql.slow_log READ;
-ERROR HY000: You can't use locks with log tables.
+ERROR HY000: You can't use locks with log tables
lock tables mysql.slow_log READ LOCAL, mysql.general_log READ LOCAL;
-ERROR HY000: You can't use locks with log tables.
+ERROR HY000: You can't use locks with log tables
show create table mysql.general_log;
Table Create Table
general_log CREATE TABLE `general_log` (
- `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`thread_id` bigint(21) unsigned NOT NULL,
`server_id` int(10) unsigned NOT NULL,
@@ -63,7 +63,7 @@ general_log CREATE TABLE `general_log` (
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
show fields from mysql.general_log;
Field Type Null Key Default Extra
-event_time timestamp(6) NO CURRENT_TIMESTAMP(6) on update CURRENT_TIMESTAMP
+event_time timestamp(6) NO current_timestamp(6) on update current_timestamp(6)
user_host mediumtext NO NULL
thread_id bigint(21) unsigned NO NULL
server_id int(10) unsigned NO NULL
@@ -72,7 +72,7 @@ argument mediumtext NO NULL
show create table mysql.slow_log;
Table Create Table
slow_log CREATE TABLE `slow_log` (
- `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`query_time` time(6) NOT NULL,
`lock_time` time(6) NOT NULL,
@@ -88,7 +88,7 @@ slow_log CREATE TABLE `slow_log` (
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
show fields from mysql.slow_log;
Field Type Null Key Default Extra
-start_time timestamp(6) NO CURRENT_TIMESTAMP(6) on update CURRENT_TIMESTAMP
+start_time timestamp(6) NO current_timestamp(6) on update current_timestamp(6)
user_host mediumtext NO NULL
query_time time(6) NO NULL
lock_time time(6) NO NULL
@@ -169,7 +169,7 @@ set global slow_query_log='OFF';
show create table mysql.general_log;
Table Create Table
general_log CREATE TABLE `general_log` (
- `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`thread_id` bigint(21) unsigned NOT NULL,
`server_id` int(10) unsigned NOT NULL,
@@ -179,7 +179,7 @@ general_log CREATE TABLE `general_log` (
show create table mysql.slow_log;
Table Create Table
slow_log CREATE TABLE `slow_log` (
- `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`query_time` time(6) NOT NULL,
`lock_time` time(6) NOT NULL,
@@ -198,7 +198,7 @@ alter table mysql.slow_log engine=myisam;
show create table mysql.general_log;
Table Create Table
general_log CREATE TABLE `general_log` (
- `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`thread_id` bigint(21) unsigned NOT NULL,
`server_id` int(10) unsigned NOT NULL,
@@ -208,7 +208,7 @@ general_log CREATE TABLE `general_log` (
show create table mysql.slow_log;
Table Create Table
slow_log CREATE TABLE `slow_log` (
- `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`query_time` time(6) NOT NULL,
`lock_time` time(6) NOT NULL,
@@ -245,13 +245,13 @@ TIMESTAMP USER_HOST THREAD_ID 1 Query set global slow_query_log='ON'
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.general_log
flush logs;
lock tables mysql.general_log WRITE;
-ERROR HY000: You can't use locks with log tables.
+ERROR HY000: You can't use locks with log tables
lock tables mysql.slow_log WRITE;
-ERROR HY000: You can't use locks with log tables.
+ERROR HY000: You can't use locks with log tables
lock tables mysql.general_log READ;
-ERROR HY000: You can't use locks with log tables.
+ERROR HY000: You can't use locks with log tables
lock tables mysql.slow_log READ;
-ERROR HY000: You can't use locks with log tables.
+ERROR HY000: You can't use locks with log tables
set global general_log='OFF';
set global slow_query_log='OFF';
set @save_storage_engine= @@session.storage_engine;
@@ -301,7 +301,7 @@ flush tables with read lock;
unlock tables;
use mysql;
lock tables general_log read local, help_category read local;
-ERROR HY000: You can't use locks with log tables.
+ERROR HY000: You can't use locks with log tables
unlock tables;
SET SESSION long_query_time = 1000;
drop table if exists mysql.renamed_general_log;
@@ -436,9 +436,9 @@ My own slow query sleep(2)
My own slow query 0
SELECT * FROM mysql.slow_log WHERE seq >= 2 LIMIT 3;
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected seq
-START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 0 2
-START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 0 3
-START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 0 4
+START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 4 0 2
+START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 4 0 3
+START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 4 0 4
SET GLOBAL slow_query_log = 0;
SET SESSION long_query_time =@saved_long_query_time;
FLUSH LOGS;
@@ -507,14 +507,47 @@ call proc25422_alter_slow(@iterations);
"Serial test (proc25422_alter_general)"
call proc25422_alter_general(@iterations);
"Parallel 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;
call proc25422_truncate_slow(@iterations);
+connection addconroot2;
call proc25422_truncate_slow(@iterations);
+connection addconroot3;
call proc25422_truncate_general(@iterations);
+connection addconroot4;
call proc25422_truncate_general(@iterations);
+connection addconroot5;
call proc25422_alter_slow(@iterations);
+connection addconroot6;
call proc25422_alter_slow(@iterations);
+connection addconroot7;
call proc25422_alter_general(@iterations);
+connection addconroot8;
call proc25422_alter_general(@iterations);
+connection addconroot1;
+connection addconroot2;
+connection addconroot3;
+connection addconroot4;
+connection addconroot5;
+connection addconroot6;
+connection addconroot7;
+connection addconroot8;
+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;
diff --git a/mysql-test/r/lowercase_fs_off.result b/mysql-test/r/lowercase_fs_off.result
index dea4670d2c7..12da5127629 100644
--- a/mysql-test/r/lowercase_fs_off.result
+++ b/mysql-test/r/lowercase_fs_off.result
@@ -1,8 +1,12 @@
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();
database()
d1
@@ -10,22 +14,31 @@ create database d2;
ERROR 42000: Access denied for user 'sample'@'localhost' to database 'd2'
create database D1;
ERROR 42000: Access denied for user 'sample'@'localhost' to database 'D1'
+disconnect sample;
+connection master;
drop user 'sample'@'localhost';
drop database if exists d1;
+disconnect master;
+connection default;
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;
select * from t1;
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1'
select * from T1;
f1
+connection default;
GRANT SELECT ON t1 to user_1@localhost;
+connection con1;
select * from information_schema.table_privileges;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
'user_1'@'localhost' def d1 T1 SELECT NO
'user_1'@'localhost' def d1 t1 SELECT NO
+connection default;
+disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
DROP USER user_1@localhost;
DROP DATABASE d1;
@@ -38,17 +51,22 @@ 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);
f1(1)
2
+connect con2,localhost,USER_1,,db1;
call p1();
ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.p1'
call P1();
ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.P1'
select f1(1);
ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.f1'
+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;
diff --git a/mysql-test/r/lowercase_fs_on.result b/mysql-test/r/lowercase_fs_on.result
index b844b3f77dd..ddf3fd5f1fb 100644
--- a/mysql-test/r/lowercase_fs_on.result
+++ b/mysql-test/r/lowercase_fs_on.result
@@ -1,4 +1,4 @@
#
# Bug#20198490 : LOWER_CASE_TABLE_NAMES=0 ON WINDOWS LEADS TO PROBLEMS
#
-FOUND /\[ERROR\] The server option \'lower_case_table_names\' is configured to use case sensitive table names/ in my_restart.err
+FOUND 1 /\[ERROR\] The server option \'lower_case_table_names\' is configured to use case sensitive table names/ in my_restart.err
diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result
index 1130e782291..9194638a4d2 100644
--- a/mysql-test/r/lowercase_table2.result
+++ b/mysql-test/r/lowercase_table2.result
@@ -138,7 +138,7 @@ Tables_in_test (T1%)
T1
alter table t1 add index (A);
Warnings:
-Note 1831 Duplicate index `A_2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `A_2`. This is deprecated and will be disallowed in a future release
show tables like 't1%';
Tables_in_test (t1%)
t1
diff --git a/mysql-test/r/lowercase_view.result b/mysql-test/r/lowercase_view.result
index f43c39c4fc1..df303807407 100644
--- a/mysql-test/r/lowercase_view.result
+++ b/mysql-test/r/lowercase_view.result
@@ -16,29 +16,29 @@ 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;
update v2aA set col1 = (select max(col1) from v1Aa);
-ERROR HY000: The definition of table 'v1Aa' prevents operation UPDATE on table 'v2aA'.
+ERROR HY000: The definition of table 'v1Aa' prevents operation UPDATE on table 'v2aA'
update v2Aa set col1 = (select max(col1) from t1Aa);
-ERROR HY000: The definition of table 'v2Aa' prevents operation UPDATE on table 'v2Aa'.
+ERROR HY000: The definition of table 'v2Aa' prevents operation UPDATE on table 'v2Aa'
update v2aA set col1 = (select max(col1) from v2Aa);
ERROR HY000: Table 'v2aA' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from v1aA) where v2aA.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 'v2aA'.
+ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 'v2aA'
update t1aA,t2Aa set t1Aa.col1 = (select max(col1) from v1Aa) where t1aA.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v1Aa' prevents operation UPDATE on table 't1aA'.
+ERROR HY000: The definition of table 'v1Aa' prevents operation UPDATE on table 't1aA'
update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from v1aA) where v1Aa.col1 = t2aA.col1;
ERROR HY000: Table 'v1aA' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t2Aa,v2Aa set v2aA.col1 = (select max(col1) from v1aA) where v2Aa.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 't2Aa'.
+ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 't2Aa'
update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from v1Aa) where t1Aa.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v1Aa' prevents operation UPDATE on table 't2Aa'.
+ERROR HY000: The definition of table 'v1Aa' prevents operation UPDATE on table 't2Aa'
update t2Aa,v1aA set v1Aa.col1 = (select max(col1) from v1aA) where v1Aa.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 't2Aa'.
+ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 't2Aa'
update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from t1aA) where v2aA.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 'v2aA'.
+ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 'v2aA'
update t1Aa,t2Aa set t1aA.col1 = (select max(col1) from t1Aa) where t1aA.col1 = t2aA.col1;
ERROR HY000: Table 't1Aa' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from t1Aa) where v1aA.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 'v1aA'.
+ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 'v1aA'
update t2Aa,v2Aa set v2aA.col1 = (select max(col1) from t1aA) where v2Aa.col1 = t2aA.col1;
ERROR HY000: Table 't2Aa' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from t1Aa) where t1aA.col1 = t2aA.col1;
@@ -48,71 +48,71 @@ ERROR HY000: Table 't2Aa' is specified twice, both as a target for 'UPDATE' and
update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from v2aA) where v2Aa.col1 = t2aA.col1;
ERROR HY000: Table 'v2aA' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t1aA,t2Aa set t1Aa.col1 = (select max(col1) from v2aA) where t1aA.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 't1aA'.
+ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 't1aA'
update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from v2Aa) where v1aA.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v2Aa' prevents operation UPDATE on table 'v1aA'.
+ERROR HY000: The definition of table 'v2Aa' prevents operation UPDATE on table 'v1aA'
update t2Aa,v2aA set v2Aa.col1 = (select max(col1) from v2aA) where v2Aa.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 't2Aa'.
+ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 't2Aa'
update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from v2aA) where t1Aa.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 't2Aa'.
+ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 't2Aa'
update t2Aa,v1Aa set v1aA.col1 = (select max(col1) from v2Aa) where v1Aa.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v2Aa' prevents operation UPDATE on table 't2Aa'.
+ERROR HY000: The definition of table 'v2Aa' prevents operation UPDATE on table 't2Aa'
update v3aA set v3Aa.col1 = (select max(col1) from v1aA);
-ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 'v3aA'.
+ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 'v3aA'
update v3aA set v3Aa.col1 = (select max(col1) from t1aA);
-ERROR HY000: The definition of table 'v3aA' prevents operation UPDATE on table 'v3aA'.
+ERROR HY000: The definition of table 'v3aA' prevents operation UPDATE on table 'v3aA'
update v3aA set v3Aa.col1 = (select max(col1) from v2aA);
-ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 'v3aA'.
+ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 'v3aA'
update v3aA set v3Aa.col1 = (select max(col1) from v3aA);
ERROR HY000: Table 'v3aA' is specified twice, both as a target for 'UPDATE' and as a separate source for data
delete from v2Aa where col1 = (select max(col1) from v1Aa);
-ERROR HY000: The definition of table 'v1Aa' prevents operation DELETE on table 'v2Aa'.
+ERROR HY000: The definition of table 'v1Aa' prevents operation DELETE on table 'v2Aa'
delete from v2aA where col1 = (select max(col1) from t1Aa);
-ERROR HY000: The definition of table 'v2aA' prevents operation DELETE on table 'v2aA'.
+ERROR HY000: The definition of table 'v2aA' prevents operation DELETE on table 'v2aA'
delete from v2Aa where col1 = (select max(col1) from v2aA);
ERROR HY000: Table 'v2Aa' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete v2Aa from v2aA,t2Aa where (select max(col1) from v1aA) > 0 and v2Aa.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v1aA' prevents operation DELETE on table 'v2aA'.
+ERROR HY000: The definition of table 'v1aA' prevents operation DELETE on table 'v2aA'
delete t1aA from t1Aa,t2Aa where (select max(col1) from v1Aa) > 0 and t1aA.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v1Aa' prevents operation DELETE on table 't1Aa'.
+ERROR HY000: The definition of table 'v1Aa' prevents operation DELETE on table 't1Aa'
delete v1aA from v1Aa,t2Aa where (select max(col1) from v1aA) > 0 and v1Aa.col1 = t2aA.col1;
ERROR HY000: Table 'v1Aa' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete v2aA from v2Aa,t2Aa where (select max(col1) from t1Aa) > 0 and v2aA.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v2Aa' prevents operation DELETE on table 'v2Aa'.
+ERROR HY000: The definition of table 'v2Aa' prevents operation DELETE on table 'v2Aa'
delete t1aA from t1Aa,t2Aa where (select max(col1) from t1aA) > 0 and t1Aa.col1 = t2aA.col1;
ERROR HY000: Table 't1Aa' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete v1aA from v1Aa,t2Aa where (select max(col1) from t1aA) > 0 and v1aA.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v1Aa' prevents operation DELETE on table 'v1Aa'.
+ERROR HY000: The definition of table 'v1Aa' prevents operation DELETE on table 'v1Aa'
delete v2Aa from v2aA,t2Aa where (select max(col1) from v2Aa) > 0 and v2aA.col1 = t2aA.col1;
ERROR HY000: Table 'v2aA' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete t1Aa from t1aA,t2Aa where (select max(col1) from v2Aa) > 0 and t1Aa.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v2Aa' prevents operation DELETE on table 't1aA'.
+ERROR HY000: The definition of table 'v2Aa' prevents operation DELETE on table 't1aA'
delete v1Aa from v1aA,t2Aa where (select max(col1) from v2aA) > 0 and v1Aa.col1 = t2aA.col1;
-ERROR HY000: The definition of table 'v2aA' prevents operation DELETE on table 'v1aA'.
+ERROR HY000: The definition of table 'v2aA' prevents operation DELETE on table 'v1aA'
insert into v2Aa values ((select max(col1) from v1aA));
-ERROR HY000: The definition of table 'v1aA' prevents operation INSERT on table 'v2Aa'.
+ERROR HY000: The definition of table 'v1aA' prevents operation INSERT on table 'v2Aa'
insert into t1aA values ((select max(col1) from v1Aa));
-ERROR HY000: The definition of table 'v1Aa' prevents operation INSERT on table 't1aA'.
+ERROR HY000: The definition of table 'v1Aa' prevents operation INSERT on table 't1aA'
insert into v2aA values ((select max(col1) from v1aA));
-ERROR HY000: The definition of table 'v1aA' prevents operation INSERT on table 'v2aA'.
+ERROR HY000: The definition of table 'v1aA' prevents operation INSERT on table 'v2aA'
insert into v2Aa values ((select max(col1) from t1Aa));
-ERROR HY000: The definition of table 'v2Aa' prevents operation INSERT on table 'v2Aa'.
+ERROR HY000: The definition of table 'v2Aa' prevents operation INSERT on table 'v2Aa'
insert into t1aA values ((select max(col1) from t1Aa));
ERROR HY000: Table 't1aA' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into v2aA values ((select max(col1) from t1aA));
-ERROR HY000: The definition of table 'v2aA' prevents operation INSERT on table 'v2aA'.
+ERROR HY000: The definition of table 'v2aA' prevents operation INSERT on table 'v2aA'
insert into v2Aa values ((select max(col1) from v2aA));
ERROR HY000: Table 'v2Aa' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into t1Aa values ((select max(col1) from v2Aa));
-ERROR HY000: The definition of table 'v2Aa' prevents operation INSERT on table 't1Aa'.
+ERROR HY000: The definition of table 'v2Aa' prevents operation INSERT on table 't1Aa'
insert into v2aA values ((select max(col1) from v2Aa));
ERROR HY000: Table 'v2aA' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into v3Aa (col1) values ((select max(col1) from v1Aa));
-ERROR HY000: The definition of table 'v1Aa' prevents operation INSERT on table 'v3Aa'.
+ERROR HY000: The definition of table 'v1Aa' prevents operation INSERT on table 'v3Aa'
insert into v3aA (col1) values ((select max(col1) from t1aA));
-ERROR HY000: The definition of table 'v3aA' prevents operation INSERT on table 'v3aA'.
+ERROR HY000: The definition of table 'v3aA' prevents operation INSERT on table 'v3aA'
insert into v3Aa (col1) values ((select max(col1) from v2aA));
-ERROR HY000: The definition of table 'v2aA' prevents operation INSERT on table 'v3Aa'.
+ERROR HY000: The definition of table 'v2aA' prevents operation INSERT on table 'v3Aa'
drop view v3aA,v2Aa,v1aA;
drop table t1Aa,t2Aa;
create table t1Aa (col1 int);
@@ -142,7 +142,7 @@ 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;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `x`.`a` AS `a` from `t1` `x` group by `x`.`b` having (`x`.`a` = 1) latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `x`.`a` AS `a` from `t1` `x` group by `x`.`b` having `x`.`a` = 1 latin1 latin1_swedish_ci
SELECT * FROM v1;
a
DROP VIEW v1;
diff --git a/mysql-test/r/mdev-504.result b/mysql-test/r/mdev-504.result
index 4d93e77c6e8..9b8b6795e0f 100644
--- a/mysql-test/r/mdev-504.result
+++ b/mysql-test/r/mdev-504.result
@@ -16,6 +16,7 @@ BEGIN
RETURN ROUND(3 * RAND() + 0.5);
END |
SET GLOBAL use_stat_tables = PREFERABLY;
+connection default;
DROP TABLE A;
DROP PROCEDURE p_analyze;
DROP FUNCTION rnd3;
diff --git a/mysql-test/r/mdev375.result b/mysql-test/r/mdev375.result
index b3b83af0988..0ae8375ff24 100644
--- a/mysql-test/r/mdev375.result
+++ b/mysql-test/r/mdev375.result
@@ -1,14 +1,28 @@
SET GLOBAL log_warnings=4;
SET GLOBAL max_connections=10;
+connect tmp_con1,localhost,root,,;
+connect tmp_con2,localhost,root,,;
+connect tmp_con3,localhost,root,,;
+connect tmp_con4,localhost,root,,;
+connect tmp_con5,localhost,root,,;
+connect tmp_con6,localhost,root,,;
+connect tmp_con7,localhost,root,,;
+connect tmp_con8,localhost,root,,;
+connect con1,localhost,root,,;
SELECT 1;
1
1
+connect con2,localhost,root,,;
SELECT 2;
2
2
ERROR HY000: Too many connections
+connection default;
SELECT 0;
0
0
+show status like "Threads_connected";
+Variable_name Value
+Threads_connected 11
SET GLOBAL log_warnings=default;
SET GLOBAL max_connections=default;
diff --git a/mysql-test/r/mdl.result b/mysql-test/r/mdl.result
new file mode 100644
index 00000000000..d93bfd5c729
--- /dev/null
+++ b/mysql-test/r/mdl.result
@@ -0,0 +1,22 @@
+#
+# MDEV-12882 - Assertion `mdl_ticket->m_type == MDL_SHARED_UPGRADABLE ||
+# mdl_ticket->m_type == MDL_SHARED_NO_WRITE ||
+# mdl_ticket->m_type == MDL_SHARED_NO_READ_WRITE ||
+# mdl_ticket->m_type == MDL_SHARED_READ'
+# failed in MDL_context::upgrade_shared_lock
+#
+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;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_INTENTION_EXCLUSIVE Global read lock
+MDL_SHARED_NO_READ_WRITE Table metadata lock test t1
+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;
+LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
+MDL_INTENTION_EXCLUSIVE Global read lock
+MDL_SHARED_WRITE Table metadata lock test t1
+MDL_SHARED_READ_ONLY Table metadata lock test t1
+UNLOCK TABLES;
+DROP TABLE t1;
diff --git a/mysql-test/r/mdl_sync.result b/mysql-test/r/mdl_sync.result
index 8b6f96033c9..3880fc5ef91 100644
--- a/mysql-test/r/mdl_sync.result
+++ b/mysql-test/r/mdl_sync.result
@@ -1,28 +1,46 @@
SET DEBUG_SYNC= 'RESET';
+connect con1,localhost,root,,test,,;
+connect con2,localhost,root,,test,,;
+connect con3,localhost,root,,test,,;
+connection default;
drop table if exists t1,t2,t3;
create table t1 (i int);
create table t2 (i int);
connection: default
lock tables t2 read;
+connection con1;
connection: con1
set debug_sync='mdl_upgrade_lock SIGNAL parked WAIT_FOR go';
alter table t1 rename t3;
+connection default;
connection: default
set debug_sync= 'now WAIT_FOR parked';
+connection con2;
connection: con2
set debug_sync='mdl_acquire_lock_wait SIGNAL go';
drop table t1,t2;
+connection con1;
connection: con1
+connection default;
connection: default
unlock tables;
+connection con2;
connection: con2
ERROR 42S02: Unknown table 'test.t1'
+connection default;
drop table t3;
+disconnect con1;
+disconnect con2;
+disconnect con3;
SET DEBUG_SYNC= 'RESET';
#
# Basic test coverage for type-of-operation aware metadata locks.
#
drop table if exists t1, t2, t3;
+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);
#
@@ -36,7 +54,7 @@ create table t1 (c1 int);
#
handler t1 open;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that S, SH, SR and SW locks are compatible with it.
handler t1 open t;
handler t close;
@@ -58,70 +76,43 @@ ERROR 42000: Key column 'not_exist' doesn't exist in table
# lock.
alter table t1 add primary key (c1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
-# Check that SNRW lock is compatible with S lock.
-lock table t1 write;
-insert into t1 values (1);
-unlock tables;
# Check that X lock is incompatible with S lock.
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above RENAME is blocked because of S lock.
#
-# Switching to connection 'default'.
+connection default;
# Unblock RENAME TABLE.
handler t1 close;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping RENAME TABLE.
# Restore the original state of the things.
rename table t2 to t1;
#
-# Switching to connection 'default'.
+connection default;
handler t1 open;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that upgrade from SNW to X is blocked by presence of S lock.
# Sending:
alter table t1 add column c2 int;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above ALTER TABLE is blocked because of S lock.
#
-# Switching to connection 'default'.
+connection default;
# Unblock ALTER TABLE.
handler t1 close;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping ALTER TABLE.
# Restore the original state of the things.
alter table t1 drop column c2;
#
-# Switching to connection 'default'.
-handler t1 open;
-#
-# Switching to connection 'mdl_con1'.
-# Check that upgrade from SNRW to X is blocked by presence of S lock.
-lock table t1 write;
-# Sending:
-alter table t1 add column c2 int;;
-#
-# Switching to connection 'mdl_con2'.
-# Check that the above upgrade of SNRW to X in ALTER TABLE is blocked
-# because of S lock.
-#
-# Switching to connection 'default'.
-# Unblock ALTER TABLE.
-handler t1 close;
-#
-# Switching to connection 'mdl_con1'.
-# Reaping ALTER TABLE.
-# Restore the original state of the things.
-alter table t1 drop column c2;
-unlock tables;
-#
-# Switching to connection 'default'.
+connection default;
#
# 2) Acquire SH (shared high-priority) lock on the table.
# We have to involve DEBUG_SYNC facility for this as usually
@@ -131,7 +122,7 @@ set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
# Sending:
select table_name, table_type, auto_increment, table_comment from information_schema.tables where table_schema='test' and table_name='t1';;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
set debug_sync= 'now WAIT_FOR locked';
# Check that S, SH, SR and SW locks are compatible with it.
handler t1 open;
@@ -142,7 +133,7 @@ column_name
c1
select count(*) from t1;
count(*)
-3
+2
insert into t1 values (1);
# Check that SU lock is compatible with it. To do this use ALTER TABLE
# which will fail when constructing .frm and thus obtaining SU metadata
@@ -162,76 +153,76 @@ unlock tables;
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above RENAME is blocked because of SH lock.
# Unblock RENAME TABLE.
set debug_sync= 'now SIGNAL finish';
#
-# Switching to connection 'default'.
+connection default;
# Reaping SELECT ... FROM I_S.
table_name table_type auto_increment table_comment
t1 BASE TABLE NULL
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping RENAME TABLE.
# Restore the original state of the things.
rename table t2 to t1;
#
-# Switching to connection 'default'.
+connection default;
set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
# Sending:
select table_name, table_type, auto_increment, table_comment from information_schema.tables where table_schema='test' and table_name='t1';;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
set debug_sync= 'now WAIT_FOR locked';
# Check that upgrade from SNW to X is blocked by presence of SH lock.
# Sending:
alter table t1 add column c2 int;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above ALTER TABLE is blocked because of SH lock.
# Unblock RENAME TABLE.
set debug_sync= 'now SIGNAL finish';
#
-# Switching to connection 'default'.
+connection default;
# Reaping SELECT ... FROM I_S.
table_name table_type auto_increment table_comment
t1 BASE TABLE NULL
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping ALTER TABLE.
# Restore the original state of the things.
alter table t1 drop column c2;
#
-# Switching to connection 'default'.
+connection default;
set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
select table_name, table_type, auto_increment, table_comment from information_schema.tables where table_schema='test' and table_name='t1';;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
set debug_sync= 'now WAIT_FOR locked';
# Check that upgrade from SNRW to X is blocked by presence of S lock.
lock table t1 write;
# Sending:
alter table t1 add column c2 int;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above upgrade of SNRW to X in ALTER TABLE is blocked
# because of S lock.
# Unblock RENAME TABLE.
set debug_sync= 'now SIGNAL finish';
#
-# Switching to connection 'default'.
+connection default;
# Reaping SELECT ... FROM I_S.
table_name table_type auto_increment table_comment
t1 BASE TABLE NULL
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping ALTER TABLE.
# Restore the original state of the things.
alter table t1 drop column c2;
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
#
#
# 3) Acquire SR lock on the table.
@@ -240,9 +231,9 @@ unlock tables;
begin;
select count(*) from t1;
count(*)
-3
+2
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that S, SH, SR and SW locks are compatible with it.
handler t1 open;
handler t1 close;
@@ -252,7 +243,7 @@ column_name
c1
select count(*) from t1;
count(*)
-3
+2
insert into t1 values (1);
# Check that SU lock is compatible with it. To do this use ALTER TABLE
# which will fail when constructing .frm and thus obtaining SU metadata
@@ -268,58 +259,58 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
# Sending:
lock table t1 write;;
#
-# Switching to connection 'default'.
+connection default;
# Check that the above LOCK TABLES is blocked because of SR lock.
# Unblock LOCK TABLES.
commit;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping LOCK TABLES.
delete from t1 limit 1;
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
begin;
select count(*) from t1;
count(*)
-3
+2
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that X lock is incompatible with SR lock.
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above RENAME is blocked because of SR lock.
#
-# Switching to connection 'default'.
+connection default;
# Unblock RENAME TABLE.
commit;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping RENAME TABLE.
# Restore the original state of the things.
rename table t2 to t1;
#
-# Switching to connection 'default'.
+connection default;
begin;
select count(*) from t1;
count(*)
-3
+2
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that upgrade from SNW to X is blocked by presence of SR lock.
# Sending:
alter table t1 add column c2 int;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above ALTER TABLE is blocked because of SR lock.
#
-# Switching to connection 'default'.
+connection default;
# Unblock ALTER TABLE.
commit;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping ALTER TABLE.
# Restore the original state of the things.
alter table t1 drop column c2;
@@ -328,7 +319,7 @@ alter table t1 drop column c2;
# by presence of SR lock because SNRW is incompatible with SR anyway.
#
#
-# Switching to connection 'default'.
+connection default;
#
#
# 4) Acquire SW lock on the table.
@@ -337,7 +328,7 @@ alter table t1 drop column c2;
begin;
insert into t1 values (1);
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that S, SH, SR and SW locks are compatible with it.
handler t1 open;
handler t1 close;
@@ -360,51 +351,51 @@ ERROR 42000: Key column 'not_exist' doesn't exist in table
# Sending:
alter table t1 add primary key (c1);;
#
-# Switching to connection 'default'.
+connection default;
# Check that the above ALTER TABLE is blocked because of SW lock.
# Unblock ALTER TABLE.
commit;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping ALTER TABLE.
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
#
-# Switching to connection 'default'.
+connection default;
begin;
insert into t1 values (1);
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that SNRW lock is not compatible with SW lock.
# Sending:
lock table t1 write;;
#
-# Switching to connection 'default'.
+connection default;
# Check that the above LOCK TABLES is blocked because of SW lock.
# Unblock LOCK TABLES.
commit;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping LOCK TABLES.
delete from t1 limit 2;
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
begin;
insert into t1 values (1);
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that X lock is incompatible with SW lock.
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above RENAME is blocked because of SW lock.
#
-# Switching to connection 'default'.
+connection default;
# Unblock RENAME TABLE.
commit;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping RENAME TABLE.
# Restore the original state of the things.
rename table t2 to t1;
@@ -414,7 +405,7 @@ rename table t2 to t1;
# with SW anyway.
#
#
-# Switching to connection 'default'.
+connection default;
#
#
# 5) Acquire SU lock on the table. We have to use DEBUG_SYNC for
@@ -424,7 +415,7 @@ set debug_sync= 'alter_opened_table SIGNAL locked WAIT_FOR finish';
# Sending:
alter table t1 add primary key (c1);;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
set debug_sync= 'now WAIT_FOR locked';
# Check that S, SH, SR and SW locks are compatible with it.
handler t1 open;
@@ -435,73 +426,73 @@ column_name
c1
select count(*) from t1;
count(*)
-5
+4
delete from t1 limit 1;
# Check that SU lock is incompatible with SU lock.
# Sending:
alter table t1 add primary key (c1);;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above ALTER is blocked because of SU lock.
# Unblock ALTERs.
set debug_sync= 'now SIGNAL finish';
#
-# Switching to connection 'default'.
+connection default;
# Reaping first ALTER TABLE.
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping another ALTER TABLE.
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
#
-# Switching to connection 'default'.
+connection default;
set debug_sync= 'alter_opened_table SIGNAL locked WAIT_FOR finish';
# Sending:
alter table t1 add primary key (c1);;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
set debug_sync= 'now WAIT_FOR locked';
# Check that SNRW lock is incompatible with SU lock.
# Sending:
lock table t1 write;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above LOCK TABLES is blocked because of SU lock.
# Unblock ALTER and thus LOCK TABLES.
set debug_sync= 'now SIGNAL finish';
#
-# Switching to connection 'default'.
+connection default;
# Reaping ALTER TABLE.
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping LOCK TABLES
insert into t1 values (1);
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
set debug_sync= 'alter_opened_table SIGNAL locked WAIT_FOR finish';
# Sending:
alter table t1 add primary key (c1);;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
set debug_sync= 'now WAIT_FOR locked';
# Check that X lock is incompatible with SU lock.
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above RENAME is blocked because of SU lock.
# Unblock ALTER and thus RENAME TABLE.
set debug_sync= 'now SIGNAL finish';
#
-# Switching to connection 'default'.
+connection default;
# Now we have ALTER TABLE with SU->SNW and RENAME TABLE with pending
# X-lock. In this case ALTER TABLE should be chosen as victim.
# Reaping ALTER TABLE.
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping RENAME TABLE
# Revert back to original state of things.
rename table t2 to t1;
@@ -510,7 +501,7 @@ rename table t2 to t1;
# blocked by presence of another SU lock because SNW/SNRW is
# incompatible with SU anyway.
#
-# Switching to connection 'default'.
+connection default;
#
#
# 6) Acquire SNW lock on the table. We have to use DEBUG_SYNC for
@@ -520,7 +511,7 @@ set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR fini
# Sending:
alter table t1 add primary key (c1), lock=shared, algorithm=copy;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
set debug_sync= 'now WAIT_FOR locked';
# Check that S, SH and SR locks are compatible with it.
handler t1 open;
@@ -531,44 +522,44 @@ column_name
c1
select count(*) from t1;
count(*)
-5
+4
# Check that SW lock is incompatible with SNW lock.
# Sending:
delete from t1 limit 2;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above DELETE is blocked because of SNW lock.
# Unblock ALTER and thus DELETE.
set debug_sync= 'now SIGNAL finish';
#
-# Switching to connection 'default'.
+connection default;
# Reaping ALTER TABLE.
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping DELETE.
#
-# Switching to connection 'default'.
+connection default;
set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish';
# Sending:
alter table t1 add primary key (c1), lock=shared, algorithm=copy;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
set debug_sync= 'now WAIT_FOR locked';
# Check that SU lock is incompatible with SNW lock.
# Sending:
alter table t1 add primary key (c1);;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above ALTER is blocked because of SNW lock.
# Unblock ALTERs.
set debug_sync= 'now SIGNAL finish';
#
-# Switching to connection 'default'.
+connection default;
# Reaping first ALTER TABLE.
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping another ALTER TABLE.
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
#
@@ -576,52 +567,52 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
# SNW is only used by ALTER TABLE after upgrading from SU
# and SU is also incompatible with SNW.
#
-# Switching to connection 'default'.
+connection default;
set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish';
# Sending:
alter table t1 add primary key (c1), lock=shared, algorithm=copy;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
set debug_sync= 'now WAIT_FOR locked';
# Check that SNRW lock is incompatible with SNW lock.
# Sending:
lock table t1 write;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above LOCK TABLES is blocked because of SNW lock.
# Unblock ALTER and thus LOCK TABLES.
set debug_sync= 'now SIGNAL finish';
#
-# Switching to connection 'default'.
+connection default;
# Reaping ALTER TABLE.
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping LOCK TABLES
insert into t1 values (1);
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish';
# Sending:
alter table t1 add primary key (c1), algorithm=copy, lock=shared;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
set debug_sync= 'now WAIT_FOR locked';
# Check that X lock is incompatible with SNW lock.
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above RENAME is blocked because of SNW lock.
# Unblock ALTER and thus RENAME TABLE.
set debug_sync= 'now SIGNAL finish';
#
-# Switching to connection 'default'.
+connection default;
# Reaping ALTER TABLE.
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping RENAME TABLE
# Revert back to original state of things.
rename table t2 to t1;
@@ -630,7 +621,7 @@ rename table t2 to t1;
# blocked by presence of another SNW lock because SNW/SNRW is
# incompatible with SNW anyway.
#
-# Switching to connection 'default'.
+connection default;
#
#
# 7) Acquire SNRW lock on the table.
@@ -638,10 +629,8 @@ rename table t2 to t1;
#
lock table t1 write;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that S and SH 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';
column_name
@@ -650,46 +639,46 @@ c1
# Sending:
select count(*) from t1;;
#
-# Switching to connection 'default'.
+connection default;
# Check that the above SELECT is blocked because of SNRW lock.
# Unblock SELECT.
unlock tables;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping SELECT.
count(*)
-4
+3
#
-# Switching to connection 'default'.
+connection default;
lock table t1 write;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that SW lock is incompatible with SNRW lock.
# Sending:
delete from t1 limit 1;;
#
-# Switching to connection 'default'.
+connection default;
# Check that the above DELETE is blocked because of SNRW lock.
# Unblock DELETE.
unlock tables;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping DELETE.
#
-# Switching to connection 'default'.
+connection default;
lock table t1 write;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that SU lock is incompatible with SNRW lock.
# Sending:
alter table t1 add primary key (c1);;
#
-# Switching to connection 'default'.
+connection default;
# Check that the above ALTER is blocked because of SNRW lock.
# Unblock ALTER.
unlock tables;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping ALTER TABLE.
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
#
@@ -697,38 +686,38 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
# SNW is only used by ALTER TABLE after upgrading from SU
# and SU is also incompatible with SNRW.
#
-# Switching to connection 'default'.
+connection default;
lock table t1 write;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that SNRW lock is incompatible with SNRW lock.
# Sending:
lock table t1 write;;
#
-# Switching to connection 'default'.
+connection default;
# Check that the above LOCK TABLES is blocked because of SNRW lock.
# Unblock waiting LOCK TABLES.
unlock tables;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping LOCK TABLES
insert into t1 values (1);
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
lock table t1 write;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that X lock is incompatible with SNRW lock.
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'default'.
+connection default;
# Check that the above RENAME is blocked because of SNRW lock.
# Unblock RENAME TABLE
unlock tables;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping RENAME TABLE
# Revert back to original state of things.
rename table t2 to t1;
@@ -737,7 +726,7 @@ rename table t2 to t1;
# blocked by presence of another SNRW lock because SNW/SNRW is
# incompatible with SNRW anyway.
#
-# Switching to connection 'default'.
+connection default;
#
#
# 8) Now do the same round of tests for X lock. We use additional
@@ -745,144 +734,144 @@ rename table t2 to t1;
#
create table t2 (c1 int);
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Take a lock on t2, so RENAME TABLE t1 TO t2 will get blocked
# after acquiring X lock on t1.
lock tables t2 read;
#
-# Switching to connection 'default'.
+connection default;
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that RENAME has acquired X lock on t1 and is waiting for t2.
# Check that S lock in incompatible with X lock.
# Sending:
handler t1 open;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above HANDLER statement is blocked because of X lock.
# Unblock RENAME TABLE
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
# Reaping RENAME TABLE.
ERROR 42S01: Table 't2' already exists
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping HANDLER.
handler t1 close;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Prepare for blocking RENAME TABLE.
lock tables t2 read;
#
-# Switching to connection 'default'.
+connection default;
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that RENAME has acquired X lock on t1 and is waiting for t2.
# Check that SH lock in incompatible with X lock.
# Sending:
select column_name from information_schema.columns where table_schema='test' and table_name='t1';;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above SELECT ... FROM I_S ... statement is blocked
# because of X lock.
# Unblock RENAME TABLE
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
# Reaping RENAME TABLE.
ERROR 42S01: Table 't2' already exists
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping SELECT ... FROM I_S.
column_name
c1
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Prepare for blocking RENAME TABLE.
lock tables t2 read;
#
-# Switching to connection 'default'.
+connection default;
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that RENAME has acquired X lock on t1 and is waiting for t2.
# Check that SR lock in incompatible with X lock.
# Sending:
select count(*) from t1;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above SELECT statement is blocked
# because of X lock.
# Unblock RENAME TABLE
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
# Reaping RENAME TABLE.
ERROR 42S01: Table 't2' already exists
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping SELECT.
count(*)
-4
+3
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Prepare for blocking RENAME TABLE.
lock tables t2 read;
#
-# Switching to connection 'default'.
+connection default;
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that RENAME has acquired X lock on t1 and is waiting for t2.
# Check that SW lock in incompatible with X lock.
# Sending:
delete from t1 limit 1;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above DELETE statement is blocked
# because of X lock.
# Unblock RENAME TABLE
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
# Reaping RENAME TABLE.
ERROR 42S01: Table 't2' already exists
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping DELETE.
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Prepare for blocking RENAME TABLE.
lock tables t2 read;
#
-# Switching to connection 'default'.
+connection default;
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that RENAME has acquired X lock on t1 and is waiting for t2.
# Check that SU lock is incompatible with X lock.
# Sending:
alter table t1 add primary key (c1);;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above ALTER statement is blocked
# because of X lock.
# Unblock RENAME TABLE
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
# Reaping RENAME TABLE
ERROR 42S01: Table 't2' already exists
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping ALTER.
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
#
@@ -890,59 +879,59 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
# SNW is only used by ALTER TABLE after upgrading from SU
# and SU is also incompatible with X.
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Prepare for blocking RENAME TABLE.
lock tables t2 read;
#
-# Switching to connection 'default'.
+connection default;
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that RENAME has acquired X lock on t1 and is waiting for t2.
# Check that SNRW lock is incompatible with X lock.
# Sending:
lock table t1 write;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above LOCK TABLE statement is blocked
# because of X lock.
# Unblock RENAME TABLE
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
# Reaping RENAME TABLE
ERROR 42S01: Table 't2' already exists
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping LOCK TABLE.
unlock tables;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Prepare for blocking RENAME TABLE.
lock tables t2 read;
#
-# Switching to connection 'default'.
+connection default;
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that RENAME has acquired X lock on t1 and is waiting for t2.
# Check that X lock is incompatible with X lock.
# Sending:
rename table t1 to t3;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above RENAME statement is blocked
# because of X lock.
# Unblock RENAME TABLE
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
# Reaping RENAME TABLE
ERROR 42S01: Table 't2' already exists
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping RENAME.
rename table t3 to t1;
#
@@ -954,7 +943,7 @@ rename table t3 to t1;
# even stronger active or pending lock.
#
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
#
# 1) Check compatibility for pending SNW lock.
#
@@ -962,12 +951,12 @@ rename table t3 to t1;
begin;
insert into t1 values (1);
#
-# Switching to connection 'default'.
+connection default;
# Add pending SNW lock.
# Sending:
alter table t1 add primary key (c1);;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that ALTER TABLE is waiting with pending SNW lock.
# Check that S, SH and SR locks are compatible with pending SNW
handler t1 open t;
@@ -978,28 +967,28 @@ column_name
c1
select count(*) from t1;
count(*)
-4
+3
# Check that SW is incompatible with pending SNW
# Sending:
delete from t1 limit 1;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above DELETE is blocked because of pending SNW lock.
# Unblock ALTER TABLE.
commit;
#
-# Switching to connection 'default'.
+connection default;
# Reaping ALTER.
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping DELETE.
#
# We can't do similar check for SNW, SNRW and X locks because
# they will also be blocked by active SW lock.
#
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
#
# 2) Check compatibility for pending SNRW lock.
#
@@ -1007,18 +996,16 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
begin;
select count(*) from t1;
count(*)
-3
+2
#
-# Switching to connection 'default'.
+connection default;
# Add pending SNRW lock.
# Sending:
lock table t1 write;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that LOCK TABLE is waiting with pending SNRW lock.
# Check that S and SH locks are compatible with pending SNRW
-handler t1 open t;
-handler t close;
select column_name from information_schema.columns where
table_schema='test' and table_name='t1';
column_name
@@ -1027,72 +1014,72 @@ c1
# Sending:
select count(*) from t1;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above SELECT is blocked because of pending SNRW lock.
# Unblock LOCK TABLE.
commit;
#
-# Switching to connection 'default'.
+connection default;
# Reaping LOCK TABLE.
unlock tables;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping SELECT.
count(*)
-3
+2
# Restore pending SNRW lock.
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
begin;
select count(*) from t1;
count(*)
-3
+2
#
-# Switching to connection 'default'.
+connection default;
# Sending:
lock table t1 write;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that LOCK TABLE is waiting with pending SNRW lock.
# Check that SW is incompatible with pending SNRW
# Sending:
insert into t1 values (1);;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above INSERT is blocked because of pending SNRW lock.
# Unblock LOCK TABLE.
commit;
#
-# Switching to connection 'default'.
+connection default;
# Reaping LOCK TABLE.
unlock tables;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping INSERT.
# Restore pending SNRW lock.
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
begin;
select count(*) from t1;
count(*)
-4
+3
#
-# Switching to connection 'default'.
+connection default;
# Sending:
lock table t1 write;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that LOCK TABLE is waiting with pending SNRW lock.
# Check that SNW is compatible with pending SNRW
# So ALTER TABLE statements are not starved by LOCK TABLEs.
alter table t1 add primary key (c1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Unblock LOCK TABLE.
commit;
#
-# Switching to connection 'default'.
+connection default;
# Reaping LOCK TABLE.
unlock tables;
#
@@ -1100,7 +1087,7 @@ unlock tables;
# they will also be blocked by active SR lock.
#
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
#
# 3) Check compatibility for pending X lock.
#
@@ -1108,14 +1095,14 @@ unlock tables;
begin;
select count(*) from t1;
count(*)
-4
+3
#
-# Switching to connection 'default'.
+connection default;
# Add pending X lock.
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that RENAME TABLE is waiting with pending X lock.
# Check that SH locks are compatible with pending X
select column_name from information_schema.columns where
@@ -1126,143 +1113,143 @@ c1
# Sending:
handler t1 open;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above HANDLER OPEN is blocked because of pending X lock.
# Unblock RENAME TABLE.
commit;
#
-# Switching to connection 'default'.
+connection default;
# Reaping RENAME TABLE.
ERROR 42S01: Table 't2' already exists
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping HANDLER t1 OPEN.
handler t1 close;
# Restore pending X lock.
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
begin;
select count(*) from t1;
count(*)
-4
+3
#
-# Switching to connection 'default'.
+connection default;
# Add pending X lock.
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that RENAME TABLE is waiting with pending X lock.
# Check that SR is incompatible with pending X
# Sending:
select count(*) from t1;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above SELECT is blocked because of pending X lock.
# Unblock RENAME TABLE.
commit;
#
-# Switching to connection 'default'.
+connection default;
# Reaping RENAME TABLE.
ERROR 42S01: Table 't2' already exists
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping SELECT.
count(*)
-4
+3
# Restore pending X lock.
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
begin;
select count(*) from t1;
count(*)
-4
+3
#
-# Switching to connection 'default'.
+connection default;
# Add pending X lock.
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that RENAME TABLE is waiting with pending X lock.
# Check that SW is incompatible with pending X
# Sending:
delete from t1 limit 1;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above DELETE is blocked because of pending X lock.
# Unblock RENAME TABLE.
commit;
#
-# Switching to connection 'default'.
+connection default;
# Reaping RENAME TABLE.
ERROR 42S01: Table 't2' already exists
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping DELETE.
# Restore pending X lock.
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
begin;
select count(*) from t1;
count(*)
-3
+2
#
-# Switching to connection 'default'.
+connection default;
# Add pending X lock.
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that RENAME TABLE is waiting with pending X lock.
# Check that SNW is incompatible with pending X
# Sending:
alter table t1 add primary key (c1);;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above ALTER TABLE is blocked because of pending X lock.
# Unblock RENAME TABLE.
commit;
#
-# Switching to connection 'default'.
+connection default;
# Reaping RENAME TABLE.
ERROR 42S01: Table 't2' already exists
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping ALTER TABLE.
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
# Restore pending X lock.
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
handler t1 open;
#
-# Switching to connection 'default'.
+connection default;
# Add pending X lock.
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that RENAME TABLE is waiting with pending X lock.
# Check that SNRW is incompatible with pending X
# Sending:
lock table t1 write;;
#
-# Switching to connection 'mdl_con3'.
+connection mdl_con3;
# Check that the above LOCK TABLES is blocked because of pending X lock.
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Unblock RENAME TABLE.
handler t1 close;
#
-# Switching to connection 'default'.
+connection default;
# Reaping RENAME TABLE.
ERROR 42S01: Table 't2' already exists
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reaping LOCK TABLES.
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
#
#
# C) Now let us test how type-of-operation locks are handled in
@@ -1281,9 +1268,9 @@ unlock tables;
begin;
select count(*) from t1;
count(*)
-3
+2
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Create an active SNW lock on t2.
# We have to use DEBUG_SYNC facility as otherwise SNW lock
# will be immediately released (or upgraded to X lock).
@@ -1292,7 +1279,7 @@ set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR fini
# Sending:
alter table t2 add primary key (c1), algorithm=copy, lock=shared;;
#
-# Switching to connection 'default'.
+connection default;
set debug_sync= 'now WAIT_FOR locked';
# SR lock should be acquired without any waiting.
select count(*) from t2;
@@ -1303,20 +1290,20 @@ commit;
begin;
select count(*) from t1;
count(*)
-3
+2
# Sending:
insert into t2 values (1);;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above INSERT is blocked.
# Unblock ALTER TABLE and thus INSERT.
set debug_sync= 'now SIGNAL finish';
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reap ALTER TABLE.
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
#
-# Switching to connection 'default'.
+connection default;
# Reap INSERT.
commit;
#
@@ -1329,36 +1316,36 @@ commit;
begin;
select count(*) from t1;
count(*)
-3
+2
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Create an active SNW lock on t1.
set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish';
# Sending:
alter table t1 add primary key (c1), algorithm=copy, lock=shared;;
#
-# Switching to connection 'default'.
+connection default;
set debug_sync= 'now WAIT_FOR locked';
# We should still be able to get SR lock without waiting.
select count(*) from t1;
count(*)
-3
+2
# Since the above ALTER TABLE is not upgrading SNW lock to X by waiting
# for SW lock we won't create deadlock.
# So the below INSERT should not end-up with ER_LOCK_DEADLOCK error.
# Sending:
insert into t1 values (1);;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above INSERT is blocked.
# Unblock ALTER TABLE and thus INSERT.
set debug_sync= 'now SIGNAL finish';
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reap ALTER TABLE.
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
#
-# Switching to connection 'default'.
+connection default;
# Reap INSERT.
commit;
#
@@ -1369,26 +1356,26 @@ commit;
begin;
insert into t1 values (1);
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Create pending SNW lock on t1.
# Sending:
alter table t1 add primary key (c1);;
#
-# Switching to connection 'default'.
+connection default;
# Wait until ALTER TABLE starts waiting for SNW lock.
# We should still be able to get both SW and SR locks without waiting.
select count(*) from t1;
count(*)
-5
+4
delete from t1 limit 1;
# Unblock ALTER TABLE.
commit;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reap ALTER TABLE.
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
#
-# Switching to connection 'default'.
+connection default;
#
# 2) Now similar tests for active SNW lock which is being upgraded
# to X lock.
@@ -1398,9 +1385,9 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
begin;
select count(*) from t1;
count(*)
-4
+3
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Start transaction which will prevent SNW -> X upgrade from
# completing immediately.
begin;
@@ -1408,26 +1395,26 @@ select count(*) from t2;
count(*)
3
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Create SNW lock pending upgrade to X on t2.
# Sending:
alter table t2 add column c2 int;;
#
-# Switching to connection 'default'.
+connection default;
# Wait until ALTER TABLE starts waiting X lock.
# Check that attempt to acquire SR lock on t2 causes waiting.
# Sending:
select count(*) from t2;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above SELECT is blocked.
# Unblock ALTER TABLE.
commit;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reap ALTER TABLE.
#
-# Switching to connection 'default'.
+connection default;
# Reap SELECT.
count(*)
3
@@ -1436,9 +1423,9 @@ commit;
begin;
select count(*) from t1;
count(*)
-4
+3
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Start transaction which will prevent SNW -> X upgrade from
# completing immediately.
begin;
@@ -1446,26 +1433,26 @@ select count(*) from t2;
count(*)
3
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Create SNW lock pending upgrade to X on t2.
# Sending:
alter table t2 drop column c2;;
#
-# Switching to connection 'default'.
+connection default;
# Wait until ALTER TABLE starts waiting X lock.
# Check that attempt to acquire SW lock on t2 causes waiting.
# Sending:
insert into t2 values (1);;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above INSERT is blocked.
# Unblock ALTER TABLE.
commit;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reap ALTER TABLE.
#
-# Switching to connection 'default'.
+connection default;
# Reap INSERT.
commit;
#
@@ -1475,19 +1462,19 @@ commit;
begin;
select count(*) from t1;
count(*)
-4
+3
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Create SNW lock pending upgrade to X.
# Sending:
alter table t1 add column c2 int;;
#
-# Switching to connection 'default'.
+connection default;
# Wait until ALTER TABLE starts waiting X lock.
# Check that transaction is still able to acquire SR lock.
select count(*) from t1;
count(*)
-4
+3
# Waiting trying to acquire SW lock will cause deadlock and
# therefore should cause an error.
delete from t1 limit 1;
@@ -1495,10 +1482,10 @@ ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
# Unblock ALTER TABLE.
commit;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reap ALTER TABLE.
#
-# Switching to connection 'default'.
+connection default;
#
# 3) Check how various locks used within transactional context
# interact with active/pending SNRW lock.
@@ -1508,23 +1495,23 @@ commit;
begin;
select count(*) from t1;
count(*)
-4
+3
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
lock table t2 write;
#
-# Switching to connection 'default'.
+connection default;
# Attempt to acquire SR should be blocked. It should
# not cause errors as it does not creates deadlock.
# Sending:
select count(*) from t2;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that the above SELECT is blocked
# Unblock SELECT.
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
# Reap SELECT.
count(*)
4
@@ -1533,23 +1520,23 @@ commit;
begin;
select count(*) from t1;
count(*)
-4
+3
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
lock table t2 write;
#
-# Switching to connection 'default'.
+connection default;
# Again attempt to acquire SW should be blocked and should
# not cause any errors.
# Sending:
delete from t2 limit 1;;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Check that the above DELETE is blocked
# Unblock DELETE.
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
# Reap DELETE.
commit;
#
@@ -1562,18 +1549,18 @@ commit;
begin;
select count(*) from t1;
count(*)
-4
+3
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Sending:
lock table t1 write;;
#
-# Switching to connection 'default'.
+connection default;
# Wait until LOCK TABLE is blocked creating pending request for X lock.
# Check that another instance of SR lock is granted without waiting.
select count(*) from t1;
count(*)
-4
+3
# Attempt to wait for SW lock will lead to deadlock, thus
# the below statement should end with ER_LOCK_DEADLOCK error.
delete from t1 limit 1;
@@ -1581,37 +1568,37 @@ ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
# Unblock LOCK TABLES.
commit;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reap LOCK TABLES.
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
#
# **) Now case when transaction has a SW lock.
#
begin;
delete from t1 limit 1;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Sending:
lock table t1 write;;
#
-# Switching to connection 'default'.
+connection default;
# Wait until LOCK TABLE is blocked creating pending request for X lock.
# Check that both SR and SW locks are granted without waiting
# and errors.
select count(*) from t1;
count(*)
-3
+2
insert into t1 values (1, 1);
# Unblock LOCK TABLES.
commit;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reap LOCK TABLES.
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
#
# 4) Check how various locks used within transactional context
# interact with active/pending X lock.
@@ -1621,9 +1608,9 @@ unlock tables;
begin;
select count(*) from t1;
count(*)
-4
+3
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Start transaction which will prevent X lock from going away
# immediately.
begin;
@@ -1631,26 +1618,26 @@ select count(*) from t2;
count(*)
3
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Create pending X lock on t2.
# Sending:
rename table t2 to t3;;
#
-# Switching to connection 'default'.
+connection default;
# Wait until RENAME TABLE starts waiting with pending X lock.
# Check that attempt to acquire SR lock on t2 causes waiting.
# Sending:
select count(*) from t2;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above SELECT is blocked.
# Unblock RENAME TABLE.
commit;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reap RENAME TABLE.
#
-# Switching to connection 'default'.
+connection default;
# Reap SELECT.
ERROR 42S02: Table 'test.t2' doesn't exist
commit;
@@ -1659,9 +1646,9 @@ rename table t3 to t2;
begin;
select count(*) from t1;
count(*)
-4
+3
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Start transaction which will prevent X lock from going away
# immediately.
begin;
@@ -1669,26 +1656,26 @@ select count(*) from t2;
count(*)
3
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Create pending X lock on t2.
# Sending:
rename table t2 to t3;;
#
-# Switching to connection 'default'.
+connection default;
# Wait until RENAME TABLE starts waiting with pending X lock.
# Check that attempt to acquire SW lock on t2 causes waiting.
# Sending:
delete from t2 limit 1;;
#
-# Switching to connection 'mdl_con2'.
+connection mdl_con2;
# Check that the above DELETE is blocked.
# Unblock RENAME TABLE.
commit;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reap RENAME TABLE.
#
-# Switching to connection 'default'.
+connection default;
# Reap DELETE.
ERROR 42S02: Table 'test.t2' doesn't exist
commit;
@@ -1703,18 +1690,18 @@ rename table t3 to t2;
begin;
select count(*) from t1;
count(*)
-4
+3
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'default'.
+connection default;
# Wait until RENAME TABLE is blocked creating pending request for X lock.
# Check that another instance of SR lock is granted without waiting.
select count(*) from t1;
count(*)
-4
+3
# Attempt to wait for SW lock will lead to deadlock, thus
# the below statement should end with ER_LOCK_DEADLOCK error.
delete from t1 limit 1;
@@ -1722,184 +1709,53 @@ ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
# Unblock RENAME TABLE.
commit;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reap RENAME TABLE.
ERROR 42S01: Table 't2' already exists
#
-# Switching to connection 'default'.
+connection default;
#
# **) The second case is when transaction has a SW lock.
#
begin;
delete from t1 limit 1;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Sending:
rename table t1 to t2;;
#
-# Switching to connection 'default'.
+connection default;
# Wait until RENAME TABLE is blocked creating pending request for X lock.
# Check that both SR and SW locks are granted without waiting
# and errors.
select count(*) from t1;
count(*)
-3
+2
insert into t1 values (1, 1);
# Unblock RENAME TABLE.
commit;
#
-# Switching to connection 'mdl_con1'.
+connection mdl_con1;
# Reap RENAME TABLE.
ERROR 42S01: Table 't2' already exists
#
-# Switching to connection 'default'.
+connection default;
# Clean-up.
+disconnect mdl_con1;
+disconnect mdl_con2;
+disconnect mdl_con3;
set debug_sync= 'RESET';
drop table t1, t2;
#
-# Additional coverage for some scenarios in which not quite
-# correct use of S metadata locks by HANDLER statement might
-# have caused deadlocks.
-#
-drop table if exists t1, t2;
-create table t1 (i int);
-create table t2 (j int);
-insert into t1 values (1);
-#
-# First, check scenario in which we upgrade SNRW lock to X lock
-# on a table while having HANDLER READ trying to acquire TL_READ
-# on the same table.
-#
-handler t1 open;
-#
-# Switching to connection 'handler_con1'.
-lock table t1 write;
-# Upgrade SNRW to X lock.
-# Sending:
-alter table t1 add column j int;;
-#
-# Switching to connection 'handler_con2'.
-# Wait until ALTER is blocked during upgrade.
-#
-# Switching to connection 'default'.
-# The below statement should not cause deadlock.
-handler t1 read first;;
-#
-# Switching to connection 'handler_con1'.
-# Reap ALTER TABLE.
-unlock tables;
-#
-# Switching to connection 'default'.
-# Reap HANDLER READ.
-i j
-1 NULL
-handler t1 close;
-#
-# Now, check scenario in which upgrade of SNRW lock to X lock
-# can be blocked by HANDLER which is open in connection currently
-# waiting to get table-lock owned by connection doing upgrade.
-#
-handler t1 open;
-#
-# Switching to connection 'handler_con1'.
-lock table t1 write, t2 read;
-#
-# Switching to connection 'default'.
-# Execute statement which will be blocked on table-level lock
-# owned by connection 'handler_con1'.
-# Sending:
-insert into t2 values (1);;
-#
-# Switching to connection 'handler_con1'.
-# Wait until INSERT is blocked on table-level lock.
-# Sending 'alter table t1 drop column j'. It should not cause
-# deadlock.
-alter table t1 drop column j;
-# Switching to connection 'handler_con2'.
-# Wait until ALTER is blocked during upgrade.
-#
-# Switching to connection 'default'.
-# Reap INSERT.
-ERROR HY000: Wait on a lock was aborted due to a pending exclusive lock
-handler t1 close;
-#
-# Switching to connection 'handler_con1'.
-# Reaping 'alter table t1 drop column j'
-unlock tables;
-# Switching to connection 'default'.
-# Then, check the scenario in which upgrade of SNRW lock to X
-# lock is blocked by HANDLER which is open in connection currently
-# waiting to get SW lock on the same table.
-#
-handler t1 open;
-#
-# Switching to connection 'handler_con1'.
-lock table t1 write;
-#
-# Switching to connection 'default'.
-# The below insert should be blocked because active SNRW lock on 't1'.
-# Sending:
-insert into t1 values (1);;
-#
-# Switching to connection 'handler_con1'.
-# Wait until INSERT is blocked because of SNRW lock.
-# The below ALTER TABLE will be blocked because of presence of HANDLER.
-# Sending:
-alter table t1 add column j int;;
-#
-# Switching to connection 'default'.
-# INSERT should be chosen as victim for resolving deadlock.
-# Reaping INSERT.
-ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
-# Close HANDLER to unblock ALTER TABLE.
-handler t1 close;
-#
-# Switching to connection 'handler_con1'.
-# Reaping ALTER TABLE.
-unlock tables;
-#
-# Switching to connection 'default'.
-#
-# Finally, test in which upgrade of SNRW lock to X lock is blocked
-# by HANDLER which is open in connection currently waiting to get
-# SR lock on the table on which lock is upgraded.
-#
-handler t1 open;
-#
-# Switching to connection 'handler_con1'.
-lock table t1 write, t2 write;
-#
-# Switching to connection 'default'.
-# The below insert should be blocked because active SNRW lock on 't1'.
-# Sending:
-insert into t2 values (1);;
-#
-# Switching to connection 'handler_con1'.
-# Wait until INSERT is blocked because of SNRW lock.
-# The below ALTER TABLE will be blocked because of presence of HANDLER.
-# Sending:
-alter table t1 drop column j;;
-#
-# Switching to connection 'default'.
-# INSERT should be chosen as victim for resolving deadlock.
-# Reaping INSERT.
-ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
-# Close HANDLER to unblock ALTER TABLE.
-handler t1 close;
-#
-# Switching to connection 'handler_con1'.
-# Reaping ALTER TABLE.
-unlock tables;
-#
-# Switching to connection 'default'.
-# Clean-up.
-drop tables t1, t2;
-#
# Test coverage for basic deadlock detection in metadata
# locking subsystem.
#
drop tables if exists t0, t1, t2, t3, t4, t5;
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);
@@ -1908,19 +1764,19 @@ create table t4 (k int);
# Test for the case in which no deadlock occurs.
#
#
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
begin;
insert into t1 values (1);
#
-# Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
begin;
insert into t2 values (1);
#
-# Switching to connection 'default'.
+connection default;
# Send:
rename table t2 to t0, t3 to t2, t0 to t3;;
#
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
# Wait until the above RENAME TABLE is blocked because it has to wait
# for 'deadlock_con2' which holds shared metadata lock on 't2'.
# The below statement should wait for exclusive metadata lock
@@ -1929,21 +1785,21 @@ rename table t2 to t0, t3 to t2, t0 to t3;;
# Send:
select * from t2;;
#
-# Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
# Wait until the above SELECT * FROM t2 is starts waiting
# for an exclusive metadata lock to go away.
#
# Unblock RENAME TABLE by releasing shared metadata lock on t2.
commit;
#
-# Switching to connection 'default'.
+connection default;
# Reap RENAME TABLE.
#
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
# Reap SELECT.
k
#
-# Switching to connection 'default'.
+connection default;
#
# Let us check that in the process of waiting for conflicting lock
# on table 't2' to go away transaction in connection 'deadlock_con1'
@@ -1951,28 +1807,28 @@ k
# Send:
rename table t1 to t0, t3 to t1, t0 to t3;;
#
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
# Wait until the above RENAME TABLE is blocked because it has to wait
# for 'deadlock_con1' which should still hold shared metadata lock on
# table 't1'.
# Commit transaction to unblock RENAME TABLE.
commit;
#
-# Switching to connection 'default'.
+connection default;
# Reap RENAME TABLE.
#
# Test for case when deadlock occurs and should be detected immediately.
#
#
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
begin;
insert into t2 values (2);
#
-# Switching to connection 'default'.
+connection default;
# Send:
rename table t2 to t0, t1 to t2, t0 to t1;;
#
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
# Wait until the above RENAME TABLE is blocked because it has to wait
# for 'deadlock_con1' which holds shared metadata lock on 't2'.
#
@@ -1982,50 +1838,50 @@ rename table t2 to t0, t1 to t2, t0 to t1;;
select * from t1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
#
-# Switching to connection 'default'.
+connection default;
# Reap RENAME TABLE.
#
# Test for the case in which deadlock also occurs but not immediately.
#
#
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
begin;
insert into t2 values (1);
#
-# Switching to connection 'default'.
+connection default;
lock table t1 write;
#
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
# The below SELECT statement should wait for metadata lock
# on table 't1' and should not produce ER_LOCK_DEADLOCK
# immediately as no deadlock is possible at the moment.
select * from t1;;
#
-# Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
# Wait until the above SELECT * FROM t1 is starts waiting
# for an UNRW metadata lock to go away.
# Send RENAME TABLE statement that will deadlock with the
# SELECT statement and thus should abort the latter.
rename table t1 to t0, t2 to t1, t0 to t2;;
#
-# Switching to connection 'default'.
+connection default;
# Wait till above RENAME TABLE is blocked while holding
# pending X lock on t1.
# Allow the above RENAME TABLE to acquire lock on t1 and
# create pending lock on t2 thus creating deadlock.
unlock tables;
#
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
# Since the latest RENAME TABLE entered in deadlock with SELECT
# statement the latter should be aborted and emit ER_LOCK_DEADLOCK
# error and transaction should be rolled back.
# Reap SELECT * FROM t1.
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
#
-# Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
# Reap RENAME TABLE ... .
#
-# Switching to connection 'default'.
+connection default;
drop tables t1, t2, t3, t4;
#
# Now, test case which shows that deadlock detection empiric
@@ -2040,17 +1896,17 @@ select * from t1;
i
1
#
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
begin;
select * from t1;
i
1
#
-# Switching to connection 'default'.
+connection default;
# Send:
alter table t1 add column j int, rename to t2;;
#
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
# Wait until the above ALTER TABLE ... RENAME acquires exclusive
# metadata lock on 't2' and starts waiting for connection
# 'deadlock_con1' which holds shared lock on 't1'.
@@ -2060,7 +1916,7 @@ alter table t1 add column j int, rename to t2;;
select * from t2;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
#
-# Switching to connection 'default'.
+connection default;
# Reap ALTER TABLE ... RENAME.
drop table t2;
#
@@ -2079,23 +1935,23 @@ set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
# Sending:
select * from t2, t1;
#
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
# Wait till SELECT acquires MDL on 't2' and starts waiting for signal.
set debug_sync= 'now WAIT_FOR locked';
# Sending:
lock tables t1 write, t2 write;
#
-# Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
# Wait until LOCK TABLES acquires SNRW lock on 't1' and is blocked
# while trying to acquire SNRW lock on 't1'.
# Resume SELECT execution, this should eventually unblock LOCK TABLES.
set debug_sync= 'now SIGNAL finish';
#
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
# Reaping LOCK TABLES.
unlock tables;
#
-# Switching to connection 'default'.
+connection default;
# Reaping SELECT. It succeed and not report ER_LOCK_DEADLOCK error.
j i
drop tables t1, t2;
@@ -2110,7 +1966,7 @@ set debug_sync='alter_table_copy_after_lock_upgrade SIGNAL parked1 WAIT_FOR go1'
# Sending:
alter table t1 add column j int;
#
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
# Wait till ALTER acquires SNW lock and stops.
set debug_sync='now WAIT_FOR parked1';
# Ensure that INSERT is paused once it detects that there is
@@ -2120,7 +1976,7 @@ set debug_sync='mdl_acquire_lock_wait SIGNAL parked2 WAIT_FOR go2';
# Sending:
insert into t1 values ();
#
-# Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
# Wait till INSERT is paused.
set debug_sync='now WAIT_FOR parked2';
# Resume ALTER execution. Eventually it will release its
@@ -2128,13 +1984,13 @@ set debug_sync='now WAIT_FOR parked2';
# satisified.
set debug_sync='now SIGNAL go1';
#
-# Switching to connection 'default'.
+connection default;
# Reaping ALTER TABLE.
# Add a new request for SNW lock to waiting graph.
# Sending:
alter table t1 drop column j;
#
-# Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
# Wait until ALTER is blocked.
# Resume INSERT so it can start deadlock detection.
#
@@ -2148,10 +2004,10 @@ alter table t1 drop column j;
# and ended with ER_LOCK_DEADLOCK error.
set debug_sync='now SIGNAL go2';
#
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
# Reaping INSERT.
#
-# Switching to connection 'default'.
+connection default;
# Reaping ALTER. It should succeed and not produce ER_LOCK_DEADLOCK.
drop table t1;
#
@@ -2167,30 +2023,30 @@ create table t2(j int);
# waits in MDL and TDC.
#
set debug_sync= 'RESET';
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
# Start a statement, which will acquire SR metadata lock on t1, open it
# 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';
# Sending:
select * from t1 where i in (select j from t2 for update);
-# Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
# Wait till the above SELECT stops.
set debug_sync='now WAIT_FOR parked';
# The below FLUSH TABLES WITH READ LOCK should acquire
# SNW locks on t1 and t2 and wait till SELECT closes t1.
# Sending:
flush tables t1, t2 with read lock;
-# Switching to connection 'deadlock_con3'.
+connection deadlock_con3;
# Wait until FLUSH TABLES WITH t1, t2 READ LOCK starts waiting
# for SELECT to close t1.
# Resume SELECT, so it tries to acquire SW lock on t1 and blocks,
# creating a deadlock. This deadlock should be detected and resolved
# by backing-off SELECT. As a result FTWRL should be able to finish.
set debug_sync='now SIGNAL go';
-# Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
# Reap FLUSH TABLES WITH READ LOCK.
unlock tables;
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
# Reap SELECT.
i
#
@@ -2199,29 +2055,29 @@ i
# for flush waits is important.
#
set debug_sync= 'RESET';
-# Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
set debug_sync='flush_tables_with_read_lock_after_acquire_locks SIGNAL parked WAIT_FOR go';
# The below FLUSH TABLES WITH READ LOCK should acquire
# SNW locks on t1 and t2 and wait on debug sync point.
# Sending:
flush tables t1, t2 with read lock;
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
# Wait till FLUSH TABLE WITH READ LOCK stops.
set debug_sync='now WAIT_FOR parked';
# Start statement which will acquire SR metadata lock on t1, open
# it and then will block while trying to acquire SW lock on t2.
# Sending:
select * from t1 where i in (select j from t2 for update);
-# Switching to connection 'deadlock_con3'.
+connection deadlock_con3;
# Wait till the above SELECT blocks.
# Resume FLUSH TABLES, so it tries to flush t1, thus creating
# a deadlock. This deadlock should be detected and resolved by
# backing-off SELECT. As a result FTWRL should be able to finish.
set debug_sync='now SIGNAL go';
-# Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
# Reap FLUSH TABLES WITH READ LOCK.
unlock tables;
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
# Reap SELECT.
i
#
@@ -2229,81 +2085,89 @@ i
# waiting for MDL and one for TDC.
#
set debug_sync= 'RESET';
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
# Start a statement which will acquire SR metadata lock on t2, open it
# 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';
# Sending:
select * from t2, t1;
-# Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
# Wait till the above SELECT stops.
set debug_sync='now WAIT_FOR parked';
# The below FLUSH TABLES WITH READ LOCK should acquire
# SNW locks on t2 and wait till SELECT closes t2.
# Sending:
flush tables t2 with read lock;
-# Switching to connection 'deadlock_con3'.
+connection deadlock_con3;
# Wait until FLUSH TABLES WITH READ LOCK starts waiting
# for SELECT to close t2.
# The below DROP TABLES should acquire X lock on t1 and start
# waiting for X lock on t2.
# Sending:
drop tables t1, t2;
-# Switching to connection 'default'.
+connection default;
# Wait until DROP TABLES starts waiting for X lock on t2.
# Resume SELECT, so it tries to acquire SR lock on t1 and blocks,
# creating a deadlock. This deadlock should be detected and resolved
# by backing-off SELECT. As a result, FTWRL should be able to finish.
set debug_sync='now SIGNAL go';
-# Switching to connection 'deadlock_con2'.
+connection deadlock_con2;
# Reap FLUSH TABLES WITH READ LOCK.
# Unblock DROP TABLES.
unlock tables;
-# Switching to connection 'deadlock_con3'.
+connection deadlock_con3;
# Reap DROP TABLES.
-# Switching to connection 'deadlock_con1'.
+connection deadlock_con1;
# Reap SELECT. It should emit error about missing table.
ERROR 42S02: Table 'test.t2' doesn't exist
-# Switching to connection 'default'.
+connection default;
set debug_sync= 'RESET';
+disconnect deadlock_con1;
+disconnect deadlock_con2;
+disconnect deadlock_con3;
#
# Test for a scenario in which FLUSH TABLES <list> WITH READ LOCK
# used to erroneously release metadata locks.
#
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection default;
drop tables if exists t1, t2;
set debug_sync= 'RESET';
create table t1(i int);
create table t2(j int);
-# Switching to connection 'con2'.
+connection con2;
set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
# The below FLUSH TABLES <list> WITH READ LOCK should acquire
# SNW locks on t1 and t2, open table t1 and block on the debug
# sync point.
# Sending:
flush tables t1, t2 with read lock;
-# Switching to connection 'con1'.
+connection con1;
# Wait till FLUSH TABLES <list> WITH READ LOCK stops.
set debug_sync='now WAIT_FOR parked';
# Start a statement which will flush all tables and thus
# invalidate table t1 open by FLUSH TABLES <list> WITH READ LOCK.
# Sending:
flush tables;
-# Switching to connection 'default'.
+connection default;
# Wait till the above FLUSH TABLES blocks.
# Resume FLUSH TABLES <list> WITH READ LOCK, so it tries to open t2
# discovers that its t1 is obsolete and tries to reopen all tables.
# Such reopen should not cause releasing of SNW metadata locks
# which would result in assertion failures.
set debug_sync='now SIGNAL go';
-# Switching to connection 'con2'.
+connection con2;
# Reap FLUSH TABLES <list> WITH READ LOCK.
unlock tables;
-# Switching to connection 'con1'.
+connection con1;
# Reap FLUSH TABLES.
# Clean-up.
-# Switching to connection 'default'.
+connection default;
drop tables t1, t2;
set debug_sync= 'RESET';
+disconnect con1;
+disconnect con2;
#
# Test for bug #46748 "Assertion in MDL_context::wait_for_locks()
# on INSERT + CREATE TRIGGER".
@@ -2312,6 +2176,9 @@ drop tables if exists t1, t2, t3, t4, t5;
# Let us simulate scenario in which we open some tables from extended
# part of prelocking set but then encounter conflicting metadata lock,
# 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);
@@ -2321,31 +2188,33 @@ insert into t2 values (new.i);
create trigger t2_bi before insert on t2 for each row
insert into t3 values (new.j);
#
-# Switching to connection 'con1root'.
+connection con1root;
lock tables t4 read;
#
-# Switching to connection 'con2root'.
+connection con2root;
# Send :
rename table t3 to t5, t4 to t3;;
#
-# Switching to connection 'default'.
+connection default;
# Wait until the above RENAME TABLE adds pending requests for exclusive
# metadata lock on its tables and blocks due to 't4' being used by LOCK
# TABLES.
# Send :
insert into t1 values (1);;
#
-# Switching to connection 'con1root'.
+connection con1root;
# Wait until INSERT statement waits due to encountering pending
# exclusive metadata lock on 't3'.
unlock tables;
#
-# Switching to connection 'con2root'.
+connection con2root;
# Reap RENAME TABLE.
#
-# Switching to connection 'default'.
+connection default;
# Reap INSERT.
# Clean-up.
+disconnect con1root;
+disconnect con2root;
drop tables t1, t2, t3, t5;
#
# Bug#42546 - Backup: RESTORE fails, thinking it finds an existing table
@@ -2353,15 +2222,16 @@ drop tables t1, t2, t3, t5;
DROP TABLE IF EXISTS t1;
set @save_log_output=@@global.log_output;
set global log_output=file;
+connect con2, localhost, root,,;
#
# Test 1: CREATE TABLE
#
-# Connection 2
+connection con2;
# Start insert on the not-yet existing table
# Wait after taking the MDL lock
SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
INSERT INTO t1 VALUES(1,"def");
-# Connection 1
+connection default;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Now INSERT has a MDL on the non-existent table t1.
#
@@ -2369,10 +2239,10 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL finish';
# Try to create that table.
CREATE TABLE t1 (c1 INT, c2 VARCHAR(100), KEY(c1));
-# Connection 2
# Insert fails
+connection con2;
ERROR 42S02: Table 'test.t1' doesn't exist
-# Connection 1
+connection default;
SET DEBUG_SYNC= 'RESET';
SHOW TABLES;
Tables_in_test
@@ -2382,12 +2252,12 @@ DROP TABLE IF EXISTS t1;
# Test 2: CREATE TABLE LIKE
#
CREATE TABLE t2 (c1 INT, c2 VARCHAR(100), KEY(c1));
-# Connection 2
+connection con2;
# Start insert on the not-yet existing table
# Wait after taking the MDL
SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
INSERT INTO t1 VALUES(1,"def");
-# Connection 1
+connection default;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Now INSERT has a MDL on the non-existent table t1.
#
@@ -2395,16 +2265,17 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL finish';
# Try to create that table.
CREATE TABLE t1 LIKE t2;
-# Connection 2
# Insert fails
+connection con2;
ERROR 42S02: Table 'test.t1' doesn't exist
-# Connection 1
+connection default;
SET DEBUG_SYNC= 'RESET';
SHOW TABLES;
Tables_in_test
t1
t2
DROP TABLE t2;
+disconnect con2;
DROP TABLE IF EXISTS t1;
set global log_output=@save_log_output;
#
@@ -2412,20 +2283,24 @@ set global log_output=@save_log_output;
# FOR UPDATE"
#
drop tables if exists t1, t2;
+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);
# Let us check that we won't deadlock if during filling
# of I_S table we encounter conflicting metadata lock
# which owner is in its turn waiting for our connection.
lock tables t1 read;
-# Switching to connection 'con46044_2'.
+connection con46044_2;
# Sending:
update t1 set i = 2;
-# Switching to connection 'con46044'.
+connection con46044;
# Waiting until UPDATE t1 SET ... is blocked.
# Sending:
create table t2 select * from t1;;
-# Switching to connection 'default'.
+connection default;
# Waiting until CREATE TABLE ... SELECT ... is blocked.
# First let us check that SHOW FIELDS/DESCRIBE doesn't
# gets blocked and emits and error.
@@ -2449,11 +2324,12 @@ table_name table_type auto_increment table_comment
t2 BASE TABLE NULL Table 'test'.'t2' was skipped since its definition is being modified by concurrent DDL statement
Warnings:
Warning 1684 Table 'test'.'t2' was skipped since its definition is being modified by concurrent DDL statement
-# Switching to connection 'default'.
+connection default;
unlock tables;
-# Switching to connection 'con46044'.
+connection con46044;
# Reaping CREATE TABLE ... SELECT ... .
drop table t2;
+connection con46044_2;
# Reaping UPDATE t1 statement
#
# Let us also check that queries to I_S wait for conflicting metadata
@@ -2462,84 +2338,90 @@ drop table t2;
# and ease of use points of view.
#
# We check same three queries to I_S in this new situation.
-# Switching to connection 'con46044_2'.
+connection con46044_2;
lock tables t1 read;
-# Switching to connection 'con46044_3'.
+connection con46044_3;
# Sending:
update t1 set i = 3;
-# Switching to connection 'con46044'.
+connection con46044;
# Waiting until UPDATE t1 SET ... is blocked.
# Sending:
create table t2 select * from t1;;
-# Switching to connection 'default'.
+connection default;
# Waiting until CREATE TABLE ... SELECT ... is blocked.
# Let us check that SHOW FIELDS/DESCRIBE gets blocked.
# Sending:
show fields from t2;;
-# Switching to connection 'con46044_2'.
+connection con46044_2;
# Wait until SHOW FIELDS gets blocked.
unlock tables;
-# Switching to connection 'con46044'.
+connection con46044;
# Reaping CREATE TABLE ... SELECT ... .
-# Switching to connection 'default'.
+connection default;
# Reaping SHOW FIELDS ...
Field Type Null Key Default Extra
i int(11) YES NULL
drop table t2;
+connection con46044_3;
# Reaping UPDATE t1 statement
-# Switching to connection 'con46044_2'.
+connection con46044_2;
lock tables t1 read;
-# Switching to connection 'con46044_3'.
+connection con46044_3;
# Sending:
update t1 set i = 4;
-# Switching to connection 'con46044'.
+connection con46044;
# Waiting until UPDATE t1 SET ... is blocked.
# Sending:
create table t2 select * from t1;;
-# Switching to connection 'default'.
+connection default;
# Waiting until CREATE TABLE ... SELECT ... is blocked.
# Check that I_S query which reads only .FRMs gets blocked.
# Sending:
select column_name from information_schema.columns where table_schema='test' and table_name='t2';;
-# Switching to connection 'con46044_2'.
+connection con46044_2;
# Wait until SELECT COLUMN_NAME FROM I_S.COLUMNS gets blocked.
unlock tables;
-# Switching to connection 'con46044'.
+connection con46044;
# Reaping CREATE TABLE ... SELECT ... .
-# Switching to connection 'default'.
+connection default;
# Reaping SELECT COLUMN_NAME FROM I_S.COLUMNS
column_name
i
drop table t2;
+connection con46044_3;
# Reaping UPDATE t1 statement
-# Switching to connection 'con46044_2'.
+connection con46044_2;
lock tables t1 read;
-# Switching to connection 'con46044_3'.
+connection con46044_3;
# Sending:
update t1 set i = 5;
-# Switching to connection 'con46044'.
+connection con46044;
# Waiting until UPDATE t1 SET ... is blocked.
# Sending:
create table t2 select * from t1;;
-# Switching to connection 'default'.
+connection default;
# Waiting until CREATE TABLE ... SELECT ... is blocked.
# Finally, check that I_S query which does full-blown table open
# also gets blocked.
# Sending:
select table_name, table_type, auto_increment, table_comment from information_schema.tables where table_schema='test' and table_name='t2';;
-# Switching to connection 'con46044_2'.
+connection con46044_2;
# Wait until SELECT ... FROM I_S.TABLES gets blocked.
unlock tables;
-# Switching to connection 'con46044'.
+connection con46044;
# Reaping CREATE TABLE ... SELECT ... .
-# Switching to connection 'default'.
+connection default;
# Reaping SELECT ... FROM I_S.TABLES
table_name table_type auto_increment table_comment
t2 BASE TABLE NULL
drop table t2;
+connection con46044_3;
# Reaping UPDATE t1 statement
-# Switching to connection 'default'.
+connection default;
# Clean-up.
+disconnect con46044;
+disconnect con46044_2;
+disconnect con46044_3;
drop table t1;
#
# Test for bug #46273 "MySQL 5.4.4 new MDL: Bug#989 is not fully fixed
@@ -2547,6 +2429,8 @@ drop table t1;
#
drop table if exists t1;
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;
@@ -2554,11 +2438,11 @@ select * from t1 where c2 = 3;
c1 c2 c3
3 3 0
#
-# Switching to connection 'con46273'.
+connection con46273;
set debug_sync='alter_table_copy_after_lock_upgrade SIGNAL alter_table_locked WAIT_FOR alter_go';
alter table t1 add column e int, rename to t2;;
#
-# Switching to connection 'default'.
+connection default;
set debug_sync='now WAIT_FOR alter_table_locked';
set debug_sync='mdl_acquire_lock_wait SIGNAL alter_go';
# The below statement should get ER_LOCK_DEADLOCK error
@@ -2567,10 +2451,11 @@ set debug_sync='mdl_acquire_lock_wait SIGNAL alter_go';
update t1 set c3=c3+1 where c2 = 3;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
#
-# Switching to connection 'con46273'.
+connection con46273;
# Reap ALTER TABLE.
#
-# Switching to connection 'default'.
+connection default;
+disconnect con46273;
# Clean-up.
set debug_sync= 'RESET';
drop table t2;
@@ -2579,64 +2464,70 @@ drop table t2;
# and DML".
#
drop tables if exists t1;
+connect con46673, localhost, root,,;
+connection default;
create table t1 (i int);
-# Switching to connection 'con46673'.
+connection con46673;
begin;
insert into t1 values (1);
-# Switching to connection 'default'.
+connection default;
# Statement below should not get blocked. And if after some
# changes to code it is there should not be a deadlock between
# it and transaction from connection 'con46673'.
flush tables with read lock;
unlock tables;
-# Switching to connection 'con46673'.
+connection con46673;
delete from t1 where i = 1;
commit;
-# Switching to connection 'default'.
+connection default;
# Clean-up
+disconnect con46673;
drop table t1;
#
# Bug#48210 FLUSH TABLES WITH READ LOCK deadlocks
# against concurrent CREATE PROCEDURE
#
+connect con2, localhost, root;
# Test 1: CREATE PROCEDURE
-# Connection 1
+connection default;
# Start CREATE PROCEDURE and open mysql.proc
SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait';
CREATE PROCEDURE p1() SELECT 1;
-# Connection 2
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
# Check that FLUSH must wait to get the GRL
# and let CREATE PROCEDURE continue
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
FLUSH TABLES WITH READ LOCK;
-# Connection 1
-# Connection 2
+connection default;
+connection con2;
UNLOCK TABLES;
-# Connection 1
+connection default;
SET DEBUG_SYNC= 'RESET';
# Test 2: DROP PROCEDURE
+connection default;
# Start DROP PROCEDURE and open tables
SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait';
DROP PROCEDURE p1;
-# Connection 2
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
# Check that FLUSH must wait to get the GRL
# and let DROP PROCEDURE continue
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
FLUSH TABLES WITH READ LOCK;
-# Connection 1
+connection default;
# Once FLUSH TABLES WITH READ LOCK starts waiting
# DROP PROCEDURE will be waked up and will drop
# procedure. Global read lock will be granted after
# this statement ends.
#
# Reaping DROP PROCEDURE.
-# Connection 2
+connection con2;
# Reaping FTWRL.
UNLOCK TABLES;
-# Connection 1
+connection default;
SET DEBUG_SYNC= 'RESET';
+disconnect con2;
#
# Bug#50786 Assertion `thd->mdl_context.trans_sentinel() == __null'
# failed in open_ltable()
@@ -2644,6 +2535,10 @@ SET DEBUG_SYNC= 'RESET';
# Supress warnings written to the log file
call mtr.add_suppression("Wait on a lock was aborted due to a pending exclusive lock");
DROP TABLE IF EXISTS t1, t2;
+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;
@@ -2653,34 +2548,47 @@ SET @@global.log_output= 'TABLE';
SET @old_sql_log_off= @@session.sql_log_off;
SET @@session.sql_log_off= 1;
# connection: con1
+connection con1;
HANDLER t1 OPEN;
# connection: con3
+connection con3;
SET @@session.sql_log_off= 1;
# connection: con2
+connection con2;
SET DEBUG_SYNC= 'thr_multi_lock_after_thr_lock SIGNAL parked WAIT_FOR go';
# Sending:
SELECT 1;
# connection: con3
+connection con3;
SET DEBUG_SYNC= 'now WAIT_FOR parked';
# connection: con1
+connection con1;
# Sending:
SELECT 1;
# connection: con3
+connection con3;
ALTER TABLE t1 ADD COLUMN j INT;
# connection: default
+connection default;
SET DEBUG_SYNC= 'now SIGNAL go';
# connection: con1
+connection con1;
# Reaping SELECT 1
1
1
HANDLER t1 CLOSE;
# connection: con2
+connection con2;
# Reaping SELECT 1
1
1
# 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;
@@ -2691,12 +2599,15 @@ SET @@session.sql_log_off= @old_sql_log_off;
#
drop table if exists t1;
set debug_sync= 'RESET';
+connect con50913_1,localhost,root;
+connect con50913_2,localhost,root;
+connection default;
create table t1 (i int) engine=InnoDB;
-# Switching to connection 'con50913_1'.
+connection con50913_1;
set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL parked WAIT_FOR go';
# Sending:
alter table t1 add column j int, ALGORITHM=COPY;
-# Switching to connection 'default'.
+connection default;
# Wait until ALTER TABLE gets blocked on a sync point after
# acquiring thr_lock.c lock.
set debug_sync= 'now WAIT_FOR parked';
@@ -2704,14 +2615,16 @@ set debug_sync= 'now WAIT_FOR parked';
# thr_lock.c lock.
# Sending:
truncate table t1;
-# Switching to connection 'con50913_2'.
+connection con50913_2;
# Wait until TRUNCATE TABLE is blocked on MDL lock.
# Unblock ALTER TABLE.
set debug_sync= 'now SIGNAL go';
-# Switching to connection 'con50913_1'.
+connection con50913_1;
# Reaping ALTER TABLE.
-# Switching to connection 'default'.
+connection default;
# Reaping TRUNCATE TABLE.
+disconnect con50913_1;
+disconnect con50913_2;
set debug_sync= 'RESET';
drop table t1;
#
@@ -2723,30 +2636,34 @@ drop table t1;
# should be performed.
drop table if exists t1;
set debug_sync= 'RESET';
+connect con1,localhost,root;
+connect con2,localhost,root;
+connect con3,localhost,root;
+connection default;
create table t1 (i int);
-# Switching to connection 'con1'.
+connection con1;
begin;
select * from t1;
i
-# Switching to connection 'con2'.
+connection con2;
begin;
select * from t1;
i
-# Switching to connection 'default'.
+connection default;
# Start ALTER TABLE which will acquire SNW lock and
# table lock and get blocked on sync point.
set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL parked WAIT_FOR go';
# Sending:
alter table t1 add column j int;
-# Switching to connection 'con1'.
+connection con1;
# Wait until ALTER TABLE gets blocked on a sync point.
set debug_sync= 'now WAIT_FOR parked';
# Sending:
insert into t1 values (1);
-# Switching to connection 'con2'.
+connection con2;
# Sending:
insert into t1 values (1);
-# Switching to connection 'con3'.
+connection con3;
# Wait until both 'con1' and 'con2' are blocked trying to acquire
# SW lock on the table.
# Unblock ALTER TABLE. Since it will try to upgrade SNW to X lock
@@ -2754,17 +2671,21 @@ insert into t1 values (1);
# should be found and DML statements in both 'con1' and 'con2'
# should be aborted with ER_LOCK_DEADLOCK errors.
set debug_sync= 'now SIGNAL go';
-# Switching to connection 'con1'.
+connection con1;
# Reaping INSERT. It should end with ER_LOCK_DEADLOCK error and
# not wait indefinitely (as it happened before the bugfix).
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
commit;
-# Switching to connection 'con2'.
+connection con2;
# Reaping INSERT.
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
commit;
-# Switching to connection 'default'.
+connection default;
# Reap ALTER TABLE.
+disconnect con1;
+disconnect con2;
+disconnect con3;
+connection default;
set debug_sync= 'RESET';
drop table t1;
#
@@ -2772,137 +2693,151 @@ drop table t1;
#
# Ensure that a acquired lock is not given up due to a conflict.
#
+connect con1,localhost,root,,test,,;
+connect con2,localhost,root,,test,,;
+connect con3,localhost,root,,test,,;
+connection default;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2),(3);
-# Connection: con1
+connection con1;
LOCK TABLES t1 WRITE;
SET debug_sync='upgrade_lock_for_truncate SIGNAL parked_truncate WAIT_FOR go_truncate';
TRUNCATE TABLE t1;
-# Connection: default
+connection default;
SET debug_sync='now WAIT_FOR parked_truncate';
-# Connection: con2
+connection con2;
SET debug_sync='after_open_table_ignore_flush SIGNAL parked_show WAIT_FOR go_show';
SHOW FIELDS FROM t1;
-# Connection: default
+connection default;
SET debug_sync='now WAIT_FOR parked_show';
-# Connection: con3
+connection con3;
SET debug_sync='after_flush_unlock SIGNAL parked_flush WAIT_FOR go_flush';
FLUSH TABLES t1;
-# Connection: default
+connection default;
SET debug_sync='now WAIT_FOR parked_flush';
SET debug_sync='now SIGNAL go_truncate';
# Ensure that truncate waits for a exclusive lock
SET debug_sync= 'now SIGNAL go_show';
-# Connection: con1 (TRUNCATE)
+connection con1;
# Reaping...
UNLOCK TABLES;
-# Connection: con2 (SHOW FIELDS FROM t1)
+connection con2;
# Reaping...
Field Type Null Key Default Extra
a int(11) YES NULL
-# Connection: default
+connection default;
SET debug_sync= 'now SIGNAL go_flush';
-# Connection: con3 (FLUSH TABLES t1)
+connection con3;
# Reaping...
-# Connection: default
+disconnect con1;
+disconnect con2;
+disconnect con3;
+connection default;
SET debug_sync= 'RESET';
DROP TABLE t1;
#
# Bug#52856 concurrent show columns or show full columns causes a crash!!!
#
CREATE TABLE t1(a CHAR(255));
+connect con1, localhost, root;
SET DEBUG_SYNC= "get_schema_column SIGNAL waiting WAIT_FOR completed";
SHOW FULL COLUMNS FROM t1;
+connection default;
SET DEBUG_SYNC= "now WAIT_FOR waiting";
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
a char(255) latin1_swedish_ci YES NULL #
SET DEBUG_SYNC= "now SIGNAL completed";
+connection con1;
Field Type Collation Null Key Default Extra Privileges Comment
a char(255) latin1_swedish_ci YES NULL #
+connection default;
DROP TABLE t1;
+disconnect con1;
#
# Tests for schema-scope locks
#
DROP DATABASE IF EXISTS db1;
DROP DATABASE IF EXISTS db2;
+connect con2, localhost, root;
+connect con3, localhost, root;
# Test 1:
# CREATE DATABASE blocks database DDL on the same database, but
# not database DDL on different databases. Tests X vs X lock.
#
-# Connection default
+connection default;
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
CREATE DATABASE db1;
-# Connection con2
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
CREATE DATABASE db1;
-# Connection con3
+connection con3;
CREATE DATABASE db2;
ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
DROP DATABASE db2;
SET DEBUG_SYNC= 'now SIGNAL blocked';
-# Connection default
+connection default;
# Reaping: CREATE DATABASE db1
-# Connection con2
+connection con2;
# Reaping: CREATE DATABASE db1
ERROR HY000: Can't create database 'db1'; database exists
# Test 2:
# ALTER DATABASE blocks database DDL on the same database, but
# not database DDL on different databases. Tests X vs X lock.
#
-# Connection default
+connection default;
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
ALTER DATABASE db1 DEFAULT CHARACTER SET utf8;
-# Connection con2
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
ALTER DATABASE db1 DEFAULT CHARACTER SET utf8;
-# Connection con3
+connection con3;
CREATE DATABASE db2;
ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
DROP DATABASE db2;
SET DEBUG_SYNC= 'now SIGNAL blocked';
-# Connection default
+connection default;
# Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
-# Connection con2
+connection con2;
# Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
-# Connection default
+connection default;
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
ALTER DATABASE db1 DEFAULT CHARACTER SET utf8;
-# Connection con2
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
DROP DATABASE db1;
-# Connection con3
+connection con3;
SET DEBUG_SYNC= 'now SIGNAL blocked';
-# Connection default
+connection default;
# Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
-# Connection con2
+connection con2;
# Reaping: DROP DATABASE db1
CREATE DATABASE db1;
# Test 3:
# Two ALTER..UPGRADE of the same database are mutually exclusive, but
# two ALTER..UPGRADE of different databases are not. Tests X vs X lock.
#
-# Connection default
+connection default;
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;
-# Connection con2
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;
-# Connection con3
+connection con3;
ALTER DATABASE `#mysql50#a-b-c-d` UPGRADE DATA DIRECTORY NAME;
SET DEBUG_SYNC= 'now SIGNAL blocked';
-# Connection default
+connection default;
# Reaping: ALTER DATABASE '#mysql50#a-b-c' UPGRADE DATA DIRECTORY NAME
-# Connection con2
+connection con2;
# Reaping: ALTER DATABASE '#mysql50#a-b-c' UPGRADE DATA DIRECTORY NAME
ERROR 42000: Unknown database '#mysql50#a-b-c'
DROP DATABASE `a-b-c`;
@@ -2911,96 +2846,96 @@ DROP DATABASE `a-b-c-d`;
# DROP DATABASE blocks database DDL on the same database, but
# not database DDL on different databases. Tests X vs X lock.
#
-# Connection default
+connection default;
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
DROP DATABASE db1;
-# Connection con2
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
DROP DATABASE db1;
-# Connection con3
+connection con3;
CREATE DATABASE db2;
ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
DROP DATABASE db2;
SET DEBUG_SYNC= 'now SIGNAL blocked';
-# Connection default
+connection default;
# Reaping: DROP DATABASE db1
-# Connection con2
+connection con2;
# Reaping: DROP DATABASE db1
ERROR HY000: Can't drop database 'db1'; database doesn't exist
-# Connection default
+connection default;
CREATE DATABASE db1;
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
DROP DATABASE db1;
-# Connection con2
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
ALTER DATABASE db1 DEFAULT CHARACTER SET utf8;
-# Connection con3
+connection con3;
SET DEBUG_SYNC= 'now SIGNAL blocked';
-# Connection default
+connection default;
# Reaping: DROP DATABASE db1
-# Connection con2
+connection con2;
# Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
Got one of the listed errors
# Test 5:
# Locked database name prevents CREATE of tables in that database.
# Tests X vs IX lock.
#
-# Connection default
+connection default;
CREATE DATABASE db1;
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
DROP DATABASE db1;
-# Connection con2
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
CREATE TABLE db1.t1 (a INT);
-# Connection con3
+connection con3;
SET DEBUG_SYNC= 'now SIGNAL blocked';
-# Connection default
+connection default;
# Reaping: DROP DATABASE db1
-# Connection con2
+connection con2;
# Reaping: CREATE TABLE db1.t1 (a INT)
ERROR 42000: Unknown database 'db1'
# Test 6:
# Locked database name prevents RENAME of tables to/from that database.
# Tests X vs IX lock.
#
-# Connection default
+connection default;
CREATE DATABASE db1;
CREATE TABLE db1.t1 (a INT);
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
DROP DATABASE db1;
-# Connection con2
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
RENAME TABLE db1.t1 TO test.t1;
-# Connection con3
+connection con3;
SET DEBUG_SYNC= 'now SIGNAL blocked';
-# Connection default
+connection default;
# Reaping: DROP DATABASE db1
-# Connection con2
+connection con2;
# Reaping: RENAME TABLE db1.t1 TO test.t1
ERROR 42S02: Table 'db1.t1' doesn't exist
-# Connection default
+connection default;
CREATE DATABASE db1;
CREATE TABLE test.t2 (a INT);
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
DROP DATABASE db1;
-# Connection con2
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
RENAME TABLE test.t2 TO db1.t2;
-# Connection con3
+connection con3;
SET DEBUG_SYNC= 'now SIGNAL blocked';
-# Connection default
+connection default;
# Reaping: DROP DATABASE db1
-# Connection con2
+connection con2;
# Reaping: RENAME TABLE test.t2 TO db1.t2
Got one of the listed errors
DROP TABLE test.t2;
@@ -3008,24 +2943,26 @@ DROP TABLE test.t2;
# Locked database name prevents DROP of tables in that database.
# Tests X vs IX lock.
#
-# Connection default
+connection default;
CREATE DATABASE db1;
CREATE TABLE db1.t1 (a INT);
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
# Sending:
DROP DATABASE db1;
-# Connection con2
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# Sending:
DROP TABLE db1.t1;
-# Connection con3
+connection con3;
SET DEBUG_SYNC= 'now SIGNAL blocked';
-# Connection default
+connection default;
# Reaping: DROP DATABASE db1
-# Connection con2
+connection con2;
# Reaping: DROP TABLE db1.t1
ERROR 42S02: Unknown table 'db1.t1'
-# Connection default
+connection default;
+disconnect con2;
+disconnect con3;
SET DEBUG_SYNC= 'RESET';
#
# End of tests for schema-scope locks
@@ -3035,30 +2972,34 @@ SET DEBUG_SYNC= 'RESET';
#
CREATE DATABASE db1;
CREATE TABLE db1.t1(a INT);
-# Connection default
+connect con2, localhost, root;
+connect con3, localhost, root;
+connection default;
FLUSH TABLE WITH READ LOCK;
-# Connection con2
+connection con2;
CREATE TABLE db1.t2(a INT);
-# Connection default
+connection default;
UNLOCK TABLES;
-# Connection con2
+connection con2;
# Reaping CREATE TABLE db1.t2(a INT)
-# Connection default
+connection default;
FLUSH TABLE WITH READ LOCK;
-# Connection con2
+connection con2;
ALTER DATABASE db1 DEFAULT CHARACTER SET utf8;
-# Connection default
+connection default;
UNLOCK TABLES;
-# Connection con2
+connection con2;
# Reaping ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
-# Connection default
+connection default;
FLUSH TABLE WITH READ LOCK;
-# Connection con2
+connection con2;
FLUSH TABLE WITH READ LOCK;
UNLOCK TABLES;
-# Connection default
+connection default;
UNLOCK TABLES;
DROP DATABASE db1;
+disconnect con2;
+disconnect con3;
#
# Bug#56292 Deadlock with ALTER TABLE and MERGE tables
#
@@ -3068,38 +3009,46 @@ 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);
-# Connection con1
+connect con1, localhost, root;
+connect con2, localhost, root;
+connect con3, localhost, root;
+connection con1;
# We need EXECUTE 2 since ALTER TABLE does SU => SNW => X and we want
# to stop at the second upgrade.
SET DEBUG_SYNC= 'mdl_upgrade_lock SIGNAL upgrade WAIT_FOR continue EXECUTE 2';
# Sending:
ALTER TABLE m1 engine=MERGE UNION=(t2, t1);
-# Connection con2
+connection con2;
# 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';
# Sending:
DELETE FROM t2 WHERE a = 3;
-# Connection default
+connection con3;
# Check that DELETE is waiting on a metadata lock and not a table lock.
# Now that DELETE blocks on a metadata lock, we should be able to do
# SELECT * FROM m1 here. SELECT used to be blocked by a DELETE table
# lock request.
SELECT * FROM m1 WHERE a < 3;
+connection default;
# Resuming ALTER TABLE
SET DEBUG_SYNC= 'now SIGNAL continue';
-# Connection con1
+connection con1;
# Reaping: ALTER TABLE m1 engine=MERGE UNION=(t2, t1)
-# Connection con2
+connection con2;
# Reaping: DELETE FROM t2 WHERE a = 3
+connection con3;
# Reaping: SELECT * FROM m1 WHERE a < 3
a
1
2
-# Connection default
+connection default;
DROP TABLE m1, t1, t2;
SET DEBUG_SYNC= 'RESET';
+disconnect con1;
+disconnect con2;
+disconnect con3;
#
# MDEV-12620 - set lock_wait_timeout = 1;flush tables with read lock;
# lock not released after timeout
@@ -3107,11 +3056,14 @@ SET DEBUG_SYNC= 'RESET';
CREATE TABLE t1(a INT) ENGINE=InnoDB;
SET debug_sync='open_tables_after_open_and_process_table SIGNAL ready WAIT_FOR go';
SELECT * FROM t1;
+connect con1,localhost,root,,;
SET debug_sync='now WAIT_FOR ready';
SET lock_wait_timeout=1;
FLUSH TABLES WITH READ LOCK;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET debug_sync='now SIGNAL go';
+connection default;
a
SET debug_sync='RESET';
DROP TABLE t1;
+disconnect con1;
diff --git a/mysql-test/r/merge-big.result b/mysql-test/r/merge-big.result
index b17140a7c79..3b6e116986e 100644
--- a/mysql-test/r/merge-big.result
+++ b/mysql-test/r/merge-big.result
@@ -6,11 +6,11 @@ drop table if exists t1,t2,t3,t4,t5,t6;
#
CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
LOCK TABLE t1 WRITE;
-# connection con1
+connect con1,localhost,root,,;
SET @orig_debug=@@debug;
SET GLOBAL debug_dbug="+d,sleep_open_and_lock_after_open";
INSERT INTO t1 VALUES (1);
-# connection default
+connection default;
# Let INSERT go into thr_multi_lock().
# Kick INSERT out of thr_multi_lock().
FLUSH TABLES;
@@ -21,7 +21,8 @@ FLUSH TABLES;
SELECT * FROM t1;
c1
UNLOCK TABLES;
-# connection con1
+connection con1;
SET GLOBAL debug_dbug=@orig_debug;
-# connection default
+disconnect con1;
+connection default;
DROP TABLE t1;
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index 97c391566dd..9922089bf7d 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -1121,31 +1121,46 @@ c1
2
UNLOCK TABLES;
DROP TABLE t1, t2, t3, t4;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection default;
CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
CREATE TABLE t2 (c1 INT) ENGINE= MRG_MYISAM UNION= (t1) INSERT_METHOD= LAST;
REPAIR TABLE t1;
+connection con1;
INSERT INTO t2 VALUES (1);
+connection default;
Table Op Msg_type Msg_text
test.t1 repair status OK
DROP TABLE t1, t2;
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;
INSERT INTO t2 VALUES (1);
+connection default;
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
UNLOCK TABLES;
+connection con1;
+connection default;
DROP TABLE t1, t2;
CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
LOCK TABLE t1 WRITE;
+connection con1;
INSERT INTO t1 VALUES (1);
+connection default;
FLUSH TABLES;
FLUSH TABLES;
SELECT * FROM t1;
c1
UNLOCK TABLES;
+connection con1;
+connection default;
DROP TABLE t1;
+disconnect con1;
+disconnect con2;
#
# Extra tests for Bug#26379 - Combination of FLUSH TABLE and
# REPAIR TABLE corrupts a MERGE table
@@ -1964,9 +1979,14 @@ COUNT(*)
SELECT COUNT(*) FROM t3;
COUNT(*)
210
+connect con1,localhost,root,,;
SELECT COUNT(DISTINCT a1.id) FROM t3 AS a1, t3 AS a2
WHERE a1.id = a2.id GROUP BY a2.grp;
+connection default;
TRUNCATE TABLE t1;
+connection con1;
+disconnect con1;
+connection default;
SELECT COUNT(*) FROM t1;
COUNT(*)
0
@@ -2269,8 +2289,8 @@ 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();
SHOW CREATE TRIGGER tr1;
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-tr1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER INSERT ON t3 FOR EACH ROW CALL foo() latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+tr1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER INSERT ON t3 FOR EACH ROW CALL foo() latin1 latin1_swedish_ci latin1_swedish_ci #
DROP TRIGGER tr1;
DROP TABLE t1, t2, t3;
#
@@ -2765,14 +2785,14 @@ CREATE TRIGGER tm1_ai AFTER INSERT ON tm1
FOR EACH ROW INSERT INTO t1 VALUES(11);
LOCK TABLE tm1 WRITE, t1 WRITE;
INSERT INTO tm1 VALUES (1);
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
SELECT * FROM tm1;
c1
1
UNLOCK TABLES;
LOCK TABLE t1 WRITE, tm1 WRITE;
INSERT INTO tm1 VALUES (1);
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
SELECT * FROM tm1;
c1
1
@@ -2824,10 +2844,15 @@ INSERT INTO t2 VALUES(2);
INSERT INTO t3 VALUES(3);
INSERT INTO t4 VALUES(4);
INSERT INTO t5 VALUES(5);
+connect con1,localhost,root,,;
UPDATE t2, tm1 SET t2.c1=f1();
+connection default;
FLUSH TABLES;
FLUSH TABLES;
UNLOCK TABLES;
+connection con1;
+disconnect con1;
+connection default;
SELECT * FROM tm1;
c1
1
@@ -3556,7 +3581,7 @@ DROP TABLE t1, t2, t3, t4, m1, m2;
# HANDLER ... OPEN.
# The general case.
DROP TABLE IF EXISTS t1, t2, t3;
-# Connection con1.
+connect con1,localhost,root,,;
CREATE TABLE t1 (c1 int);
CREATE TABLE t2 (c1 int);
CREATE TABLE t3 (c1 int) ENGINE = MERGE UNION (t1,t2);
@@ -3564,10 +3589,11 @@ START TRANSACTION;
HANDLER t3 OPEN;
ERROR HY000: Storage engine MRG_MyISAM of the table `test`.`t3` doesn't have this option
DROP TABLE t1, t2, t3;
-# Connection default.
-# Disconnecting con1, all mdl_tickets must have been released.
+connection default;
+# all mdl_tickets must have been released.
+disconnect con1;
# The bug-specific case.
-# Connection con1.
+connect con1,localhost,root,,;
CREATE TABLE t1 (c1 int);
CREATE TABLE t2 (c1 int);
CREATE TABLE t3 (c1 int) ENGINE = MERGE UNION (t1,t2);
@@ -3576,8 +3602,9 @@ START TRANSACTION;
HANDLER t3 OPEN;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t1, t3;
-# Connection default.
-# Disconnecting con1, all mdl_tickets must have been released.
+connection default;
+# all mdl_tickets must have been released.
+disconnect con1;
#
# A test case for Bug#47648 main.merge fails sporadically
#
@@ -3684,9 +3711,9 @@ ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as
insert into m1 (a) values ((select max(a) from tmp, t2));
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from v1));
-ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'm1'.
+ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'm1'
insert into m1 (a) values ((select max(a) from tmp, v1));
-ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'm1'.
+ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'm1'
update m1 set a = ((select max(a) from m1));
ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update m1 set a = ((select max(a) from m2));
@@ -3712,9 +3739,9 @@ ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as
update m1 set a = ((select max(a) from tmp, t2));
ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update m1 set a = ((select max(a) from v1));
-ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'm1'.
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'm1'
update m1 set a = ((select max(a) from tmp, v1));
-ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'm1'.
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'm1'
delete from m1 where a = (select max(a) from m1);
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from m1 where a = (select max(a) from m2);
@@ -3740,9 +3767,9 @@ ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as
delete from m1 where a = (select max(a) from tmp, t2);
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from m1 where a = (select max(a) from v1);
-ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'm1'.
+ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'm1'
delete from m1 where a = (select max(a) from tmp, v1);
-ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'm1'.
+ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'm1'
drop view v1;
drop temporary table tmp;
drop table t1, t2, t3, m1, m2;
diff --git a/mysql-test/r/merge_debug.result b/mysql-test/r/merge_debug.result
index d6ca17f0659..51905e52d24 100644
--- a/mysql-test/r/merge_debug.result
+++ b/mysql-test/r/merge_debug.result
@@ -1,6 +1,7 @@
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");
drop table if exists crashed,t2,t3,t4;
SET @orig_debug=@@debug;
CREATE TABLE crashed (c1 INT);
diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result
index ffdab244f31..3db3bcd450f 100644
--- a/mysql-test/r/metadata.result
+++ b/mysql-test/r/metadata.result
@@ -4,7 +4,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def 1 8 1 1 N 32897 0 63
def 1.0 246 4 3 N 32897 1 63
def -1 8 2 2 N 32897 0 63
-def hello 253 5 5 N 1 31 8
+def hello 253 5 5 N 1 39 8
def NULL 6 0 0 Y 32896 0 63
1 1.0 -1 hello NULL
1 1.0 -1 hello NULL
diff --git a/mysql-test/r/mix2_myisam.result b/mysql-test/r/mix2_myisam.result
index 7c98ec49b60..34764466d2a 100644
--- a/mysql-test/r/mix2_myisam.result
+++ b/mysql-test/r/mix2_myisam.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("Can't find record in .*");
SET SESSION STORAGE_ENGINE = MEMORY;
drop table if exists t1,t2,t3,t4;
drop database if exists mysqltest;
@@ -257,7 +258,7 @@ drop table t1;
CREATE TABLE t1 (a int not null, b int not null,c int not null,
key(a),primary key(a,b), unique(c),key(a),unique(b)) ENGINE = MyISAM;
Warnings:
-Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 a A # NULL NULL BTREE
@@ -1428,7 +1429,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text
+ `t` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t2 like t1;
show create table t2;
@@ -1436,7 +1437,7 @@ Table Create Table
t2 CREATE TABLE `t2` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text
+ `t` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t3 select * from t1;
show create table t3;
@@ -1444,7 +1445,7 @@ Table Create Table
t3 CREATE TABLE `t3` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text
+ `t` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify c varchar(10);
show create table t1;
@@ -1452,7 +1453,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL,
`c` varchar(10) DEFAULT NULL,
- `t` text
+ `t` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify v char(10);
show create table t1;
@@ -1460,7 +1461,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` char(10) DEFAULT NULL,
`c` varchar(10) DEFAULT NULL,
- `t` text
+ `t` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify t varchar(10);
Warnings:
@@ -1483,7 +1484,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text,
+ `t` text DEFAULT NULL,
KEY `v` (`v`),
KEY `c` (`c`),
KEY `t` (`t`(10))
@@ -1548,9 +1549,12 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where; Using index
alter table t1 add unique(v);
ERROR 23000: Duplicate entry '{ ' for key 'v_2'
+show warnings;
+Level Code Message
+Error 1062 Duplicate entry 'a' for key 'v_2'
alter table t1 add key(v);
Warnings:
-Note 1831 Duplicate index `v_2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `v_2`. This is deprecated and will be disallowed in a future release
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
qq
*a*a*a*
@@ -1704,7 +1708,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(300) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text,
+ `t` text DEFAULT NULL,
KEY `c` (`c`),
KEY `t` (`t`(10)),
KEY `v` (`v`)
@@ -1784,7 +1788,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(300) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text,
+ `t` text DEFAULT NULL,
KEY `c` (`c`),
KEY `t` (`t`(10)),
KEY `v` (`v`(30))
@@ -1864,7 +1868,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(600) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text,
+ `t` text DEFAULT NULL,
KEY `c` (`c`),
KEY `t` (`t`(10)),
KEY `v` (`v`)
@@ -1942,7 +1946,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text,
+ `t` text DEFAULT NULL,
KEY `v` (`v`(5)),
KEY `c` (`c`(5)),
KEY `t` (`t`(5))
@@ -1987,22 +1991,24 @@ create table t1 (v varchar(65530), key(v));
Warnings:
Warning 1071 Specified key was too long; max key length is 1000 bytes
drop table t1;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t1 (v varchar(65536));
Warnings:
Note 1246 Converting column 'v' from VARCHAR to TEXT
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` mediumtext
+ `v` mediumtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t1 (v varchar(65530) character set utf8);
Warnings:
Note 1246 Converting column 'v' from VARCHAR to TEXT
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` mediumtext CHARACTER SET utf8
+ `v` mediumtext CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set storage_engine=MEMORY;
@@ -2064,23 +2070,36 @@ delete t1 from t1,t2 where f1=f3 and f4='cc';
select * from t1;
f1 f2
drop table t1,t2;
+connect a,localhost,root,,;
+connect b,localhost,root,,;
+connection a;
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=MyISAM;
insert into t1(a) values (1),(2),(3);
commit;
+connection b;
set autocommit = 0;
update t1 set b = 5 where a = 2;
commit;
+connection a;
create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
set autocommit = 0;
+connection a;
insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100),
(11),(21),(31),(41),(51),(61),(71),(81),(91),(101),
(12),(22),(32),(42),(52),(62),(72),(82),(92),(102),
(13),(23),(33),(43),(53),(63),(73),(83),(93),(103),
(14),(24),(34),(44),(54),(64),(74),(84),(94),(104);
+connection b;
commit;
+connection a;
commit;
drop trigger t1t;
drop table t1;
+disconnect a;
+disconnect b;
+connect a,localhost,root,,;
+connect b,localhost,root,,;
+connection a;
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=MyISAM;
create table t2(a int not null, b int, c int, d int, primary key(a)) engine=MyISAM;
create table t3(a int not null, b int, c int, d int, primary key(a)) engine=MyISAM;
@@ -2113,6 +2132,7 @@ update t3 set b = b + 5 where a = 1;
update t4 set b = b + 5 where a = 1;
insert into t5(a) values(20);
commit;
+connection b;
set autocommit = 0;
insert into t1(a) values(7);
insert into t2(a) values(8);
@@ -2124,6 +2144,9 @@ drop trigger t2t;
drop trigger t3t;
drop trigger t4t;
drop table t1, t2, t3, t4, t5;
+connection default;
+disconnect a;
+disconnect b;
create table t1(a date) engine=MyISAM;
create table t2(a date, key(a)) engine=MyISAM;
insert into t1 values('2005-10-01');
@@ -2148,20 +2171,29 @@ select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
where mm.id is null lock in share mode;
id f_id f
drop table t1,t2;
+connect a,localhost,root,,;
+connect b,localhost,root,,;
+connection a;
create table t1(a int not null, b int, primary key(a)) engine=MyISAM;
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
commit;
set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
update t1 set b = 5 where b = 1;
+connection b;
set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
select * from t1 where a = 7 and b = 3 for update;
a b
7 3
+connection a;
commit;
+connection b;
commit;
drop table t1;
+connection default;
+disconnect a;
+disconnect b;
CREATE TABLE t1 ( a int ) ENGINE=MyISAM;
BEGIN;
INSERT INTO t1 VALUES (1);
diff --git a/mysql-test/r/mrr_derived_crash_4610.result b/mysql-test/r/mrr_derived_crash_4610.result
index 8dcdfda9276..3e38a0d4218 100644
--- a/mysql-test/r/mrr_derived_crash_4610.result
+++ b/mysql-test/r/mrr_derived_crash_4610.result
@@ -7,8 +7,8 @@ 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;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 const PRIMARY PRIMARY 12 const 1 Using index; Using filesort
-1 PRIMARY <derived2> ref key0 key0 13 const 0 Using where
+1 PRIMARY t1 const PRIMARY PRIMARY 12 const 1 Using index
+1 PRIMARY <derived2> ref key0 key0 13 const 0 Using where; Using filesort
2 DERIVED t4 ALL NULL NULL NULL NULL 1
2 DERIVED t2 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join)
2 DERIVED t3 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
diff --git a/mysql-test/r/mrr_icp_extra.result b/mysql-test/r/mrr_icp_extra.result
index eaabd3d8119..95788b393dd 100644
--- a/mysql-test/r/mrr_icp_extra.result
+++ b/mysql-test/r/mrr_icp_extra.result
@@ -1,3 +1,4 @@
+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;
@@ -229,7 +230,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text
+ `t` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t2 like t1;
show create table t2;
@@ -237,7 +238,7 @@ Table Create Table
t2 CREATE TABLE `t2` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text
+ `t` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t3 select * from t1;
show create table t3;
@@ -245,7 +246,7 @@ Table Create Table
t3 CREATE TABLE `t3` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text
+ `t` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify c varchar(10);
show create table t1;
@@ -253,7 +254,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL,
`c` varchar(10) DEFAULT NULL,
- `t` text
+ `t` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify v char(10);
show create table t1;
@@ -261,7 +262,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` char(10) DEFAULT NULL,
`c` varchar(10) DEFAULT NULL,
- `t` text
+ `t` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify t varchar(10);
Warnings:
@@ -284,7 +285,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text,
+ `t` text DEFAULT NULL,
KEY `v` (`v`),
KEY `c` (`c`),
KEY `t` (`t`(10))
@@ -349,9 +350,12 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where; Using index
alter table t1 add unique(v);
ERROR 23000: Duplicate entry '{ ' for key 'v_2'
+show warnings;
+Level Code Message
+Error 1062 Duplicate entry 'a' for key 'v_2'
alter table t1 add key(v);
Warnings:
-Note 1831 Duplicate index `v_2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `v_2`. This is deprecated and will be disallowed in a future release
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
qq
*a*a*a*
@@ -505,7 +509,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(300) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text,
+ `t` text DEFAULT NULL,
KEY `c` (`c`),
KEY `t` (`t`(10)),
KEY `v` (`v`)
@@ -585,7 +589,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(300) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text,
+ `t` text DEFAULT NULL,
KEY `c` (`c`),
KEY `t` (`t`(10)),
KEY `v` (`v`(30))
@@ -665,7 +669,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(600) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text,
+ `t` text DEFAULT NULL,
KEY `c` (`c`),
KEY `t` (`t`(10)),
KEY `v` (`v`)
@@ -743,7 +747,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text,
+ `t` text DEFAULT NULL,
KEY `v` (`v`(5)),
KEY `c` (`c`(5)),
KEY `t` (`t`(5))
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 5991a5fd25a..634b3897ba0 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -1,10 +1,4 @@
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
-drop table if exists t1,t2,t3;
-drop database if exists mysqltest;
-drop view if exists v1;
-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';
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));
@@ -418,6 +412,8 @@ select * from t2;
c2_id c2_p_id c2_note c2_active
1 1 A Note 1
drop table t1, t2;
+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));
@@ -425,12 +421,18 @@ 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';
drop database mysqltest;
+connection default;
+disconnect user1;
+disconnect root;
create table t1 (a int, primary key (a));
create table t2 (a int, primary key (a));
create table t3 (a int, primary key (a));
@@ -444,53 +446,29 @@ ERROR HY000: Table 't1' is specified twice, both as a target for 'UPDATE' and as
delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data
drop table t1,t2;
-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;
create table t1(a int);
create table t2(a int);
delete from t1,t2 using t1,t2 where t1.a=(select a from t1);
ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data
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;
-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 (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;
alter table t1 add column c int default 100 after a;
+connect updater,localhost,root,,test;
+connection updater;
update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a;
+connection locker;
unlock tables;
+connection changer;
+connection updater;
select * from t1;
a c b
1 100 13
@@ -503,6 +481,10 @@ a
30
drop view v1;
drop table t1, t2;
+connection default;
+disconnect locker;
+disconnect changer;
+disconnect updater;
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);
@@ -607,6 +589,7 @@ a b
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Annotate_rows # # UPDATE t2,t1 SET t2.a=t1.a+2
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Update_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
@@ -620,12 +603,12 @@ ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Annotate_rows # # UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Update_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
drop table t1, t2;
set @@session.binlog_format= @sav_binlog_format;
-drop table if exists t1, t2, t3;
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;
@@ -679,11 +662,11 @@ SET SESSION sql_safe_updates = DEFAULT;
CREATE FUNCTION f1 () RETURNS BLOB RETURN 1;
CREATE TABLE t1 (f1 DATE);
INSERT INTO t1 VALUES('2001-01-01');
-UPDATE (SELECT 1 FROM t1 WHERE f1 = (SELECT f1() FROM t1)) x, t1 SET f1 = 1;
+UPDATE IGNORE (SELECT 1 FROM t1 WHERE f1 = (SELECT f1() FROM t1)) x, t1 SET f1 = 1;
Warnings:
Warning 1292 Incorrect datetime value: '1'
CREATE view v1 as SELECT f1() FROM t1;
-UPDATE (SELECT 1 FROM t1 WHERE f1 = (select * from v1)) x, t1 SET f1 = 1;
+UPDATE IGNORE (SELECT 1 FROM t1 WHERE f1 = (select * from v1)) x, t1 SET f1 = 1;
Warnings:
Warning 1292 Incorrect datetime value: '1'
DROP VIEW v1;
@@ -1019,57 +1002,3 @@ deallocate prepare stmt1;
drop view v3,v2,v1;
drop table t1,t2,t3;
end of 5.5 tests
-
-# Bug mdev-5970
-# Bug#13256831 - ERROR 1032 (HY000): CAN'T FIND RECORD
-
-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;
-f1 f2
-6 97
-UPDATE v1 SET f1 = 1;
-SELECT * FROM v1;
-f1 f2
-1 97
-DROP TABLE t1, t2;
-DROP VIEW v1;
-#
-# MDEV-5973: MySQL Bug#11757486:49539: NON-DESCRIPTIVE ERR (ERROR 0
-# FROM STORAGE ENGINE) WITH MULTI-TABLE UPDATE
-#
-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;
-Warnings:
-Warning 1264 Out of range value for column 'field1' at row 1
-Warning 1264 Out of range value for column 'field1' at row 2
-UPDATE IGNORE table_11757486 SET field1=128;
-Warnings:
-Warning 1264 Out of range value for column 'field1' at row 1
-Warning 1264 Out of range value for column 'field1' at row 2
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.
-UPDATE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1;
-ERROR 22003: Out of range value for column 'field1' at row 1
-UPDATE table_11757486 SET field1=128;
-ERROR 22003: Out of range value for column 'field1' at row 1
-SET SESSION SQL_MODE='';
-UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1;
-Warnings:
-Warning 1264 Out of range value for column 'field1' at row 1
-Warning 1264 Out of range value for column 'field1' at row 2
-UPDATE IGNORE table_11757486 SET field1=128;
-Warnings:
-Warning 1264 Out of range value for column 'field1' at row 1
-Warning 1264 Out of range value for column 'field1' at row 2
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.
-DROP TABLE table_11757486;
-SET SESSION SQL_MODE=default;
-end of 10.0 tests
diff --git a/mysql-test/r/multi_update_innodb.result b/mysql-test/r/multi_update_innodb.result
index 643287c3a93..5890fd24f5f 100644
--- a/mysql-test/r/multi_update_innodb.result
+++ b/mysql-test/r/multi_update_innodb.result
@@ -10,13 +10,13 @@ PRIMARY KEY (pk)
) ENGINE=InnoDB;
INSERT INTO t1 VALUES (0,0,0);
UPDATE t1 AS A, t1 AS B SET A.pk = 1, B.a = 2;
-ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'
SELECT * FROM t1;
pk a b
0 0 0
CREATE VIEW v1 AS SELECT * FROM t1;
UPDATE v1 AS A, t1 AS B SET A.pk = 1, B.a = 2;
-ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'
SELECT * FROM t1;
pk a b
0 0 0
@@ -51,19 +51,103 @@ primary key (pk_1,pk_2)
INSERT INTO t2 VALUES (1,2,3,4);
UPDATE t1 AS A NATURAL JOIN t1 B SET A.pk=5,B.pk=7;
-ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'
SELECT * FROM t1;
col_int_key pk col_int
1 2 3
UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_1=5,B.pk_1=7;
-ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'
UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_2=10,B.pk_2=11;
-ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'
SELECT * FROM t2;
col_int_key pk_1 pk_2 col_int
1 2 3 4
DROP TABLE t1,t2;
+
+# Bug mdev-5970
+# Bug#13256831 - ERROR 1032 (HY000): CAN'T FIND RECORD
+
+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;
+f1 f2
+6 97
+UPDATE v1 SET f1 = 1;
+SELECT * FROM v1;
+f1 f2
+1 97
+DROP TABLE t1, t2;
+DROP VIEW v1;
+#
+# MDEV-5973: MySQL Bug#11757486:49539: NON-DESCRIPTIVE ERR (ERROR 0
+# FROM STORAGE ENGINE) WITH MULTI-TABLE UPDATE
+#
+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;
+Warnings:
+Warning 1264 Out of range value for column 'field1' at row 1
+Warning 1264 Out of range value for column 'field1' at row 2
+UPDATE IGNORE table_11757486 SET field1=128;
+Warnings:
+Warning 1264 Out of range value for column 'field1' at row 1
+Warning 1264 Out of range value for column 'field1' at row 2
+UPDATE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1;
+ERROR 22003: Out of range value for column 'field1' at row 1
+UPDATE table_11757486 SET field1=128;
+ERROR 22003: Out of range value for column 'field1' at row 1
+SET SESSION SQL_MODE='';
+UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1;
+Warnings:
+Warning 1264 Out of range value for column 'field1' at row 1
+Warning 1264 Out of range value for column 'field1' at row 2
+UPDATE IGNORE table_11757486 SET field1=128;
+Warnings:
+Warning 1264 Out of range value for column 'field1' at row 1
+Warning 1264 Out of range value for column 'field1' at row 2
+DROP TABLE table_11757486;
+SET SESSION SQL_MODE=default;
+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;
+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/r/myisam-big.result b/mysql-test/r/myisam-big.result
index 95a6e91d766..fd0bcb1224b 100644
--- a/mysql-test/r/myisam-big.result
+++ b/mysql-test/r/myisam-big.result
@@ -34,7 +34,13 @@ insert into t1 select * from t1;
select count(*) from t1;
count(*)
131072
+connect con2,localhost,root,,;
+connection con2;
alter table t1 add index (id), add index(sometext), add index(sometext,id);
alter table t1 disable keys;
alter table t1 enable keys;
+connection default;
+connection con2;
+disconnect con2;
+connection default;
drop table t1,t2;
diff --git a/mysql-test/r/myisam-blob.result b/mysql-test/r/myisam-blob.result
index 6b41a244621..46be1bdbd49 100644
--- a/mysql-test/r/myisam-blob.result
+++ b/mysql-test/r/myisam-blob.result
@@ -28,6 +28,7 @@ INSERT INTO t1 set data=repeat('a',18*1024*1024);
select length(data) from t1;
length(data)
18874368
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 modify data blob;
Warnings:
Warning 1265 Data truncated for column 'data' at row 1
@@ -37,7 +38,7 @@ length(data)
drop table t1;
CREATE TABLE t1 (data BLOB) ENGINE=myisam;
INSERT INTO t1 (data) VALUES (NULL);
-UPDATE t1 set data=repeat('a',18*1024*1024);
+UPDATE IGNORE t1 set data=repeat('a',18*1024*1024);
Warnings:
Warning 1265 Data truncated for column 'data' at row 1
select length(data) from t1;
diff --git a/mysql-test/r/myisam-optimize.result b/mysql-test/r/myisam-optimize.result
index 9451046fe08..9de3c24301f 100644
--- a/mysql-test/r/myisam-optimize.result
+++ b/mysql-test/r/myisam-optimize.result
@@ -3,6 +3,7 @@
#
create table t1 (pk int primary key, i int) engine=MyISAM;
insert into t1 values (1,1),(2,2);
+connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -13,6 +14,8 @@ t1 CREATE TABLE `t1` (
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
+disconnect con1;
+connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -23,6 +26,8 @@ t1 CREATE TABLE `t1` (
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
+disconnect con1;
+connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -33,9 +38,12 @@ t1 CREATE TABLE `t1` (
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
+disconnect con1;
+connection default;
DROP TABLE t1;
create table t1 (pk int primary key, i int) engine=aria;
insert into t1 values (1,1),(2,2);
+connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -46,6 +54,8 @@ t1 CREATE TABLE `t1` (
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
+disconnect con1;
+connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -56,6 +66,8 @@ t1 CREATE TABLE `t1` (
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
+disconnect con1;
+connect con1,localhost,root,,;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -66,4 +78,6 @@ t1 CREATE TABLE `t1` (
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
+disconnect con1;
+connection default;
DROP TABLE t1;
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index 3af64bbd0de..f2f06f9413a 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -1,3 +1,5 @@
+call mtr.add_suppression("Can't find record in '.*'");
+call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired");
drop table if exists t1,t2,t3;
SET SQL_WARNINGS=1;
CREATE TABLE t1 (
@@ -297,6 +299,7 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
+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',
@@ -314,7 +317,7 @@ KEY `poster_login` (`poster_login`),
KEY `topic_id` (`topic_id`),
FULLTEXT KEY `post_text` (`post_text`)
) ENGINE=MyISAM;
-INSERT 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');
+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;
Table Op Msg_type Msg_text
test.t1 repair status OK
@@ -523,11 +526,11 @@ a
explain select sql_big_result distinct t1.a from t1,t2 order by t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary
-1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index; Distinct
+1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index
explain select distinct t1.a from t1,t2 order by t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary
-1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index; Distinct
+1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index
drop table t1,t2;
create table t1 (
c1 varchar(32),
@@ -548,7 +551,10 @@ select straight_join * from t1,t2 force index (primary) where t1.a=t2.a;
a a b
1 1 1
2 2 1
+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;
a a b
1 1 1
@@ -563,7 +569,11 @@ 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;
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;
t1c1 t2c1
@@ -596,6 +606,10 @@ test.t2 3442722830
test.t3 NULL
Warnings:
Error 1146 Table 'test.t3' doesn't exist
+alter table t1 add d int default 30, add e bigint default 300000, add f decimal(30) default 442;
+checksum table t1;
+Table Checksum
+test.t1 2924214226
drop table t1,t2;
create table t1 (a int, key (a));
show keys from t1;
@@ -1097,8 +1111,8 @@ length(c1) c1
0
SELECT DISTINCT length(c1), c1 FROM t1 ORDER BY c1;
length(c1) c1
-0
2 A
+0
2 B
DROP TABLE t1;
End of 4.1 tests
@@ -1121,7 +1135,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text
+ `t` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t2 like t1;
show create table t2;
@@ -1129,7 +1143,7 @@ Table Create Table
t2 CREATE TABLE `t2` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text
+ `t` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t3 select * from t1;
show create table t3;
@@ -1137,7 +1151,7 @@ Table Create Table
t3 CREATE TABLE `t3` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text
+ `t` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify c varchar(10);
show create table t1;
@@ -1145,7 +1159,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL,
`c` varchar(10) DEFAULT NULL,
- `t` text
+ `t` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify v char(10);
show create table t1;
@@ -1153,7 +1167,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` char(10) DEFAULT NULL,
`c` varchar(10) DEFAULT NULL,
- `t` text
+ `t` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify t varchar(10);
Warnings:
@@ -1176,7 +1190,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text,
+ `t` text DEFAULT NULL,
KEY `v` (`v`),
KEY `c` (`c`),
KEY `t` (`t`(10))
@@ -1241,9 +1255,12 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where; Using index
alter table t1 add unique(v);
ERROR 23000: Duplicate entry '{ ' for key 'v_2'
+show warnings;
+Level Code Message
+Error 1062 Duplicate entry 'a' for key 'v_2'
alter table t1 add key(v);
Warnings:
-Note 1831 Duplicate index `v_2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `v_2`. This is deprecated and will be disallowed in a future release
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
qq
*a*a*a*
@@ -1397,7 +1414,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(300) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text,
+ `t` text DEFAULT NULL,
KEY `c` (`c`),
KEY `t` (`t`(10)),
KEY `v` (`v`)
@@ -1477,7 +1494,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(300) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text,
+ `t` text DEFAULT NULL,
KEY `c` (`c`),
KEY `t` (`t`(10)),
KEY `v` (`v`(30))
@@ -1557,7 +1574,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(600) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text,
+ `t` text DEFAULT NULL,
KEY `c` (`c`),
KEY `t` (`t`(10)),
KEY `v` (`v`)
@@ -1635,7 +1652,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
- `t` text,
+ `t` text DEFAULT NULL,
KEY `v` (`v`(5)),
KEY `c` (`c`(5)),
KEY `t` (`t`(5))
@@ -1680,31 +1697,34 @@ create table t1 (v varchar(65530), key(v));
Warnings:
Warning 1071 Specified key was too long; max key length is 1000 bytes
drop table if exists t1;
+set statement sql_mode = 'NO_ENGINE_SUBSTITUTION' for
create table t1 (v varchar(65536));
Warnings:
Note 1246 Converting column 'v' from VARCHAR to TEXT
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` mediumtext
+ `v` mediumtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+set statement sql_mode = 'NO_ENGINE_SUBSTITUTION' for
create table t1 (v varchar(65530) character set utf8);
Warnings:
Note 1246 Converting column 'v' from VARCHAR to TEXT
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` mediumtext CHARACTER SET utf8
+ `v` mediumtext CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+set statement sql_mode='' for
create table t1 (v varchar(65535));
Warnings:
Note 1246 Converting column 'v' from VARCHAR to TEXT
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `v` text
+ `v` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set storage_engine=MyISAM;
@@ -1713,12 +1733,17 @@ 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 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 into t1 values (8),(9);
+connection default;
unlock tables;
insert into t1 values (10),(11),(12);
select * from t1;
@@ -1737,15 +1762,21 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
+disconnect con1;
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 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 into t1 (a) values (8),(9);
+connection default;
unlock tables;
insert into t1 (a) values (10),(11),(12);
select a from t1;
@@ -1764,6 +1795,7 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
+disconnect con1;
set global concurrent_insert=@save_concurrent_insert;
create table t1 (a int, key(a));
insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
@@ -2450,8 +2482,8 @@ SET myisam_repair_threads=2;
SET myisam_sort_buffer_size=4096;
CREATE TABLE t1(a CHAR(255), KEY(a), KEY(a), KEY(a));
Warnings:
-Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `a_3`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `a_3`. This is deprecated and will be disallowed in a future release
INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(0),(1),(2),(3);
REPAIR TABLE t1;
Table Op Msg_type Msg_text
@@ -2546,6 +2578,14 @@ OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
DROP TABLE t1;
+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;
+insert into t1 values (8,'0');
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+unlock tables;
+drop table t1;
show variables like 'myisam_block_size';
Variable_name Value
myisam_block_size 1024
diff --git a/mysql-test/r/myisam_debug.result b/mysql-test/r/myisam_debug.result
index ca45ce1fc9f..6232e3eac0e 100644
--- a/mysql-test/r/myisam_debug.result
+++ b/mysql-test/r/myisam_debug.result
@@ -1,6 +1,7 @@
#
# BUG#40827 - Killing insert-select to MyISAM can cause table corruption
#
+CONNECT insertConn, localhost, root,,;
CREATE TABLE `t1` (
`id` BIGINT(20) ,
`id1` BIGINT(20) AUTO_INCREMENT,
@@ -12,11 +13,11 @@ CREATE TABLE `t2` (
KEY (id1), KEY(id)
) ENGINE=MyISAM;
INSERT INTO t2 (id) VALUES (123);
-# Switch to insert Connection
+connection insertConn;
SET SESSION debug_dbug='+d,wait_in_enable_indexes';
# Send insert data
INSERT INTO t1(id) SELECT id FROM t2;
-# Switch to default Connection
+connection default;
# Wait for insert data to reach the debug point
SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE STATE = 'wait_in_enable_indexes' AND
@@ -27,7 +28,8 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1,t2;
-call mtr.add_suppression('Incorrect key file for table');
+disconnect insertConn;
+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);
@@ -35,7 +37,7 @@ set @old_dbug=@@debug_dbug;
set debug_dbug='+d,mi_lock_database_failure';
unlock tables;
Warnings:
-Error 126 Incorrect key file for table './test/t1.MYI'; try to repair it
+Error 126 Index for table './test/t1.MYI' is corrupt; try to repair it
Error 1030 Got error 22 "Invalid argument" from storage engine MyISAM
set debug_dbug=@old_dbug;
drop table t1;
diff --git a/mysql-test/r/myisam_enable_keys-10506.result b/mysql-test/r/myisam_enable_keys-10506.result
index e7ffba787f0..77a5ba8a6ea 100644
--- a/mysql-test/r/myisam_enable_keys-10506.result
+++ b/mysql-test/r/myisam_enable_keys-10506.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("Can't find record in '.*'");
CREATE TABLE t1 (
pk INT AUTO_INCREMENT,
i INT,
diff --git a/mysql-test/r/myisam_explain_non_select_all.result b/mysql-test/r/myisam_explain_non_select_all.result
index fc0f54286a1..e60bb9a8d08 100644
--- a/mysql-test/r/myisam_explain_non_select_all.result
+++ b/mysql-test/r/myisam_explain_non_select_all.result
@@ -23,7 +23,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a < 10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` < 10)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 10
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -58,7 +58,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a < 10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` < 10)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 10
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -93,7 +93,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 1)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -133,7 +133,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` = 1)
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -175,7 +175,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t11 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` `t11` join `test`.`t2` where (`test`.`t11`.`a` = 1)
+Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` `t11` join `test`.`t2` where `test`.`t11`.`a` = 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -217,7 +217,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where (`test`.`t2`.`b` < 3)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` < 3
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -261,7 +261,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 3))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -307,7 +307,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` semi join (`test`.`t2`) join `test`.`t2` where ((`test`.`t2`.`b` < 3))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` semi join (`test`.`t2`) join `test`.`t2` where `test`.`t2`.`b` < 3
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -441,7 +441,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t11 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` `t11` join `test`.`t2` where (`test`.`t11`.`a` > 1)
+Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` `t11` join `test`.`t2` where `test`.`t11`.`a` > 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -476,7 +476,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > 1 LIMIT 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 1) limit 1
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1 limit 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -611,7 +611,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a < 3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 5 NULL 1 100.00 Using index condition
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a` < 3)
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` < 3
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -676,7 +676,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 0) order by `test`.`t1`.`a`
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 0 order by `test`.`t1`.`a`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -713,7 +713,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE (@a:= a) ORDER BY a LIMIT 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (@a:=`test`.`t1`.`a`) order by `test`.`t1`.`a` limit 1
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where @a:=`test`.`t1`.`a` order by `test`.`t1`.`a` limit 1
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -800,7 +800,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 100.00 Using index
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.t2.b2,test.t1.b1 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`b3` AS `b3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where ((`test`.`t2`.`a2` = `test`.`t1`.`a1`) and (`test`.`t3`.`a3` = `test`.`t2`.`b2`) and (`test`.`t3`.`b3` = `test`.`t1`.`b1`))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`b3` AS `b3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a2` = `test`.`t1`.`a1` and `test`.`t3`.`a3` = `test`.`t2`.`b2` and `test`.`t3`.`b3` = `test`.`t1`.`b1`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -888,7 +888,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t1`.`a1`,<exists>(select `test`.`t2`.`a2` from `test`.`t2` where ((`test`.`t2`.`a2` > 2) and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`a2`)))))
+Note 1003 select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t1`.`a1`,<exists>(select `test`.`t2`.`a2` from `test`.`t2` where `test`.`t2`.`a2` > 2 and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`a2`)))
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -926,7 +926,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`a2` > 2) and (`test`.`t1`.`a1` = `test`.`t2`.`a2`))
+Note 1003 select `test`.`t1`.`a1` AS `a1` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`a2` > 2 and `test`.`t1`.`a1` = `test`.`t2`.`a2`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -1034,7 +1034,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -1187,7 +1187,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 8 100.00 Using index condition
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where ((`test`.`t1`.`i` > 10) and (`test`.`t1`.`i` <= 18)) order by `test`.`t1`.`i` limit 5
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -1226,7 +1226,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL i NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where ((`test`.`t1`.`i` > 10) and (`test`.`t1`.`i` <= 18)) order by `test`.`t1`.`i` limit 5
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -1271,7 +1271,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -1317,7 +1317,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -1358,7 +1358,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -1404,7 +1404,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -1451,7 +1451,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index_merge key1,key2 key1,key2 5,5 NULL 7 100.00 Using sort_union(key1,key2); Using where; Using filesort
Warnings:
-Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`key1` AS `key1`,`test`.`t2`.`key2` AS `key2` from `test`.`t2` where ((`test`.`t2`.`key1` < 13) or (`test`.`t2`.`key2` < 14)) order by `test`.`t2`.`key1`
+Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`key1` AS `key1`,`test`.`t2`.`key2` AS `key2` from `test`.`t2` where `test`.`t2`.`key1` < 13 or `test`.`t2`.`key2` < 14 order by `test`.`t2`.`key1`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -1498,7 +1498,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where ((`test`.`t2`.`i` > 10) and (`test`.`t2`.`i` <= 18)) order by `test`.`t2`.`i` desc limit 5
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` desc limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -1626,7 +1626,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 100.00 Using index condition
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where ((`test`.`t2`.`i` > 10) and (`test`.`t2`.`i` <= 18)) order by `test`.`t2`.`i` limit 5
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -1668,7 +1668,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL i NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where ((`test`.`t2`.`i` > 10) and (`test`.`t2`.`i` <= 18)) order by `test`.`t2`.`i` limit 5
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -1714,7 +1714,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -1761,7 +1761,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -1803,7 +1803,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -1849,7 +1849,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where (`test`.`t2`.`b` = 10) order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -1896,7 +1896,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index_merge key1,key2 key1,key2 5,5 NULL 7 100.00 Using sort_union(key1,key2); Using where; Using filesort
Warnings:
-Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`key1` AS `key1`,`test`.`t2`.`key2` AS `key2` from `test`.`t2` where ((`test`.`t2`.`key1` < 13) or (`test`.`t2`.`key2` < 14)) order by `test`.`t2`.`key1`
+Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`key1` AS `key1`,`test`.`t2`.`key2` AS `key2` from `test`.`t2` where `test`.`t2`.`key1` < 13 or `test`.`t2`.`key2` < 14 order by `test`.`t2`.`key1`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -1943,7 +1943,7 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC L
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where ((`test`.`t2`.`i` > 10) and (`test`.`t2`.`i` <= 18)) order by `test`.`t2`.`i` desc limit 5
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` desc limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -2076,7 +2076,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ref c1_idx c1_idx 2 const 2 100.00 Using index condition; Using where; Using filesort
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1_idx` AS `c1_idx`,`test`.`t1`.`c2` AS `c2` from `test`.`t1` where (`test`.`t1`.`c1_idx` = 'y') order by `test`.`t1`.`pk` desc limit 2
+Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1_idx` AS `c1_idx`,`test`.`t1`.`c2` AS `c2` from `test`.`t1` where `test`.`t1`.`c1_idx` = 'y' order by `test`.`t1`.`pk` desc limit 2
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -2116,7 +2116,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ref c1_idx c1_idx 2 const 2 100.00 Using index condition; Using where; Using filesort
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1_idx` AS `c1_idx`,`test`.`t1`.`c2` AS `c2` from `test`.`t1` where (`test`.`t1`.`c1_idx` = 'y') order by `test`.`t1`.`pk` desc limit 2
+Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1_idx` AS `c1_idx`,`test`.`t1`.`c2` AS `c2` from `test`.`t1` where `test`.`t1`.`c1_idx` = 'y' order by `test`.`t1`.`pk` desc limit 2
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -2159,7 +2159,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > 34;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 34)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 34
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -2237,7 +2237,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1` where (`test`.`t1`.`c3` = 10)
+Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1` where `test`.`t1`.`c3` = 10
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
Handler_read_rnd_next 1
@@ -2281,7 +2281,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ALL IDX NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.f1' of SELECT #2 was resolved in SELECT #1
-Note 1003 select <expr_cache><`test`.`t1`.`f1`>((select max(`test`.`t2`.`f4`) from `test`.`t2` where (`test`.`t2`.`f3` = `test`.`t1`.`f1`))) AS `(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1)` from `test`.`t1`
+Note 1003 select <expr_cache><`test`.`t1`.`f1`>((select max(`test`.`t2`.`f4`) from `test`.`t2` where `test`.`t2`.`f3` = `test`.`t1`.`f1`)) AS `(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1)` from `test`.`t1`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -2344,7 +2344,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t11 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t12 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t12`.`a` AS `b` from `test`.`t1` `t11` join `test`.`t1` `t12` where (`test`.`t11`.`a` > 0)
+Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t12`.`a` AS `b` from `test`.`t1` `t11` join `test`.`t1` `t12` where `test`.`t11`.`a` > 0
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -2382,7 +2382,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t11 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t12 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t11`.`a` AS `a`,`test`.`t12`.`a` AS `b` from `test`.`t1` join `test`.`t1` `t11` join `test`.`t1` `t12` where (`test`.`t11`.`a` = `test`.`t1`.`a`)
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t11`.`a` AS `a`,`test`.`t12`.`a` AS `b` from `test`.`t1` join `test`.`t1` `t11` join `test`.`t1` `t12` where `test`.`t11`.`a` = `test`.`t1`.`a`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -2421,7 +2421,7 @@ EXPLAIN EXTENDED SELECT * FROM v1 WHERE a < 4;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` < 4)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 4
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -2465,7 +2465,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using where
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00
Warnings:
-Note 1003 select `test`.`t2`.`x` AS `x`,`test`.`t1`.`a` AS `a`,(`test`.`t1`.`b` + 1) AS `c` from `test`.`t2` join `test`.`t1` where (`test`.`t1`.`a` = `test`.`t2`.`x`)
+Note 1003 select `test`.`t2`.`x` AS `x`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` + 1 AS `c` from `test`.`t2` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`x`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -2510,7 +2510,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using where
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00
Warnings:
-Note 1003 select `test`.`t2`.`x` AS `x`,`test`.`t1`.`a` AS `a`,(`test`.`t1`.`b` + 1) AS `c` from `test`.`t2` join `test`.`t1` where (`test`.`t1`.`a` = `test`.`t2`.`x`)
+Note 1003 select `test`.`t2`.`x` AS `x`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` + 1 AS `c` from `test`.`t2` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`x`
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -2808,7 +2808,7 @@ EXPLAIN EXTENDED SELECT a t1 FROM t1 WHERE a>10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 5 20.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `t1` from `test`.`t1` where (`test`.`t1`.`a` > 10)
+Note 1003 select `test`.`t1`.`a` AS `t1` from `test`.`t1` where `test`.`t1`.`a` > 10
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
@@ -2840,7 +2840,7 @@ EXPLAIN EXTENDED SELECT a t1 FROM t1 WHERE a>10 ORDER BY a+20;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 5 20.00 Using where; Using index; Using filesort
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `t1` from `test`.`t1` where (`test`.`t1`.`a` > 10) order by (`test`.`t1`.`a` + 20)
+Note 1003 select `test`.`t1`.`a` AS `t1` from `test`.`t1` where `test`.`t1`.`a` > 10 order by `test`.`t1`.`a` + 20
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
# Status of "equivalent" SELECT query execution:
diff --git a/mysql-test/r/myisam_icp.result b/mysql-test/r/myisam_icp.result
index 3c45117616c..6a70521cd72 100644
--- a/mysql-test/r/myisam_icp.result
+++ b/mysql-test/r/myisam_icp.result
@@ -472,7 +472,7 @@ CREATE TABLE t2 (
t2_int int PRIMARY KEY,
t2_int2 INT
);
-INSERT INTO t2 VALUES ();
+INSERT IGNORE INTO t2 VALUES ();
INSERT INTO t1 VALUES ();
SELECT * FROM t1 AS t1a
WHERE NOT EXISTS (SELECT * FROM t1 AS t1b
@@ -566,7 +566,7 @@ COL1000 VARBINARY(179) NOT NULL,
col1003 DATE DEFAULT NULL,
KEY idx4267 (col1000, col1003)
);
-INSERT INTO t1 VALUES (),();
+INSERT IGNORE INTO t1 VALUES (),();
Warnings:
Warning 1364 Field 'col999' doesn't have a default value
Warning 1364 Field 'COL1000' doesn't have a default value
@@ -720,8 +720,8 @@ b INT, c INT, d DATE NOT NULL, e VARCHAR(1),
KEY (c), KEY (d), KEY k2(b), KEY k3(b), KEY k4(b)
);
Warnings:
-Note 1831 Duplicate index `k3`. This is deprecated and will be disallowed in a future release.
-Note 1831 Duplicate index `k4`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `k3`. This is deprecated and will be disallowed in a future release
+Note 1831 Duplicate index `k4`. This is deprecated and will be disallowed in a future release
INSERT INTO t1 (b,c,d,e) VALUES
(6,5,'2006-05-25','y'),(1,5,'2008-01-23','t'),
(6,5,'2007-06-18','d'),(4,5,'1900-01-01','r'),
@@ -847,7 +847,7 @@ Handler_icp_attempts 2
Handler_icp_match 1
DROP TABLE t1;
create table t1 (a int,b char(5),primary key (a), key (b(1)));
-insert into t1 values ('a','b');
+insert ignore into t1 values ('a','b');
Warnings:
Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1
select 1 from t1 where a and b >= 'aa';
diff --git a/mysql-test/r/myisam_icp_notembedded.result b/mysql-test/r/myisam_icp_notembedded.result
index d965cbd980d..789259d62f1 100644
--- a/mysql-test/r/myisam_icp_notembedded.result
+++ b/mysql-test/r/myisam_icp_notembedded.result
@@ -14,6 +14,9 @@ KEY (c, b)
CREATE TABLE t2 ( a INT ) ENGINE=MyISAM;
INSERT INTO t2 VALUES
(7),(3),(7),(3);
+connect con2,127.0.0.1,root,,test;
# Now run a number of ICP queries while trying to kill them
+disconnect con2;
+connection default;
DROP TABLE t1,t2;
set optimizer_switch=@myisam_icp_notembedded_tmp;
diff --git a/mysql-test/r/myisam_optimize.result b/mysql-test/r/myisam_optimize.result
index 36faba5eaa9..f71d524fadb 100644
--- a/mysql-test/r/myisam_optimize.result
+++ b/mysql-test/r/myisam_optimize.result
@@ -13,13 +13,20 @@ CCCCCCCCCC 3
CCCCCCCCCC 4
set debug_sync='myisam_before_repair_by_sort wait_for go';
optimize table t1;
+connect con1,localhost,root,,;
select a, left(b,10) from t1 order by a;
+connect con2,localhost,root,,;
set debug_sync='now signal go';
+connection default;
Table Op Msg_type Msg_text
test.t1 optimize status OK
+connection con1;
a left(b,10)
3 CCCCCCCCCC
4 CCCCCCCCCC
+disconnect con1;
+disconnect con2;
+connection default;
drop table t1;
set debug_sync='reset';
# End of 5.5 tests
diff --git a/mysql-test/r/myisam_recover.result b/mysql-test/r/myisam_recover.result
index 6ae282cb2b6..1af3dbf9ad5 100644
--- a/mysql-test/r/myisam_recover.result
+++ b/mysql-test/r/myisam_recover.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired");
#
# Tests for corrupted MyISAM tables and MyISAMMRG tables with corrupted
# children..
@@ -9,9 +10,8 @@
# have effect on merge children.
# For that, we set the table cache to minimal size and populate it
# in a concurrent connection.
-#
-# Switching to connection con1
-#
+connect con1,localhost,root,,test,,;
+connection con1;
#
# Minimal values.
#
@@ -43,9 +43,7 @@ end while;
end|
call p_create();
drop procedure p_create;
-#
-# Switching to connection 'default'
-#
+connection default;
#
# We have to disable the ps-protocol, to avoid
# "Prepared statement needs to be re-prepared" errors
@@ -95,21 +93,22 @@ Error 1034 Number of rows changed from 3 to 6
# Cleanup
#
drop table t1, t1_mrg;
-#
-# Switching to connection con1
-#
+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=@save_table_open_cache;
+disconnect con1;
+connection default;
#
# 18075170 - sql node restart required to avoid deadlock after
# restore
#
# Check that auto-repair for MyISAM tables can now happen in the
# middle of transaction, without aborting it.
+connection default;
create table t1 (a int, key(a)) engine=myisam;
create table t2 (a int);
insert into t2 values (1);
@@ -143,9 +142,14 @@ Warnings:
Error 145 Table 't1' is marked as crashed and should be repaired
Error 1194 Table 't1' is marked as crashed and should be repaired
Error 1034 Number of rows changed from 1 to 2
+connect con2, localhost, root;
ALTER TABLE t2 ADD val INT;
+connection default;
# With fix we should have alter table waiting for t2 lock here.
ROLLBACK;
SET autocommit = 1;
+connection con2;
+connection default;
+disconnect con2;
# Cleanup
drop table t1, t2;
diff --git a/mysql-test/r/mysql-bug41486.result b/mysql-test/r/mysql-bug41486.result
index 62a6712eae1..d5760dcb1b9 100644
--- a/mysql-test/r/mysql-bug41486.result
+++ b/mysql-test/r/mysql-bug41486.result
@@ -1,6 +1,7 @@
DROP TABLE IF EXISTS t1;
SET @old_max_allowed_packet= @@global.max_allowed_packet;
SET @@global.max_allowed_packet = 2 * 1024 * 1024 + 1024;
+connect con1, localhost, root,,;
CREATE TABLE t1(data LONGBLOB);
INSERT INTO t1 SELECT REPEAT('1', 2*1024*1024);
SELECT COUNT(*) FROM t1;
@@ -13,4 +14,6 @@ SELECT LENGTH(data) FROM t1;
LENGTH(data)
2097152
DROP TABLE t1;
+disconnect con1;
+connection default;
SET @@global.max_allowed_packet = @old_max_allowed_packet;
diff --git a/mysql-test/r/mysql-bug45236.result b/mysql-test/r/mysql-bug45236.result
index cefcb1d314c..c1e41d62b63 100644
--- a/mysql-test/r/mysql-bug45236.result
+++ b/mysql-test/r/mysql-bug45236.result
@@ -1,8 +1,11 @@
DROP TABLE IF EXISTS t1;
SET @old_max_allowed_packet= @@global.max_allowed_packet;
SET @@global.max_allowed_packet = 1024 * 1024 + 1024;
+connect con1, localhost, root,,;
CREATE TABLE t1(data LONGBLOB);
INSERT INTO t1 SELECT CONCAT(REPEAT('1', 1024*1024 - 27),
"\'\r dummydb dummyhost");
DROP TABLE t1;
+disconnect con1;
+connection default;
SET @@global.max_allowed_packet = @old_max_allowed_packet;
diff --git a/mysql-test/r/mysql5613mysql.result b/mysql-test/r/mysql5613mysql.result
index 501c723f711..183af7211d3 100644
--- a/mysql-test/r/mysql5613mysql.result
+++ b/mysql-test/r/mysql5613mysql.result
@@ -10,7 +10,7 @@ columns_priv CREATE TABLE `columns_priv` (
`User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
`Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
- `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges'
@@ -58,7 +58,7 @@ event CREATE TABLE `event` (
`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,
+ `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,
@@ -72,7 +72,7 @@ event CREATE TABLE `event` (
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
- `body_utf8` longblob,
+ `body_utf8` longblob DEFAULT NULL,
PRIMARY KEY (`db`,`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'
SELECT * FROM event LIMIT 0;
@@ -82,7 +82,7 @@ SHOW CREATE TABLE func;
Table Create Table
func CREATE TABLE `func` (
`name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
- `ret` tinyint(1) NOT NULL DEFAULT '0',
+ `ret` tinyint(1) NOT NULL DEFAULT 0,
`dl` char(128) COLLATE utf8_bin NOT NULL DEFAULT '',
`type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`name`)
@@ -112,17 +112,17 @@ proc CREATE TABLE `proc` (
`is_deterministic` enum('YES','NO') NOT NULL DEFAULT 'NO',
`security_type` enum('INVOKER','DEFINER') NOT NULL DEFAULT 'DEFINER',
`param_list` blob NOT NULL,
- `returns` longblob NOT NULL,
+ `returns` longblob NOT NULL DEFAULT '',
`body` longblob NOT NULL,
`definer` char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
- `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `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','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
`comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
- `body_utf8` longblob,
+ `body_utf8` longblob DEFAULT NULL,
PRIMARY KEY (`db`,`name`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures'
SELECT * FROM proc LIMIT 0;
@@ -138,7 +138,7 @@ procs_priv CREATE TABLE `procs_priv` (
`Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL,
`Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
`Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '',
- `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`),
KEY `Grantor` (`Grantor`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges'
@@ -152,9 +152,9 @@ proxies_priv CREATE TABLE `proxies_priv` (
`User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
`Proxied_host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
`Proxied_user` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
- `With_grant` tinyint(1) NOT NULL DEFAULT '0',
+ `With_grant` tinyint(1) NOT NULL DEFAULT 0,
`Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
- `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`),
KEY `Grantor` (`Grantor`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User proxy privileges'
@@ -169,7 +169,7 @@ servers CREATE TABLE `servers` (
`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',
+ `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 '',
@@ -186,7 +186,7 @@ tables_priv CREATE TABLE `tables_priv` (
`User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
`Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
- `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '',
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
@@ -241,8 +241,8 @@ Table Create Table
time_zone_transition_type CREATE TABLE `time_zone_transition_type` (
`Time_zone_id` int(10) unsigned NOT NULL,
`Transition_type_id` int(10) unsigned NOT NULL,
- `Offset` int(11) NOT NULL DEFAULT '0',
- `Is_DST` tinyint(3) unsigned NOT NULL DEFAULT '0',
+ `Offset` int(11) NOT NULL DEFAULT 0,
+ `Is_DST` tinyint(3) unsigned NOT NULL DEFAULT 0,
`Abbreviation` char(8) NOT NULL DEFAULT '',
PRIMARY KEY (`Time_zone_id`,`Transition_type_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zone transition types'
@@ -288,12 +288,12 @@ user CREATE TABLE `user` (
`ssl_cipher` blob NOT NULL,
`x509_issuer` blob NOT NULL,
`x509_subject` blob NOT NULL,
- `max_questions` int(11) unsigned NOT NULL DEFAULT '0',
- `max_updates` int(11) unsigned NOT NULL DEFAULT '0',
- `max_connections` int(11) unsigned NOT NULL DEFAULT '0',
- `max_user_connections` int(11) unsigned NOT NULL DEFAULT '0',
+ `max_questions` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_updates` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_connections` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_user_connections` int(11) unsigned NOT NULL DEFAULT 0,
`plugin` char(64) COLLATE utf8_bin DEFAULT '',
- `authentication_string` text COLLATE utf8_bin,
+ `authentication_string` text COLLATE utf8_bin DEFAULT NULL,
`password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
PRIMARY KEY (`Host`,`User`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
diff --git a/mysql-test/r/mysql57_virtual.result b/mysql-test/r/mysql57_virtual.result
new file mode 100644
index 00000000000..8186aa7cdec
--- /dev/null
+++ b/mysql-test/r/mysql57_virtual.result
@@ -0,0 +1,38 @@
+#
+# Test that we can use tables created in MySQL 5.7
+#
+SHOW CREATE TABLE mysql57_virtual;
+Table Create Table
+mysql57_virtual CREATE TABLE `mysql57_virtual` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL,
+ `c` int(11) GENERATED ALWAYS AS (`a` + 3) STORED
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into mysql57_virtual (a) values (1),(2);
+select * from mysql57_virtual;
+a b c
+1 2 4
+2 3 5
+alter online table mysql57_virtual comment "I am now a MariaDB table";
+ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED
+alter table mysql57_virtual comment "I am now a MariaDB table";
+SHOW CREATE TABLE mysql57_virtual;
+Table Create Table
+mysql57_virtual CREATE TABLE `mysql57_virtual` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) GENERATED ALWAYS AS (`a` + 1) VIRTUAL,
+ `c` int(11) GENERATED ALWAYS AS (`a` + 3) STORED
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='I am now a MariaDB table'
+DROP TABLE mysql57_virtual;
+#
+# Check MySQL 5.7 syntax
+#
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) GENERATED ALWAYS AS (`a` + 1) STORED,
+ `c` int(11) GENERATED ALWAYS AS (`a` + 2) VIRTUAL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/r/mysql_comments.result b/mysql-test/r/mysql_comments.result
index 4865c7a7af0..9ba8dff3d55 100644
--- a/mysql-test/r/mysql_comments.result
+++ b/mysql-test/r/mysql_comments.result
@@ -27,10 +27,10 @@ Procedure sql_mode Create Procedure character_set_client collation_connection Da
foosp CREATE DEFINER=`root`@`localhost` PROCEDURE `foosp`()\ninsert into test.t1\n\n\n\n\n \n\n \n values ("foo", 42) latin1 latin1_swedish_ci latin1_swedish_ci
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
nicesp CREATE DEFINER=`root`@`localhost` PROCEDURE `nicesp`(a int)\nbegin\n \n declare b int;\n declare c float;\n\n \n \n\n \nend latin1 latin1_swedish_ci latin1_swedish_ci
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_empty CREATE DEFINER=`root`@`localhost` trigger t1_empty after delete on t1\nfor each row\nbegin\nend latin1 latin1_swedish_ci latin1_swedish_ci
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1\nfor each row\nbegin\n\n\n\n \n declare b int;\n declare c float;\n\n \n \n\n \n set NEW.data := 12;\nend latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_empty CREATE DEFINER=`root`@`localhost` trigger t1_empty after delete on t1\nfor each row\nbegin\nend latin1 latin1_swedish_ci latin1_swedish_ci --TIME--
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1\nfor each row\nbegin\n\n\n\n \n declare b int;\n declare c float;\n\n \n \n\n \n set NEW.data := 12;\nend latin1 latin1_swedish_ci latin1_swedish_ci --TIME--
id data
trig 12
"Pass 2 : --enable-comments"
@@ -54,10 +54,10 @@ Procedure sql_mode Create Procedure character_set_client collation_connection Da
foosp CREATE DEFINER=`root`@`localhost` PROCEDURE `foosp`()\ninsert into test.t1\n## These comments are part of the procedure body, and should be kept.\n# Comment 2a\n-- Comment 2b\n/* Comment 2c */\n -- empty line below\n\n -- empty line above\n values ("foo", 42) # comment 3, still part of the body latin1 latin1_swedish_ci latin1_swedish_ci
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
nicesp CREATE DEFINER=`root`@`localhost` PROCEDURE `nicesp`(a int)\nbegin\n -- declare some variables here\n declare b int;\n declare c float;\n\n -- do more stuff here\n -- commented nicely and so on\n\n -- famous last words ...\nend latin1 latin1_swedish_ci latin1_swedish_ci
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_empty CREATE DEFINER=`root`@`localhost` trigger t1_empty after delete on t1\nfor each row\nbegin\nend latin1 latin1_swedish_ci latin1_swedish_ci
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1\nfor each row\nbegin\n# comment 1a\n-- comment 1b\n/*\n comment 1c\n*/\n -- declare some variables here\n declare b int;\n declare c float;\n\n -- do more stuff here\n -- commented nicely and so on\n\n -- famous last words ...\n set NEW.data := 12;\nend latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_empty CREATE DEFINER=`root`@`localhost` trigger t1_empty after delete on t1\nfor each row\nbegin\nend latin1 latin1_swedish_ci latin1_swedish_ci --TIME--
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1\nfor each row\nbegin\n# comment 1a\n-- comment 1b\n/*\n comment 1c\n*/\n -- declare some variables here\n declare b int;\n declare c float;\n\n -- do more stuff here\n -- commented nicely and so on\n\n -- famous last words ...\n set NEW.data := 12;\nend latin1 latin1_swedish_ci latin1_swedish_ci --TIME--
id data
trig 12
set global sql_mode=default;
diff --git a/mysql-test/r/mysql_upgrade-6984.result b/mysql-test/r/mysql_upgrade-6984.result
index dacea61d094..59c9a865b7c 100644
--- a/mysql-test/r/mysql_upgrade-6984.result
+++ b/mysql-test/r/mysql_upgrade-6984.result
@@ -56,6 +56,7 @@ performance_schema
test
Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
+connect con1,localhost,root,foo,,,;
update mysql.user set password='' where user='root';
flush privileges;
set global event_scheduler=OFF;
diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result
index 69637f4078f..a6a5da8f8c8 100644
--- a/mysql-test/r/mysql_upgrade.result
+++ b/mysql-test/r/mysql_upgrade.result
@@ -412,6 +412,7 @@ FATAL ERROR: Upgrade failed
# MDEV-4332 Increase username length from 16 characters
# MDEV-6068, MDEV-6178 mysql_upgrade breaks databases with long user names
#
+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;
@@ -475,7 +476,7 @@ even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@loca
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;
use test;
-call mtr.add_suppression('Column last_update in table "mysql"."innodb_table_stats" is INT NOT NULL but should be');
+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,
diff --git a/mysql-test/r/mysqlbinlog-innodb.result b/mysql-test/r/mysqlbinlog-innodb.result
index 2704be9e3ed..2971a69fb4d 100644
--- a/mysql-test/r/mysqlbinlog-innodb.result
+++ b/mysql-test/r/mysqlbinlog-innodb.result
@@ -29,8 +29,8 @@ BEGIN
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=1342177280/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
@@ -60,8 +60,8 @@ BEGIN
use `foo`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=1342177280/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 8463c3074a0..bac33753d4c 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -22,8 +22,8 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=1342177280/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
@@ -102,8 +102,8 @@ BEGIN
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=1342177280/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
@@ -138,8 +138,8 @@ BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=1342177280/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
@@ -189,8 +189,8 @@ BEGIN
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=1342177280/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
@@ -216,8 +216,8 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=1342177280/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
@@ -296,8 +296,8 @@ BEGIN
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=1342177280/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
@@ -332,8 +332,8 @@ BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=1342177280/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
@@ -383,8 +383,8 @@ BEGIN
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=1342177280/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
@@ -492,8 +492,8 @@ DELIMITER /*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=1342177280/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
@@ -544,8 +544,8 @@ DELIMITER /*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=1342177280/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
@@ -639,6 +639,10 @@ CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(connection_id());
FLUSH LOGS;
DROP TABLE t1;
+connect con1, localhost, root, , test;
+connection con1;
+disconnect con1;
+connection default;
1
DROP TABLE t1;
shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql
@@ -658,15 +662,19 @@ flush logs;
INSERT INTO t1 VALUES (1,USER());
flush logs;
mysqlbinlog var/log/master-bin.000018 > var/tmp/bug31611.sql
+connect unsecure,localhost,untrusted,,mysqltest1;
mysql mysqltest1 -uuntrusted < var/tmp/bug31611.sql
+connection unsecure;
INSERT INTO t1 VALUES (1,USER());
ERROR 42000: INSERT command denied to user 'untrusted'@'localhost' for table 't1'
SELECT * FROM t1;
a b
1 root@localhost
+connection default;
DROP DATABASE mysqltest1;
DROP USER untrusted@localhost;
Bug#32580 mysqlbinlog cannot read binlog event with user variables
+connection default;
USE test;
SET BINLOG_FORMAT = STATEMENT;
FLUSH LOGS;
@@ -716,7 +724,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1253783037/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=0/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -770,7 +778,7 @@ DELIMITER /*!*/;
ROLLBACK/*!*/;
SET TIMESTAMP=1253783037/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=0/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -805,7 +813,7 @@ ROLLBACK /* added by mysqlbinlog */;
DELIMITER /*!*/;
SET TIMESTAMP=1266652094/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=0/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -847,7 +855,7 @@ ROLLBACK /* added by mysqlbinlog */;
DELIMITER /*!*/;
SET TIMESTAMP=1266652094/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=0/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -956,7 +964,7 @@ AAAAAAAAAAAAAAAAAAAgrgJSFzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
# Event: Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1375907364/*!*/;
SET @@session.pseudo_thread_id=1/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=0/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -1039,7 +1047,7 @@ AAAAAAAAAAAAAAAAAAA/rQJSGzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
# Event: Query thread_id=1 exec_time=1 error_code=0
SET TIMESTAMP=1375907141/*!*/;
SET @@session.pseudo_thread_id=1/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=0/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -1122,7 +1130,7 @@ AAAAAAAAAAAAAAAAAAAnrAJSHzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
# Event: Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1375906879/*!*/;
SET @@session.pseudo_thread_id=1/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=0/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -1205,7 +1213,7 @@ AAAAAAAAAAAAAAAAAABbsAJSEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
# Event: Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1375907933/*!*/;
SET @@session.pseudo_thread_id=1/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=0/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
diff --git a/mysql-test/r/mysqlbinlog_row_big.result b/mysql-test/r/mysqlbinlog_row_big.result
index 70e39266d1d..a90ba9d79b6 100644
--- a/mysql-test/r/mysqlbinlog_row_big.result
+++ b/mysql-test/r/mysqlbinlog_row_big.result
@@ -17,9 +17,8 @@ In order for the preceding change in max_allowed_packets' value
to be seen and used, we must start a new connection.
The change does not take effect with the current one.
For simplicity, we just disconnect / reconnect connection default here.
-Disconnecting default connection...
-Reconnecting default connection...
-default connection established, continuing with the test
+disconnect default;
+connect default, localhost,root,,;
#
# Delete all existing binary logs.
#
@@ -97,6 +96,6 @@ FLUSH LOGS;
# Cleanup.
#
# reset variable value to pass testcase checks
-SET @@global.max_allowed_packet = 4194304;
+SET @@global.max_allowed_packet = 16777216;
DROP TABLE t1;
remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_big_1.out
diff --git a/mysql-test/r/mysqlbinlog_row_compressed.result b/mysql-test/r/mysqlbinlog_row_compressed.result
new file mode 100644
index 00000000000..24fff723ec8
--- /dev/null
+++ b/mysql-test/r/mysqlbinlog_row_compressed.result
@@ -0,0 +1,477 @@
+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;
+FLUSH BINARY LOGS;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+# at 4
+#<date> server id 1 end_log_pos 256 CRC32 XXX Start: xxx
+ROLLBACK/*!*/;
+# at 256
+#<date> server id 1 end_log_pos 285 CRC32 XXX Gtid list []
+# at 285
+#<date> server id 1 end_log_pos 329 CRC32 XXX Binlog checkpoint master-bin.000001
+# at 329
+#<date> server id 1 end_log_pos 371 CRC32 XXX GTID 0-1-1 ddl
+/*!100101 SET @@session.skip_parallel_replication=0*//*!*/;
+/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
+/*!100001 SET @@session.server_id=1*//*!*/;
+/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
+# at 371
+#<date> server id 1 end_log_pos 533 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
+use `test`/*!*/;
+SET TIMESTAMP=X/*!*/;
+SET @@session.pseudo_thread_id=5/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1))
+/*!*/;
+# at 533
+#<date> server id 1 end_log_pos 575 CRC32 XXX GTID 0-1-2 ddl
+/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
+# at 575
+#<date> server id 1 end_log_pos 727 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1))
+/*!*/;
+# at 727
+#<date> server id 1 end_log_pos 769 CRC32 XXX GTID 0-1-3
+/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
+BEGIN
+/*!*/;
+# at 769
+# at 843
+#<date> server id 1 end_log_pos 843 CRC32 XXX Annotate_rows:
+#Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "")
+#<date> server id 1 end_log_pos 899 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 899
+#<date> server id 1 end_log_pos 967 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F
+### INSERT INTO `test`.`t1`
+### SET
+### @1=10 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @5=4 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+# at 967
+#<date> server id 1 end_log_pos 1040 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 1040
+#<date> server id 1 end_log_pos 1082 CRC32 XXX GTID 0-1-4
+/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
+BEGIN
+/*!*/;
+# at 1082
+# at 1158
+#<date> server id 1 end_log_pos 1158 CRC32 XXX Annotate_rows:
+#Q> INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL)
+#<date> server id 1 end_log_pos 1214 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 1214
+#<date> server id 1 end_log_pos 1281 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F
+### INSERT INTO `test`.`t1`
+### SET
+### @1=11 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @5=4 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
+# at 1281
+#<date> server id 1 end_log_pos 1354 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 1354
+#<date> server id 1 end_log_pos 1396 CRC32 XXX GTID 0-1-5
+/*!100001 SET @@session.gtid_seq_no=5*//*!*/;
+BEGIN
+/*!*/;
+# at 1396
+# at 1474
+#<date> server id 1 end_log_pos 1474 CRC32 XXX Annotate_rows:
+#Q> INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A")
+#<date> server id 1 end_log_pos 1530 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 1530
+#<date> server id 1 end_log_pos 1596 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F
+### INSERT INTO `test`.`t1`
+### SET
+### @1=12 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @5=NULL /* MEDIUMINT meta=0 nullable=1 is_null=1 */
+### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+# at 1596
+#<date> server id 1 end_log_pos 1669 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 1669
+#<date> server id 1 end_log_pos 1711 CRC32 XXX GTID 0-1-6
+/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
+BEGIN
+/*!*/;
+# at 1711
+# at 1786
+#<date> server id 1 end_log_pos 1786 CRC32 XXX Annotate_rows:
+#Q> INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A")
+#<date> server id 1 end_log_pos 1842 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 1842
+#<date> server id 1 end_log_pos 1909 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F
+### INSERT INTO `test`.`t1`
+### SET
+### @1=13 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @5=0 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+# at 1909
+#<date> server id 1 end_log_pos 1982 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 1982
+#<date> server id 1 end_log_pos 2024 CRC32 XXX GTID 0-1-7
+/*!100001 SET @@session.gtid_seq_no=7*//*!*/;
+BEGIN
+/*!*/;
+# at 2024
+# at 2078
+#<date> server id 1 end_log_pos 2078 CRC32 XXX Annotate_rows:
+#Q> INSERT INTO t2 SELECT * FROM t1
+#<date> server id 1 end_log_pos 2134 CRC32 XXX Table_map: `test`.`t2` mapped to number num
+# at 2134
+#<date> server id 1 end_log_pos 2225 CRC32 XXX Write_compressed_rows: table id 31 flags: STMT_END_F
+### INSERT INTO `test`.`t2`
+### SET
+### @1=10 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=4 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### INSERT INTO `test`.`t2`
+### SET
+### @1=11 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=4 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
+### INSERT INTO `test`.`t2`
+### SET
+### @1=12 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=NULL /* INT meta=0 nullable=1 is_null=1 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### INSERT INTO `test`.`t2`
+### SET
+### @1=13 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=0 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+# at 2225
+#<date> server id 1 end_log_pos 2298 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 2298
+#<date> server id 1 end_log_pos 2340 CRC32 XXX GTID 0-1-8
+/*!100001 SET @@session.gtid_seq_no=8*//*!*/;
+BEGIN
+/*!*/;
+# at 2340
+# at 2406
+#<date> server id 1 end_log_pos 2406 CRC32 XXX Annotate_rows:
+#Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL
+#<date> server id 1 end_log_pos 2462 CRC32 XXX Table_map: `test`.`t2` mapped to number num
+# at 2462
+#<date> server id 1 end_log_pos 2561 CRC32 XXX Update_compressed_rows: table id 31 flags: STMT_END_F
+### UPDATE `test`.`t2`
+### WHERE
+### @1=10 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=4 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### SET
+### @1=10 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### UPDATE `test`.`t2`
+### WHERE
+### @1=11 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=4 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
+### SET
+### @1=11 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
+### UPDATE `test`.`t2`
+### WHERE
+### @1=12 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=NULL /* INT meta=0 nullable=1 is_null=1 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### SET
+### @1=12 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+# at 2561
+#<date> server id 1 end_log_pos 2634 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 2634
+#<date> server id 1 end_log_pos 2676 CRC32 XXX GTID 0-1-9
+/*!100001 SET @@session.gtid_seq_no=9*//*!*/;
+BEGIN
+/*!*/;
+# at 2676
+# at 2713
+#<date> server id 1 end_log_pos 2713 CRC32 XXX Annotate_rows:
+#Q> DELETE FROM t1
+#<date> server id 1 end_log_pos 2769 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 2769
+#<date> server id 1 end_log_pos 2861 CRC32 XXX Delete_compressed_rows: table id 30 flags: STMT_END_F
+### DELETE FROM `test`.`t1`
+### WHERE
+### @1=10 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @5=4 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### DELETE FROM `test`.`t1`
+### WHERE
+### @1=11 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @5=4 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
+### DELETE FROM `test`.`t1`
+### WHERE
+### @1=12 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @5=NULL /* MEDIUMINT meta=0 nullable=1 is_null=1 */
+### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### DELETE FROM `test`.`t1`
+### WHERE
+### @1=13 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */
+### @5=0 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+# at 2861
+#<date> server id 1 end_log_pos 2934 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 2934
+#<date> server id 1 end_log_pos 2976 CRC32 XXX GTID 0-1-10
+/*!100001 SET @@session.gtid_seq_no=10*//*!*/;
+BEGIN
+/*!*/;
+# at 2976
+# at 3013
+#<date> server id 1 end_log_pos 3013 CRC32 XXX Annotate_rows:
+#Q> DELETE FROM t2
+#<date> server id 1 end_log_pos 3069 CRC32 XXX Table_map: `test`.`t2` mapped to number num
+# at 3069
+#<date> server id 1 end_log_pos 3154 CRC32 XXX Delete_compressed_rows: table id 31 flags: STMT_END_F
+### DELETE FROM `test`.`t2`
+### WHERE
+### @1=10 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### DELETE FROM `test`.`t2`
+### WHERE
+### @1=11 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
+### DELETE FROM `test`.`t2`
+### WHERE
+### @1=12 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=5 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+### DELETE FROM `test`.`t2`
+### WHERE
+### @1=13 /* INT meta=0 nullable=0 is_null=0 */
+### @2=1 /* INT meta=0 nullable=1 is_null=0 */
+### @3=2 /* INT meta=0 nullable=1 is_null=0 */
+### @4=3 /* INT meta=0 nullable=1 is_null=0 */
+### @5=0 /* INT meta=0 nullable=1 is_null=0 */
+### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
+### @7=6 /* INT meta=0 nullable=1 is_null=0 */
+### @8=7 /* INT meta=0 nullable=1 is_null=0 */
+### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
+# at 3154
+#<date> server id 1 end_log_pos 3227 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 3227
+#<date> server id 1 end_log_pos 3275 CRC32 XXX Rotate to master-bin.000002 pos: 4
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
+
+Test mysqlbinlog | mysql type point-in-time recovery with compressed events.
+
+FLUSH BINARY LOGS;
+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;
+a b c
+0 110 hello
+1 10 cat
+3 110 dog
+4 110 goodbye
+5 40 red
+7 80 colour of blue
+8 20 colour of rigel
+FLUSH LOGS;
+DROP TABLE t3;
+SELECT * FROM t3 ORDER BY a;
+a b c
+0 110 hello
+1 10 cat
+3 110 dog
+4 110 goodbye
+5 40 red
+7 80 colour of blue
+8 20 colour of rigel
+DROP TABLE t1,t2,t3;
+SET GLOBAL log_bin_compress=off;
+SET GLOBAL log_bin_compress_min_len=256;
diff --git a/mysql-test/r/mysqlbinlog_row_minimal.result b/mysql-test/r/mysqlbinlog_row_minimal.result
index 6ffaeeafc53..ca8e43bfb33 100644
--- a/mysql-test/r/mysqlbinlog_row_minimal.result
+++ b/mysql-test/r/mysqlbinlog_row_minimal.result
@@ -14,25 +14,25 @@ FLUSH BINARY LOGS;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
-#<date> server id 1 end_log_pos 249 Start: xxx
+#<date> server id 1 end_log_pos 256 CRC32 XXX Start: xxx
ROLLBACK/*!*/;
-# at 249
-#<date> server id 1 end_log_pos 274 Gtid list []
-# at 274
-#<date> server id 1 end_log_pos 314 Binlog checkpoint master-bin.000001
-# at 314
-#<date> server id 1 end_log_pos 352 GTID 0-1-1 ddl
+# at 256
+#<date> server id 1 end_log_pos 285 CRC32 XXX Gtid list []
+# at 285
+#<date> server id 1 end_log_pos 329 CRC32 XXX Binlog checkpoint master-bin.000001
+# at 329
+#<date> server id 1 end_log_pos 371 CRC32 XXX GTID 0-1-1 ddl
/*!100101 SET @@session.skip_parallel_replication=0*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
-# at 352
-#<date> server id 1 end_log_pos 532 Query thread_id=4 exec_time=x error_code=0
+# at 371
+#<date> server id 1 end_log_pos 555 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
use `test`/*!*/;
SET TIMESTAMP=X/*!*/;
-SET @@session.pseudo_thread_id=4/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=1342177280/*!*/;
+SET @@session.pseudo_thread_id=5/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
@@ -40,23 +40,26 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1))
/*!*/;
-# at 532
-#<date> server id 1 end_log_pos 570 GTID 0-1-2 ddl
+# at 555
+#<date> server id 1 end_log_pos 597 CRC32 XXX GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
-# at 570
-#<date> server id 1 end_log_pos 743 Query thread_id=4 exec_time=x error_code=0
+# at 597
+#<date> server id 1 end_log_pos 774 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1))
/*!*/;
-# at 743
-#<date> server id 1 end_log_pos 781 GTID 0-1-3
+# at 774
+#<date> server id 1 end_log_pos 816 CRC32 XXX GTID 0-1-3
/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
BEGIN
/*!*/;
-# at 781
-#<date> server id 1 end_log_pos 833 Table_map: `test`.`t1` mapped to number 30
-# at 833
-#<date> server id 1 end_log_pos 898 Write_rows: table id 30 flags: STMT_END_F
+# at 816
+# at 890
+#<date> server id 1 end_log_pos 890 CRC32 XXX Annotate_rows:
+#Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "")
+#<date> server id 1 end_log_pos 946 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 946
+#<date> server id 1 end_log_pos 1015 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -68,20 +71,23 @@ BEGIN
### @7=6 /* INT meta=0 nullable=1 is_null=0 */
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
-# at 898
-#<date> server id 1 end_log_pos 967 Query thread_id=4 exec_time=x error_code=0
+# at 1015
+#<date> server id 1 end_log_pos 1088 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 967
-#<date> server id 1 end_log_pos 1005 GTID 0-1-4
+# at 1088
+#<date> server id 1 end_log_pos 1130 CRC32 XXX GTID 0-1-4
/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
BEGIN
/*!*/;
-# at 1005
-#<date> server id 1 end_log_pos 1057 Table_map: `test`.`t1` mapped to number 30
-# at 1057
-#<date> server id 1 end_log_pos 1121 Write_rows: table id 30 flags: STMT_END_F
+# at 1130
+# at 1206
+#<date> server id 1 end_log_pos 1206 CRC32 XXX Annotate_rows:
+#Q> INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL)
+#<date> server id 1 end_log_pos 1262 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 1262
+#<date> server id 1 end_log_pos 1330 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=11 /* INT meta=0 nullable=0 is_null=0 */
@@ -93,20 +99,23 @@ BEGIN
### @7=6 /* INT meta=0 nullable=1 is_null=0 */
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
-# at 1121
-#<date> server id 1 end_log_pos 1190 Query thread_id=4 exec_time=x error_code=0
+# at 1330
+#<date> server id 1 end_log_pos 1403 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 1190
-#<date> server id 1 end_log_pos 1228 GTID 0-1-5
+# at 1403
+#<date> server id 1 end_log_pos 1445 CRC32 XXX GTID 0-1-5
/*!100001 SET @@session.gtid_seq_no=5*//*!*/;
BEGIN
/*!*/;
-# at 1228
-#<date> server id 1 end_log_pos 1280 Table_map: `test`.`t1` mapped to number 30
-# at 1280
-#<date> server id 1 end_log_pos 1343 Write_rows: table id 30 flags: STMT_END_F
+# at 1445
+# at 1523
+#<date> server id 1 end_log_pos 1523 CRC32 XXX Annotate_rows:
+#Q> INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A")
+#<date> server id 1 end_log_pos 1579 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 1579
+#<date> server id 1 end_log_pos 1646 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=12 /* INT meta=0 nullable=0 is_null=0 */
@@ -118,20 +127,23 @@ BEGIN
### @7=6 /* INT meta=0 nullable=1 is_null=0 */
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
-# at 1343
-#<date> server id 1 end_log_pos 1412 Query thread_id=4 exec_time=x error_code=0
+# at 1646
+#<date> server id 1 end_log_pos 1719 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 1412
-#<date> server id 1 end_log_pos 1450 GTID 0-1-6
+# at 1719
+#<date> server id 1 end_log_pos 1761 CRC32 XXX GTID 0-1-6
/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
BEGIN
/*!*/;
-# at 1450
-#<date> server id 1 end_log_pos 1502 Table_map: `test`.`t1` mapped to number 30
-# at 1502
-#<date> server id 1 end_log_pos 1568 Write_rows: table id 30 flags: STMT_END_F
+# at 1761
+# at 1836
+#<date> server id 1 end_log_pos 1836 CRC32 XXX Annotate_rows:
+#Q> INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A")
+#<date> server id 1 end_log_pos 1892 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 1892
+#<date> server id 1 end_log_pos 1962 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=13 /* INT meta=0 nullable=0 is_null=0 */
@@ -143,20 +155,23 @@ BEGIN
### @7=6 /* INT meta=0 nullable=1 is_null=0 */
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
-# at 1568
-#<date> server id 1 end_log_pos 1637 Query thread_id=4 exec_time=x error_code=0
+# at 1962
+#<date> server id 1 end_log_pos 2035 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 1637
-#<date> server id 1 end_log_pos 1675 GTID 0-1-7
+# at 2035
+#<date> server id 1 end_log_pos 2077 CRC32 XXX GTID 0-1-7
/*!100001 SET @@session.gtid_seq_no=7*//*!*/;
BEGIN
/*!*/;
-# at 1675
-#<date> server id 1 end_log_pos 1727 Table_map: `test`.`t2` mapped to number 31
-# at 1727
-#<date> server id 1 end_log_pos 1890 Write_rows: table id 31 flags: STMT_END_F
+# at 2077
+# at 2131
+#<date> server id 1 end_log_pos 2131 CRC32 XXX Annotate_rows:
+#Q> INSERT INTO t2 SELECT * FROM t1
+#<date> server id 1 end_log_pos 2187 CRC32 XXX Table_map: `test`.`t2` mapped to number num
+# at 2187
+#<date> server id 1 end_log_pos 2354 CRC32 XXX Write_rows: table id 31 flags: STMT_END_F
### INSERT INTO `test`.`t2`
### SET
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -201,20 +216,23 @@ BEGIN
### @7=6 /* INT meta=0 nullable=1 is_null=0 */
### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
-# at 1890
-#<date> server id 1 end_log_pos 1959 Query thread_id=4 exec_time=x error_code=0
+# at 2354
+#<date> server id 1 end_log_pos 2427 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 1959
-#<date> server id 1 end_log_pos 1997 GTID 0-1-8
+# at 2427
+#<date> server id 1 end_log_pos 2469 CRC32 XXX GTID 0-1-8
/*!100001 SET @@session.gtid_seq_no=8*//*!*/;
BEGIN
/*!*/;
-# at 1997
-#<date> server id 1 end_log_pos 2049 Table_map: `test`.`t2` mapped to number 31
-# at 2049
-#<date> server id 1 end_log_pos 2119 Update_rows: table id 31 flags: STMT_END_F
+# at 2469
+# at 2535
+#<date> server id 1 end_log_pos 2535 CRC32 XXX Annotate_rows:
+#Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL
+#<date> server id 1 end_log_pos 2591 CRC32 XXX Table_map: `test`.`t2` mapped to number num
+# at 2591
+#<date> server id 1 end_log_pos 2665 CRC32 XXX Update_rows: table id 31 flags: STMT_END_F
### UPDATE `test`.`t2`
### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -233,20 +251,23 @@ BEGIN
### @5=NULL /* INT meta=0 nullable=1 is_null=1 */
### SET
### @5=5 /* INT meta=0 nullable=1 is_null=0 */
-# at 2119
-#<date> server id 1 end_log_pos 2188 Query thread_id=4 exec_time=x error_code=0
+# at 2665
+#<date> server id 1 end_log_pos 2738 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 2188
-#<date> server id 1 end_log_pos 2226 GTID 0-1-9
+# at 2738
+#<date> server id 1 end_log_pos 2780 CRC32 XXX GTID 0-1-9
/*!100001 SET @@session.gtid_seq_no=9*//*!*/;
BEGIN
/*!*/;
-# at 2226
-#<date> server id 1 end_log_pos 2278 Table_map: `test`.`t1` mapped to number 30
-# at 2278
-#<date> server id 1 end_log_pos 2328 Delete_rows: table id 30 flags: STMT_END_F
+# at 2780
+# at 2817
+#<date> server id 1 end_log_pos 2817 CRC32 XXX Annotate_rows:
+#Q> DELETE FROM t1
+#<date> server id 1 end_log_pos 2873 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 2873
+#<date> server id 1 end_log_pos 2927 CRC32 XXX Delete_rows: table id 30 flags: STMT_END_F
### DELETE FROM `test`.`t1`
### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -259,20 +280,23 @@ BEGIN
### DELETE FROM `test`.`t1`
### WHERE
### @1=13 /* INT meta=0 nullable=0 is_null=0 */
-# at 2328
-#<date> server id 1 end_log_pos 2397 Query thread_id=4 exec_time=x error_code=0
+# at 2927
+#<date> server id 1 end_log_pos 3000 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 2397
-#<date> server id 1 end_log_pos 2435 GTID 0-1-10
+# at 3000
+#<date> server id 1 end_log_pos 3042 CRC32 XXX GTID 0-1-10
/*!100001 SET @@session.gtid_seq_no=10*//*!*/;
BEGIN
/*!*/;
-# at 2435
-#<date> server id 1 end_log_pos 2487 Table_map: `test`.`t2` mapped to number 31
-# at 2487
-#<date> server id 1 end_log_pos 2537 Delete_rows: table id 31 flags: STMT_END_F
+# at 3042
+# at 3079
+#<date> server id 1 end_log_pos 3079 CRC32 XXX Annotate_rows:
+#Q> DELETE FROM t2
+#<date> server id 1 end_log_pos 3135 CRC32 XXX Table_map: `test`.`t2` mapped to number num
+# at 3135
+#<date> server id 1 end_log_pos 3189 CRC32 XXX Delete_rows: table id 31 flags: STMT_END_F
### DELETE FROM `test`.`t2`
### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -285,13 +309,13 @@ BEGIN
### DELETE FROM `test`.`t2`
### WHERE
### @1=13 /* INT meta=0 nullable=0 is_null=0 */
-# at 2537
-#<date> server id 1 end_log_pos 2606 Query thread_id=4 exec_time=x error_code=0
+# at 3189
+#<date> server id 1 end_log_pos 3262 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 2606
-#<date> server id 1 end_log_pos 2650 Rotate to master-bin.000002 pos: 4
+# at 3262
+#<date> server id 1 end_log_pos 3310 CRC32 XXX Rotate to master-bin.000002 pos: 4
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
diff --git a/mysql-test/r/mysqlbinlog_stmt_compressed.result b/mysql-test/r/mysqlbinlog_stmt_compressed.result
new file mode 100644
index 00000000000..cd8e98c1ee3
--- /dev/null
+++ b/mysql-test/r/mysqlbinlog_stmt_compressed.result
@@ -0,0 +1,207 @@
+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;
+FLUSH BINARY LOGS;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+# at 4
+#<date> server id 1 end_log_pos 256 CRC32 XXX Start: xxx
+ROLLBACK/*!*/;
+# at 256
+#<date> server id 1 end_log_pos 285 CRC32 XXX Gtid list []
+# at 285
+#<date> server id 1 end_log_pos 329 CRC32 XXX Binlog checkpoint master-bin.000001
+# at 329
+#<date> server id 1 end_log_pos 371 CRC32 XXX GTID 0-1-1 ddl
+/*!100101 SET @@session.skip_parallel_replication=0*//*!*/;
+/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
+/*!100001 SET @@session.server_id=1*//*!*/;
+/*!100001 SET @@session.gtid_seq_no=1*//*!*/;
+# at 371
+#<date> server id 1 end_log_pos 533 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
+use `test`/*!*/;
+SET TIMESTAMP=X/*!*/;
+SET @@session.pseudo_thread_id=5/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1))
+/*!*/;
+# at 533
+#<date> server id 1 end_log_pos 575 CRC32 XXX GTID 0-1-2 ddl
+/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
+# at 575
+#<date> server id 1 end_log_pos 727 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1))
+/*!*/;
+# at 727
+#<date> server id 1 end_log_pos 769 CRC32 XXX GTID 0-1-3
+/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
+BEGIN
+/*!*/;
+# at 769
+#<date> server id 1 end_log_pos 897 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "")
+/*!*/;
+# at 897
+#<date> server id 1 end_log_pos 970 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 970
+#<date> server id 1 end_log_pos 1012 CRC32 XXX GTID 0-1-4
+/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
+BEGIN
+/*!*/;
+# at 1012
+#<date> server id 1 end_log_pos 1140 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL)
+/*!*/;
+# at 1140
+#<date> server id 1 end_log_pos 1213 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 1213
+#<date> server id 1 end_log_pos 1255 CRC32 XXX GTID 0-1-5
+/*!100001 SET @@session.gtid_seq_no=5*//*!*/;
+BEGIN
+/*!*/;
+# at 1255
+#<date> server id 1 end_log_pos 1385 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A")
+/*!*/;
+# at 1385
+#<date> server id 1 end_log_pos 1458 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 1458
+#<date> server id 1 end_log_pos 1500 CRC32 XXX GTID 0-1-6
+/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
+BEGIN
+/*!*/;
+# at 1500
+#<date> server id 1 end_log_pos 1627 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A")
+/*!*/;
+# at 1627
+#<date> server id 1 end_log_pos 1700 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 1700
+#<date> server id 1 end_log_pos 1742 CRC32 XXX GTID 0-1-7
+/*!100001 SET @@session.gtid_seq_no=7*//*!*/;
+BEGIN
+/*!*/;
+# at 1742
+#<date> server id 1 end_log_pos 1850 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+INSERT INTO t2 SELECT * FROM t1
+/*!*/;
+# at 1850
+#<date> server id 1 end_log_pos 1923 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 1923
+#<date> server id 1 end_log_pos 1965 CRC32 XXX GTID 0-1-8
+/*!100001 SET @@session.gtid_seq_no=8*//*!*/;
+BEGIN
+/*!*/;
+# at 1965
+#<date> server id 1 end_log_pos 2082 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL
+/*!*/;
+# at 2082
+#<date> server id 1 end_log_pos 2155 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 2155
+#<date> server id 1 end_log_pos 2197 CRC32 XXX GTID 0-1-9
+/*!100001 SET @@session.gtid_seq_no=9*//*!*/;
+BEGIN
+/*!*/;
+# at 2197
+#<date> server id 1 end_log_pos 2288 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+DELETE FROM t1
+/*!*/;
+# at 2288
+#<date> server id 1 end_log_pos 2361 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 2361
+#<date> server id 1 end_log_pos 2403 CRC32 XXX GTID 0-1-10
+/*!100001 SET @@session.gtid_seq_no=10*//*!*/;
+BEGIN
+/*!*/;
+# at 2403
+#<date> server id 1 end_log_pos 2494 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+DELETE FROM t2
+/*!*/;
+# at 2494
+#<date> server id 1 end_log_pos 2567 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 2567
+#<date> server id 1 end_log_pos 2615 CRC32 XXX Rotate to master-bin.000002 pos: 4
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
+
+Test mysqlbinlog | mysql type point-in-time recovery with compressed events.
+
+FLUSH BINARY LOGS;
+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;
+a b c
+0 10 hello
+1 10 cat
+3 10 dog
+4 10 goodbye
+FLUSH LOGS;
+DROP TABLE t3;
+SELECT * FROM t3 ORDER BY a;
+a b c
+0 10 hello
+1 10 cat
+3 10 dog
+4 10 goodbye
+DROP TABLE t1,t2,t3;
+SET GLOBAL log_bin_compress=off;
+SET GLOBAL log_bin_compress_min_len=256;
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result
index 8894616fbb3..ff9cc5d5c81 100644
--- a/mysql-test/r/mysqlcheck.result
+++ b/mysql-test/r/mysqlcheck.result
@@ -241,15 +241,15 @@ CREATE TABLE t1 (a INT) engine=myisam;
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS
WHERE TRIGGER_SCHEMA="#mysql50#a@b" ORDER BY trigger_name;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def #mysql50#a@b tr1 INSERT def #mysql50#a@b #mysql50#c@d 0 NULL SET NEW.a = 10 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-def #mysql50#a@b tr2 INSERT def #mysql50#a@b t1 0 NULL SET NEW.a = 100 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+def #mysql50#a@b tr1 INSERT def #mysql50#a@b #mysql50#c@d 1 NULL SET NEW.a = 10 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+def #mysql50#a@b tr2 INSERT def #mysql50#a@b t1 1 NULL SET NEW.a = 100 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
mysqlcheck --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;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def a@b tr1 INSERT def a@b c@d 0 NULL SET NEW.a = 10 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci
-def a@b tr2 INSERT def a@b t1 0 NULL SET NEW.a = 100 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci
+def a@b tr1 INSERT def a@b c@d 1 NULL SET NEW.a = 10 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci
+def a@b tr2 INSERT def a@b t1 1 NULL SET NEW.a = 100 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci
INSERT INTO `c@d` VALUES (2), (1);
SELECT * FROM `c@d`;
a
diff --git a/mysql-test/r/mysqld--help,win.rdiff b/mysql-test/r/mysqld--help,win.rdiff
index 6e18d16feaf..7ef9ec5da5f 100644
--- a/mysql-test/r/mysqld--help,win.rdiff
+++ b/mysql-test/r/mysqld--help,win.rdiff
@@ -1,6 +1,6 @@
---- mysqld--help.result
-+++ mysqld--help,win.reject
-@@ -333,7 +333,6 @@
+--- a/mysql-test/r/mysqld--help.result
++++ b/mysql-test/r/mysqld--help.result
+@@ -334,7 +334,6 @@
The number of segments in a key cache
-L, --language=name Client error messages in given language. May be given as
a full path. Deprecated. Use --lc-messages-dir instead.
@@ -8,7 +8,7 @@
--lc-messages=name Set the language used for the error messages.
-L, --lc-messages-dir=name
Directory where error messages are
-@@ -533,6 +532,7 @@
+@@ -543,6 +542,7 @@
Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME,
DATETIME, TIMESTAMP columns.
(Defaults to on; use --skip-mysql56-temporal-format to disable.)
@@ -16,17 +16,17 @@
--net-buffer-length=#
Buffer length for TCP/IP and socket communication
--net-read-timeout=#
-@@ -924,6 +924,9 @@
- files within specified directory
- --server-id=# Uniquely identifies the server instance in the community
- of replication partners
+@@ -957,6 +957,9 @@
+ characteristics (isolation level, read only/read
+ write,snapshot - but not any work done / data modified
+ within the transaction).
+ --shared-memory Enable the shared memory
+ --shared-memory-base-name=name
+ Base name of shared memory
--show-slave-auth-info
Show user and password in SHOW SLAVE HOSTS on this
master.
-@@ -1034,6 +1037,10 @@
+@@ -1069,6 +1072,10 @@
Log slow queries to given log file. Defaults logging to
'hostname'-slow.log. Must be enabled to activate other
slow log options
@@ -37,45 +37,29 @@
--socket=name Socket file to use for connection
--sort-buffer-size=#
Each thread that needs to do a sort allocates a buffer of
-@@ -1052,6 +1059,7 @@
+@@ -1087,6 +1094,7 @@
NO_ENGINE_SUBSTITUTION, PAD_CHAR_TO_FULL_LENGTH
--stack-trace Print a symbolic stack trace on failure
(Defaults to on; use --skip-stack-trace to disable.)
+ --standalone Dummy option to start as a standalone program (NT).
- --stored-program-cache=#
- The soft upper limit for number of cached stored routines
- for one connection.
-@@ -1088,25 +1096,11 @@
- COMMIT, ROLLBACK
- --thread-cache-size=#
- How many threads we should keep in a cache for reuse
-- --thread-pool-idle-timeout=#
-- Timeout in seconds for an idle thread in the thread
-- pool.Worker thread will be shut down after timeout
+ --standard-compliant-cte
+ Allow only CTEs compliant to SQL standard
+ (Defaults to on; use --skip-standard-compliant-cte to disable.)
+@@ -1135,6 +1143,11 @@
--thread-pool-max-threads=#
Maximum allowed number of worker threads in the thread
pool
-- --thread-pool-oversubscribe=#
-- How many additional active worker threads in a group are
-- allowed.
-- --thread-pool-size=#
-- Number of thread groups in the pool. This parameter is
-- roughly equivalent to maximum number of concurrently
-- executing threads (threads in a waiting state do not
-- count as executing).
-- --thread-pool-stall-limit=#
-- Maximum query execution time in milliseconds,before an
-- executing non-yielding thread is considered stalled.If a
-- worker thread is stalled, additional worker thread may be
-- created to handle remaining clients.
+ --thread-pool-min-threads=#
+ Minimum number of threads in the thread pool.
- --thread-stack=# The stack size for each thread
- --time-format=name The TIME format (ignored)
- --timed-mutexes Specify whether to time mutexes. Deprecated, has no
-@@ -1115,8 +1109,8 @@
- size, MariaDB will automatically convert it to an on-disk
- MyISAM or Aria table.
++ --thread-pool-mode=name
++ Chose implementation of the threadpool. One of: windows,
++ generic
+ --thread-pool-oversubscribe=#
+ How many additional active worker threads in a group are
+ allowed.
+@@ -1173,8 +1186,8 @@
+ automatically convert it to an on-disk MyISAM or Aria
+ table.
-t, --tmpdir=name Path for temporary files. Several paths may be specified,
- separated by a colon (:), in this case they are used in a
- round-robin fashion
@@ -84,7 +68,7 @@
--transaction-alloc-block-size=#
Allocation block size for transactions to be stored in
binary log
-@@ -1240,7 +1234,6 @@
+@@ -1299,7 +1312,6 @@
key-cache-division-limit 100
key-cache-file-hash-size 512
key-cache-segments 0
@@ -92,7 +76,7 @@
lc-messages en_US
lc-messages-dir MYSQL_SHAREDIR/
lc-time-names en_US
-@@ -1307,6 +1300,7 @@
+@@ -1369,6 +1381,7 @@
myisam-stats-method NULLS_UNEQUAL
myisam-use-mmap FALSE
mysql56-temporal-format TRUE
@@ -100,24 +84,24 @@
net-buffer-length 16384
net-read-timeout 30
net-retry-count 10
-@@ -1403,6 +1397,8 @@
- secure-auth TRUE
- secure-file-priv (No default value)
- server-id 0
+@@ -1470,6 +1483,8 @@
+ session-track-state-change FALSE
+ session-track-system-variables
+ session-track-transaction-info OFF
+shared-memory FALSE
+shared-memory-base-name MYSQL
show-slave-auth-info FALSE
silent-startup FALSE
skip-grant-tables TRUE
-@@ -1426,6 +1422,7 @@
+@@ -1494,6 +1509,7 @@
slave-type-conversions
slow-launch-time 2
slow-query-log FALSE
+slow-start-timeout 15000
sort-buffer-size 2097152
- sql-mode NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+ sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
stack-trace TRUE
-@@ -1438,15 +1435,13 @@
+@@ -1507,14 +1523,16 @@
sync-relay-log 10000
sync-relay-log-info 10000
sysdate-is-now FALSE
@@ -126,13 +110,13 @@
table-definition-cache 400
-table-open-cache 421
+table-open-cache 2000
+ table-open-cache-instances 8
tc-heuristic-recover OFF
- thread-cache-size 0
--thread-pool-idle-timeout 60
- thread-pool-max-threads 1000
--thread-pool-oversubscribe 3
--thread-pool-stall-limit 500
+ thread-cache-size 151
+ thread-pool-idle-timeout 60
+ thread-pool-max-threads 65536
+thread-pool-min-threads 1
- thread-stack 295936
- time-format %H:%i:%s
- timed-mutexes FALSE
++thread-pool-mode windows
+ thread-pool-oversubscribe 3
+ thread-pool-prio-kickup-timer 1000
+ thread-pool-priority auto
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index fdb4d8c280d..3b7d5e21c00 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -38,6 +38,7 @@ The following specify which files/extra groups are read (specified before remain
--binlog-annotate-row-events
Tells the master to annotate RBR events with the
statement that caused these events
+ (Defaults to on; use --skip-binlog-annotate-row-events to disable.)
--binlog-cache-size=#
The size of the transactional cache for updates to
transactional engines for the binary log. If you often
@@ -113,9 +114,6 @@ The following specify which files/extra groups are read (specified before remain
--bulk-insert-buffer-size=#
Size of tree cache used in bulk insert optimisation. Note
that this is a limit per thread!
- --changed-page-bitmaps[=name]
- Enable or disable CHANGED_PAGE_BITMAPS plugin. One of:
- ON, OFF, FORCE (don't start if the plugin fails to load).
--character-set-client-handshake
Don't ignore client side character set value sent during
handshake.
@@ -225,6 +223,9 @@ The following specify which files/extra groups are read (specified before remain
--extra-port=# Extra port number to use for tcp connections in a
one-thread-per-connection manner. 0 means don't use
another port
+ --flashback Setup the server to use flashback. This enables binary
+ log in row mode and will enable extra logging for DDL's
+ needed by flashback feature
--flush Flush MyISAM tables to disk between SQL commands
--flush-time=# A dedicated thread is created to flush all tables at the
given interval
@@ -252,7 +253,7 @@ The following specify which files/extra groups are read (specified before remain
prefixes.
(Defaults to on; use --skip-getopt-prefix-matching to disable.)
--group-concat-max-len=#
- The maximum length of the result of function
+ The maximum length of the result of function
GROUP_CONCAT()
--gtid-domain-id=# Used with global transaction ID to identify logically
independent replication streams. When events can
@@ -361,6 +362,10 @@ The following specify which files/extra groups are read (specified before remain
We strongly recommend to use either --log-basename or
specify a filename to ensure that replication doesn't
stop if the real hostname of the computer changes.
+ --log-bin-compress Whether the binary log can be compressed
+ --log-bin-compress-min-len[=#]
+ Minimum length of sql statement(in statement mode) or
+ record(in row mode)that can be compressed.
--log-bin-index=name
File that holds the names for last binary log files.
--log-bin-trust-function-creators
@@ -389,6 +394,7 @@ The following specify which files/extra groups are read (specified before remain
--log-slow-admin-statements
Log slow OPTIMIZE, ANALYZE, ALTER and other
administrative statements to the slow log if it is open.
+ (Defaults to on; use --skip-log-slow-admin-statements to disable.)
--log-slow-filter=name
Log only certain types of queries. Any combination of:
admin, filesort, filesort_on_disk, full_join, full_scan,
@@ -401,6 +407,7 @@ The following specify which files/extra groups are read (specified before remain
--log-slow-slave-statements
Log slow statements executed by slave thread to the slow
log if it is open.
+ (Defaults to on; use --skip-log-slow-slave-statements to disable.)
--log-slow-verbosity=name
Verbosity level for the slow log. Any combination of:
innodb, query_plan, explain
@@ -413,8 +420,9 @@ The following specify which files/extra groups are read (specified before remain
file.Value can be between 0 and 11. Higher values mean
more verbosity
--long-query-time=# Log all queries that have taken more than long_query_time
- seconds to execute to file. The argument will be treated
- as a decimal value with microsecond precision
+ seconds to execute to the slow query log file. The
+ argument will be treated as a decimal value with
+ microsecond precision
--low-priority-updates
INSERT/DELETE/UPDATE has lower priority than selects
--lower-case-table-names[=#]
@@ -464,6 +472,9 @@ The following specify which files/extra groups are read (specified before remain
max_allowed_packet instead.
--max-prepared-stmt-count=#
Maximum number of prepared statements in the server
+ --max-recursive-iterations[=#]
+ Maximum number of iterations when executing recursive
+ queries
--max-relay-log-size=#
relay log will be rotated automatically when the size
exceeds this value. If 0 at startup, it's set to
@@ -561,9 +572,10 @@ The following specify which files/extra groups are read (specified before remain
--open-files-limit=#
If this is not 0, then mysqld will use this value to
reserve file descriptors to use with setrlimit(). If this
- value is 0 then mysqld will reserve max_connections*5 or
- max_connections + table_cache*2 (whichever is larger)
- number of file descriptors
+ value is 0 or autoset then mysqld will reserve
+ max_connections*5 or max_connections + table_cache*2
+ (whichever is larger) number of file descriptors
+ (Automatically configured unless set explicitly)
--optimizer-prune-level=#
Controls the heuristic(s) applied during query
optimization to prune less-promising partial plans from
@@ -577,10 +589,7 @@ The following specify which files/extra groups are read (specified before remain
a query. Values smaller than the number of tables in a
relation result in faster optimization, but may produce
very bad query plans. If set to 0, the system will
- automatically pick a reasonable value; if set to 63, the
- optimizer will switch to the original find_best search.
- NOTE: The value 63 and its associated behaviour is
- deprecated.
+ automatically pick a reasonable value.
--optimizer-selectivity-sampling-limit=#
Controls number of record samples to check condition
selectivity
@@ -598,7 +607,8 @@ The following specify which files/extra groups are read (specified before remain
semijoin_with_cache, join_cache_incremental,
join_cache_hashed, join_cache_bka,
optimize_join_buffer_size, table_elimination,
- extended_keys, exists_to_in, orderby_uses_equalities
+ extended_keys, exists_to_in, orderby_uses_equalities,
+ condition_pushdown_for_derived
--optimizer-use-condition-selectivity=#
Controls selectivity of which conditions the optimizer
takes into account to calculate cardinality of a partial
@@ -796,6 +806,9 @@ The following specify which files/extra groups are read (specified before remain
--range-alloc-block-size=#
Allocation block size for storing ranges during
optimization
+ --read-binlog-speed-limit=#
+ Maximum speed(KB/s) to read binlog from master (0 = no
+ limit)
--read-buffer-size=#
Each thread that does a sequential scan allocates a
buffer of this size for each table it scans. If you do
@@ -828,6 +841,7 @@ The following specify which files/extra groups are read (specified before remain
Tells the slave to write annotate rows events received
from the master to its own binary log. Ignored if
log_slave_updates is not set
+ (Defaults to on; use --skip-replicate-annotate-row-events to disable.)
--replicate-do-db=name
Tells the slave thread to restrict replication to the
specified database. To specify more than one database,
@@ -926,6 +940,26 @@ The following specify which files/extra groups are read (specified before remain
files within specified directory
--server-id=# Uniquely identifies the server instance in the community
of replication partners
+ --session-track-schema
+ Track changes to the default schema.
+ (Defaults to on; use --skip-session-track-schema to disable.)
+ --session-track-state-change
+ Track changes to the session state.
+ --session-track-system-variables=name
+ Track changes in registered system variables. For
+ compatibility with MySQL defaults this variable should be
+ set to "autocommit, character_set_client,
+ character_set_connection, character_set_results,
+ time_zone"
+ --session-track-transaction-info=name
+ Track changes to the transaction attributes. OFF to
+ disable; STATE to track just transaction state (Is there
+ an active transaction? Does it have any data? etc.);
+ CHARACTERISTICS to track transaction state and report all
+ statements needed to start a transaction withthe same
+ characteristics (isolation level, read only/read
+ write,snapshot - but not any work done / data modified
+ within the transaction).
--show-slave-auth-info
Show user and password in SHOW SLAVE HOSTS on this
master.
@@ -997,6 +1031,8 @@ The following specify which files/extra groups are read (specified before remain
replication domains. Note that these threads are in
addition to the IO and SQL threads, which are always
created by a replication slave
+ --slave-parallel-workers=#
+ Alias for slave_parallel_threads
--slave-run-triggers-for-rbr=name
Modes for how triggers in row-base replication on slave
side will be executed. Legal values are NO (default), YES
@@ -1054,6 +1090,9 @@ The following specify which files/extra groups are read (specified before remain
NO_ENGINE_SUBSTITUTION, PAD_CHAR_TO_FULL_LENGTH
--stack-trace Print a symbolic stack trace on failure
(Defaults to on; use --skip-stack-trace to disable.)
+ --standard-compliant-cte
+ Allow only CTEs compliant to SQL standard
+ (Defaults to on; use --skip-standard-compliant-cte to disable.)
--stored-program-cache=#
The soft upper limit for number of cached stored routines
for one connection.
@@ -1085,11 +1124,14 @@ The following specify which files/extra groups are read (specified before remain
The number of cached table definitions
--table-open-cache=#
The number of cached open tables
+ --table-open-cache-instances=#
+ Maximum number of table cache instances
--tc-heuristic-recover=name
Decision to use in heuristic recover process. One of: OFF,
COMMIT, ROLLBACK
--thread-cache-size=#
- How many threads we should keep in a cache for reuse
+ How many threads we should keep in a cache for reuse.
+ These are freed after 5 minutes of idle time
--thread-pool-idle-timeout=#
Timeout in seconds for an idle thread in the thread
pool.Worker thread will be shut down after timeout
@@ -1099,6 +1141,15 @@ The following specify which files/extra groups are read (specified before remain
--thread-pool-oversubscribe=#
How many additional active worker threads in a group are
allowed.
+ --thread-pool-prio-kickup-timer=#
+ The number of milliseconds before a dequeued low-priority
+ statement is moved to the high-priority queue
+ --thread-pool-priority=name
+ Threadpool priority. High priority connections usually
+ start executing earlier than low priority.If priority set
+ to 'auto', the the actual priority(low or high) is
+ determined based on whether or not connection is inside
+ transaction.
--thread-pool-size=#
Number of thread groups in the pool. This parameter is
roughly equivalent to maximum number of concurrently
@@ -1113,9 +1164,17 @@ The following specify which files/extra groups are read (specified before remain
--time-format=name The TIME format (ignored)
--timed-mutexes Specify whether to time mutexes. Deprecated, has no
effect.
- --tmp-table-size=# If an internal in-memory temporary table exceeds this
- size, MariaDB will automatically convert it to an on-disk
+ --tmp-disk-table-size=#
+ Max size for data for an internal temporary on-disk
MyISAM or Aria table.
+ --tmp-memory-table-size=#
+ If an internal in-memory temporary table exceeds this
+ size, MariaDB will automatically convert it to an on-disk
+ MyISAM or Aria table. Same as tmp_table_size.
+ --tmp-table-size=# Alias for tmp_memory_table_size. If an internal in-memory
+ temporary table exceeds this size, MariaDB will
+ automatically convert it to an on-disk MyISAM or Aria
+ table.
-t, --tmpdir=name Path for temporary files. Several paths may be specified,
separated by a colon (:), in this case they are used in a
round-robin fashion
@@ -1147,7 +1206,8 @@ The following specify which files/extra groups are read (specified before remain
CLIENT_STATISTICS, INDEX_STATISTICS and TABLE_STATISTICS
tables in the INFORMATION_SCHEMA
-v, --verbose Used with --help option for detailed help.
- -V, --version Output version information and exit.
+ -V, --version[=name]
+ Output version information and exit.
--wait-timeout=# The number of seconds the server waits for activity on a
connection before closing it
@@ -1160,19 +1220,18 @@ automatic-sp-privileges TRUE
back-log 80
big-tables FALSE
bind-address (No default value)
-binlog-annotate-row-events FALSE
+binlog-annotate-row-events TRUE
binlog-cache-size 32768
-binlog-checksum NONE
+binlog-checksum CRC32
binlog-commit-wait-count 0
binlog-commit-wait-usec 100000
binlog-direct-non-transactional-updates FALSE
-binlog-format STATEMENT
+binlog-format MIXED
binlog-optimize-thread-scheduling TRUE
-binlog-row-event-max-size 1024
+binlog-row-event-max-size 8192
binlog-row-image FULL
binlog-stmt-cache-size 32768
bulk-insert-buffer-size 8388608
-changed-page-bitmaps ON
character-set-client-handshake TRUE
character-set-filesystem binary
character-sets-dir MYSQL_CHARSETSDIR/
@@ -1207,6 +1266,7 @@ explicit-defaults-for-timestamp FALSE
external-locking FALSE
extra-max-connections 1
extra-port 0
+flashback FALSE
flush FALSE
flush-time 0
ft-boolean-syntax + -><()~*:""&|
@@ -1217,7 +1277,7 @@ ft-stopword-file (No default value)
gdb FALSE
general-log FALSE
getopt-prefix-matching FALSE
-group-concat-max-len 1024
+group-concat-max-len 1048576
gtid-domain-id 0
gtid-ignore-duplicates FALSE
gtid-strict-mode FALSE
@@ -1247,8 +1307,10 @@ lc-messages en_US
lc-messages-dir MYSQL_SHAREDIR/
lc-time-names en_US
local-infile TRUE
-lock-wait-timeout 31536000
+lock-wait-timeout 86400
log-bin (No default value)
+log-bin-compress FALSE
+log-bin-compress-min-len 256
log-bin-index (No default value)
log-bin-trust-function-creators FALSE
log-error
@@ -1257,20 +1319,20 @@ log-output FILE
log-queries-not-using-indexes FALSE
log-short-format FALSE
log-slave-updates FALSE
-log-slow-admin-statements FALSE
+log-slow-admin-statements TRUE
log-slow-filter admin,filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk
log-slow-rate-limit 1
-log-slow-slave-statements FALSE
+log-slow-slave-statements TRUE
log-slow-verbosity
log-tc tc.log
-log-warnings 1
+log-warnings 2
long-query-time 10
low-priority-updates FALSE
lower-case-table-names 1
master-info-file master.info
master-retry-count 86400
master-verify-checksum FALSE
-max-allowed-packet 4194304
+max-allowed-packet 16777216
max-binlog-cache-size 18446744073709547520
max-binlog-size 1073741824
max-binlog-stmt-cache-size 18446744073709547520
@@ -1282,8 +1344,9 @@ max-error-count 64
max-heap-table-size 16777216
max-join-size 18446744073709551615
max-length-for-sort-data 1024
-max-long-data-size 4194304
+max-long-data-size 16777216
max-prepared-stmt-count 16382
+max-recursive-iterations 18446744073709551615
max-relay-log-size 1073741824
max-seeks-for-key 18446744073709551615
max-session-mem-used 9223372036854775807
@@ -1303,7 +1366,7 @@ myisam-block-size 1024
myisam-data-pointer-size 6
myisam-max-sort-file-size 9223372036853727232
myisam-mmap-size 18446744073709551615
-myisam-recover-options DEFAULT
+myisam-recover-options BACKUP,QUICK
myisam-repair-threads 1
myisam-sort-buffer-size 134216704
myisam-stats-method NULLS_UNEQUAL
@@ -1321,7 +1384,7 @@ old-style-user-limits FALSE
optimizer-prune-level 1
optimizer-search-depth 62
optimizer-selectivity-sampling-limit 100
-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=on,exists_to_in=on
+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=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on
optimizer-use-condition-selectivity 1
performance-schema FALSE
performance-schema-accounts-size -1
@@ -1359,7 +1422,7 @@ performance-schema-max-rwlock-instances -1
performance-schema-max-socket-classes 10
performance-schema-max-socket-instances -1
performance-schema-max-stage-classes 150
-performance-schema-max-statement-classes 178
+performance-schema-max-statement-classes 188
performance-schema-max-table-handles -1
performance-schema-max-table-instances -1
performance-schema-max-thread-classes 50
@@ -1384,6 +1447,7 @@ query-cache-type OFF
query-cache-wlock-invalidate FALSE
query-prealloc-size 24576
range-alloc-block-size 4096
+read-binlog-speed-limit 0
read-buffer-size 131072
read-only FALSE
read-rnd-buffer-size 262144
@@ -1393,7 +1457,7 @@ relay-log-info-file relay-log.info
relay-log-purge TRUE
relay-log-recovery FALSE
relay-log-space-limit 0
-replicate-annotate-row-events FALSE
+replicate-annotate-row-events TRUE
replicate-events-marked-for-skip REPLICATE
replicate-same-server-id FALSE
report-host (No default value)
@@ -1404,7 +1468,11 @@ rowid-merge-buff-size 8388608
safe-user-create FALSE
secure-auth TRUE
secure-file-priv (No default value)
-server-id 0
+server-id 1
+session-track-schema TRUE
+session-track-state-change FALSE
+session-track-system-variables
+session-track-transaction-info OFF
show-slave-auth-info FALSE
silent-startup FALSE
skip-grant-tables TRUE
@@ -1417,10 +1485,11 @@ slave-ddl-exec-mode IDEMPOTENT
slave-domain-parallel-threads 0
slave-exec-mode STRICT
slave-max-allowed-packet 1073741824
-slave-net-timeout 3600
+slave-net-timeout 60
slave-parallel-max-queued 131072
slave-parallel-mode conservative
slave-parallel-threads 0
+slave-parallel-workers 0
slave-run-triggers-for-rbr NO
slave-skip-errors (No default value)
slave-sql-verify-checksum TRUE
@@ -1429,8 +1498,9 @@ slave-type-conversions
slow-launch-time 2
slow-query-log FALSE
sort-buffer-size 2097152
-sql-mode NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
stack-trace TRUE
+standard-compliant-cte TRUE
stored-program-cache 256
strict-password-validation TRUE
symbolic-links FALSE
@@ -1443,15 +1513,20 @@ sysdate-is-now FALSE
table-cache 421
table-definition-cache 400
table-open-cache 421
+table-open-cache-instances 8
tc-heuristic-recover OFF
-thread-cache-size 0
+thread-cache-size 151
thread-pool-idle-timeout 60
-thread-pool-max-threads 1000
+thread-pool-max-threads 65536
thread-pool-oversubscribe 3
+thread-pool-prio-kickup-timer 1000
+thread-pool-priority auto
thread-pool-stall-limit 500
-thread-stack 295936
+thread-stack 299008
time-format %H:%i:%s
timed-mutexes FALSE
+tmp-disk-table-size 18446744073709551615
+tmp-memory-table-size 16777216
tmp-table-size 16777216
transaction-alloc-block-size 8192
transaction-isolation REPEATABLE-READ
diff --git a/mysql-test/r/mysqldump-max.result b/mysql-test/r/mysqldump-max.result
index 5eff7a41abd..b75eb969da6 100644
--- a/mysql-test/r/mysqldump-max.result
+++ b/mysql-test/r/mysqldump-max.result
@@ -290,7 +290,10 @@ COUNT(*)
DROP VIEW v1;
DROP TABLE t1;
SET GLOBAL storage_engine=@old_engine;
-# Connection default
+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;
@@ -300,32 +303,32 @@ INSERT INTO t2 VALUES (1,0), (2,0);
SELECT GET_LOCK("block_queries_1", 120);
GET_LOCK("block_queries_1", 120)
1
-# Connection c3
+connection c3;
SELECT GET_LOCK("block_queries_2", 120);
GET_LOCK("block_queries_2", 120)
1
-# Connection c1
+connection c1;
SET @c= 0;
SELECT IF(@c<1, @c:=@c+1, GET_LOCK("block_queries_1", 120)) FROM t1 ORDER BY a;
-# Connection c2
+connection c2;
SET binlog_format="row";
SET @d= 10;
UPDATE t2 SET b=IF(@d<=10, @d:=@d+1, GET_LOCK("block_queries_2", 120)) ORDER BY a;
-# Connection default
+connection default;
# Make sure other queries are running (and waiting).
SELECT RELEASE_LOCK("block_queries_1");
RELEASE_LOCK("block_queries_1")
1
-# Connection c3
+connection c3;
SELECT RELEASE_LOCK("block_queries_2");
RELEASE_LOCK("block_queries_2")
1
-# Connection c1
+connection c1;
IF(@c<1, @c:=@c+1, GET_LOCK("block_queries_1", 120))
1
1
-# Connection c2
-# Connection default
+connection c2;
+connection default;
SELECT * FROM t2 ORDER BY a;
a b
1 11
diff --git a/mysql-test/r/mysqldump-nl.result b/mysql-test/r/mysqldump-nl.result
index d397453b071..d2d0e09546b 100644
--- a/mysql-test/r/mysqldump-nl.result
+++ b/mysql-test/r/mysqldump-nl.result
@@ -71,7 +71,7 @@ SET character_set_client = @saved_cs_client;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp`()
select * from `v1
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index a5fe01d63c3..7f6107db5e4 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -15,7 +15,7 @@ INSERT INTO t1 VALUES (1), (2);
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="test">
<table_structure name="t1">
- <field Field="a" Type="int(11)" Null="YES" Key="MUL" Extra="" Comment="" />
+ <field Field="a" Type="int(11)" Null="YES" Key="MUL" Default="NULL" Extra="" Comment="" />
<key Table="t1" Non_unique="1" Key_name="a" Seq_in_index="1" Column_name="a" Collation="A" Null="YES" Index_type="BTREE" Comment="" Index_comment="" />
</table_structure>
<table_data name="t1">
@@ -47,7 +47,7 @@ DROP TABLE t1;
# Bug#2055 mysqldump should replace "-inf" numeric field values with "NULL"
#
CREATE TABLE t1 (a double);
-INSERT INTO t1 VALUES ('-9e999999');
+INSERT IGNORE INTO t1 VALUES ('-9e999999');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
/*!40101 SET @saved_cs_client = @@character_set_client */;
@@ -151,9 +151,9 @@ INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="test">
<table_structure name="t1">
- <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
- <field Field="b" Type="text" Null="YES" Key="" Extra="" Comment="" />
- <field Field="c" Type="varchar(3)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="a" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
+ <field Field="b" Type="text" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
+ <field Field="c" Type="varchar(3)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
</table_structure>
<table_data name="t1">
<row>
@@ -179,7 +179,7 @@ INSERT INTO t1 VALUES ("1\""), ("\"2");
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="test">
<table_structure name="t1">
- <field Field="a&quot;b&quot;" Type="char(2)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="a&quot;b&quot;" Type="char(2)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
</table_structure>
<table_data name="t1">
<row>
@@ -514,7 +514,7 @@ drop database mysqldump_test_db;
# Check that we don't dump in UTF8 in compatible mode by default,
# but use the default compiled values, or the values given in
# --default-character-set=xxx. However, we should dump in UTF8
-# if it is explicitely set.
+# if it is explicitly set.
CREATE TABLE t1 (a CHAR(10));
INSERT INTO t1 VALUES (_latin1 'ÄÖÜß');
@@ -691,7 +691,7 @@ DROP TABLE IF EXISTS `t1`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
- `b` blob
+ `b` blob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -1613,10 +1613,10 @@ CREATE TABLE `t2` (
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="mysqldump_test_db">
<table_structure name="t1">
- <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="a" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
</table_structure>
<table_structure name="t2">
- <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="a" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
</table_structure>
</database>
</mysqldump>
@@ -1624,10 +1624,10 @@ CREATE TABLE `t2` (
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="mysqldump_test_db">
<table_structure name="t1">
- <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="a" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
</table_structure>
<table_structure name="t2">
- <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="a" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
</table_structure>
</database>
</mysqldump>
@@ -1785,8 +1785,8 @@ CREATE TABLE `t2` (
`a` int(10) DEFAULT NULL,
`b` varchar(30) DEFAULT NULL,
`c` datetime DEFAULT NULL,
- `d` blob,
- `e` text,
+ `d` blob DEFAULT NULL,
+ `e` text DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -2086,7 +2086,7 @@ SET character_set_client = @saved_cs_client;
/*!50001 SET collation_connection = latin1_swedish_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like 'a%') */
+/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where `t2`.`a` like 'a%' */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -2254,7 +2254,7 @@ SET character_set_client = @saved_cs_client;
/*!50001 SET collation_connection = latin1_swedish_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like 'a%') */
+/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where `t2`.`a` like 'a%' */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -2388,7 +2388,7 @@ SET character_set_client = @saved_cs_client;
/*!50001 SET collation_connection = latin1_swedish_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where (`v3`.`b` in (1,2,3,4,5,6,7)) */;
+/*!50001 VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where `v3`.`b` in (1,2,3,4,5,6,7) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
@@ -2402,7 +2402,7 @@ SET character_set_client = @saved_cs_client;
/*!50001 SET collation_connection = latin1_swedish_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v2` AS select `v3`.`a` AS `a` from (`v3` join `v1`) where ((`v1`.`a` = `v3`.`a`) and (`v3`.`b` = 3)) limit 1 */;
+/*!50001 VIEW `v2` AS select `v3`.`a` AS `a` from (`v3` join `v1`) where `v1`.`a` = `v3`.`a` and `v3`.`b` = 3 limit 1 */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
@@ -2468,10 +2468,10 @@ if new.a > 10 then
set new.a := 10;
set new.a := 11;
end if;
-end BEFORE 0000-00-00 00:00:00 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+end BEFORE 0000-00-00 00:00:00 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
trg2 UPDATE t1 begin
if old.a % 2 = 0 then set new.b := 12; end if;
-end BEFORE 0000-00-00 00:00:00 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+end BEFORE 0000-00-00 00:00:00 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
trg3 UPDATE t1 begin
if new.a = -1 then
set @fired:= "Yes";
@@ -2515,7 +2515,7 @@ UNLOCK TABLES;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger trg1 before insert on t1 for each row
begin
@@ -2536,7 +2536,7 @@ DELIMITER ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger trg2 before update on t1 for each row begin
if old.a % 2 = 0 then set new.b := 12; end if;
@@ -2671,10 +2671,10 @@ if new.a > 10 then
set new.a := 10;
set new.a := 11;
end if;
-end BEFORE # NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+end BEFORE # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
trg2 UPDATE t1 begin
if old.a % 2 = 0 then set new.b := 12; end if;
-end BEFORE # NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+end BEFORE # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
trg3 UPDATE t1 begin
if new.a = -1 then
set @fired:= "Yes";
@@ -2717,7 +2717,7 @@ a2
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
testref INSERT test1 BEGIN
-INSERT INTO test2 SET a2 = NEW.a1; END BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+INSERT INTO test2 SET a2 = NEW.a1; END BEFORE # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
SELECT * FROM `test1`;
a1
1
@@ -2789,7 +2789,7 @@ UNLOCK TABLES;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11)
RETURN a+b ;;
@@ -2806,7 +2806,7 @@ DELIMITER ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1) CHARSET latin1
begin
@@ -2843,7 +2843,7 @@ DELIMITER ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT)
BEGIN SELECT a+b INTO c; end ;;
@@ -2860,7 +2860,7 @@ DELIMITER ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `bug9056_proc2`(OUT a INT)
BEGIN
@@ -2923,7 +2923,7 @@ DROP TABLE IF EXISTS `t1`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
- `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
UNIQUE KEY `d` (`d`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -2960,7 +2960,7 @@ DROP TABLE IF EXISTS `t1`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
- `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
UNIQUE KEY `d` (`d`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -3287,7 +3287,7 @@ DROP TABLE IF EXISTS `t1`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`a` binary(1) DEFAULT NULL,
- `b` blob
+ `b` blob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -3322,7 +3322,7 @@ DROP TABLE IF EXISTS `t1`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`a` binary(1) DEFAULT NULL,
- `b` blob
+ `b` blob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -3414,7 +3414,7 @@ mysqldump {
/*!50001 SET collation_connection = latin1_swedish_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `v1` AS select `t`.`qty` AS `qty`,`t`.`price` AS `price`,(`t`.`qty` * `t`.`price`) AS `value` from `t` */;
+/*!50001 VIEW `v1` AS select `t`.`qty` AS `qty`,`t`.`price` AS `price`,`t`.`qty` * `t`.`price` AS `value` from `t` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
@@ -3650,16 +3650,21 @@ drop user mysqltest_1@localhost;
#
# Bug#21424 mysqldump failing to export/import views
#
+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);
+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;
+connection root;
use mysqldump_myDB;
drop view v1;
drop table t1;
@@ -3671,6 +3676,7 @@ flush privileges;
# Bug#21424 continues from here.
# Restore. Flush Privileges test ends.
#
+connection user1;
use mysqldump_myDB;
select * from mysqldump_myDB.v1;
c1
@@ -3678,6 +3684,8 @@ c1
select * from mysqldump_myDB.u1;
f1
4
+connection root;
+disconnect user1;
use mysqldump_myDB;
drop view v1;
drop table t1;
@@ -3685,6 +3693,8 @@ 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;
use test;
#
# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the
@@ -3729,8 +3739,8 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="test">
<table_structure name="t1">
- <field Field="f1" Type="int(10)" Null="YES" Key="" Extra="" Comment="" />
- <field Field="data" Type="mediumblob" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="f1" Type="int(10)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
+ <field Field="data" Type="mediumblob" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
</table_structure>
<table_data name="t1">
<row>
@@ -3837,6 +3847,8 @@ use test;
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';
-- insufficient privileges to SHOW CREATE PROCEDURE `sp1`
@@ -3849,7 +3861,7 @@ create procedure mysqldump_test_db.sp1() select 'hello';
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`user1`@`%` PROCEDURE `sp1`()
select 'hello' ;;
@@ -3859,6 +3871,8 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
drop procedure sp1;
+connection default;
+disconnect user27293;
drop user user1;
drop user user2;
drop database mysqldump_test_db;
@@ -3871,7 +3885,7 @@ INSERT INTO t1 SET c1=11, c2=REPEAT('q',509);
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`c1` int(11) DEFAULT NULL,
- `c2` longblob
+ `c2` longblob DEFAULT NULL
);
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t1` VALUES (11,0x7171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171);
@@ -4544,7 +4558,7 @@ CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO SELECT "Meow";
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
-tr1 UPDATE t1 SET @f1 = 1 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr1 UPDATE t1 SET @f1 = 1 BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
test ev1 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
@@ -4563,7 +4577,7 @@ DROP PROCEDURE pr1;
reload table; this should restore table and trigger
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
-tr1 UPDATE t1 SET @f1 = 1 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr1 UPDATE t1 SET @f1 = 1 BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
SELECT name,body FROM mysql.proc WHERE NAME = 'pr1';
@@ -4572,7 +4586,7 @@ name body
reload db; this should restore routines and events
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
-tr1 UPDATE t1 SET @f1 = 1 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr1 UPDATE t1 SET @f1 = 1 BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
test ev1 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
@@ -4667,7 +4681,7 @@ CREATE TABLE `comment_table` (i INT COMMENT 'FIELD COMMENT') COMMENT = 'TABLE CO
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="test">
<table_structure name="comment_table">
- <field Field="i" Type="int(11)" Null="YES" Key="" Extra="" Comment="FIELD COMMENT" />
+ <field Field="i" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="FIELD COMMENT" />
</table_structure>
<table_data name="comment_table">
</table_data>
@@ -4764,8 +4778,8 @@ CREATE VIEW v2 AS SELECT * FROM t2;
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="BUG52792">
<table_structure name="t1">
- <field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
- <field Field="c2" Type="varchar(20)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
+ <field Field="c2" Type="varchar(20)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
<options Name="t1" Engine="MyISAM" Version="10" Row_format="Dynamic" Rows="3" Avg_row_length="20" Data_length="60" Max_data_length="281474976710655" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" />
</table_structure>
<table_data name="t1">
@@ -4783,7 +4797,7 @@ CREATE VIEW v2 AS SELECT * FROM t2;
</row>
</table_data>
<table_structure name="t2">
- <field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
<options Name="t2" Engine="MyISAM" Version="10" Row_format="Fixed" Rows="3" Avg_row_length="7" Data_length="21" Max_data_length="1970324836974591" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" />
</table_structure>
<table_data name="t2">
@@ -4798,7 +4812,7 @@ CREATE VIEW v2 AS SELECT * FROM t2;
</row>
</table_data>
<triggers name="t2">
- <trigger Trigger="trig1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
+ <trigger Trigger="trig1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci" Created="--TIME--">
<![CDATA[
CREATE DEFINER=`root`@`localhost` TRIGGER trig1 BEFORE INSERT ON t2
FOR EACH ROW BEGIN
@@ -4806,7 +4820,7 @@ INSERT INTO t2 VALUES(1);
END
]]>
</trigger>
- <trigger Trigger="trig2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
+ <trigger Trigger="trig2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci" Created="--TIME--">
<![CDATA[
CREATE DEFINER=`root`@`localhost` TRIGGER trig2 AFTER INSERT ON t2
FOR EACH ROW BEGIN
@@ -4819,12 +4833,12 @@ END
</trigger>
</triggers>
<table_structure name="v1">
- <field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
- <field Field="c2" Type="varchar(20)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
+ <field Field="c2" Type="varchar(20)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
<options Name="v1" Comment="VIEW" />
</table_structure>
<table_structure name="v2">
- <field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
<options Name="v2" Comment="VIEW" />
</table_structure>
<events>
@@ -4887,8 +4901,8 @@ END
-->
<table_structure name="t1">
- <field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
- <field Field="c2" Type="varchar(20)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
+ <field Field="c2" Type="varchar(20)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
<options Name="t1" Engine="MyISAM" Version="10" Row_format="Dynamic" Rows="3" Avg_row_length="20" Data_length="60" Max_data_length="281474976710655" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" />
</table_structure>
<!--
@@ -4917,7 +4931,7 @@ END
-->
<table_structure name="t2">
- <field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
<options Name="t2" Engine="MyISAM" Version="10" Row_format="Fixed" Rows="3" Avg_row_length="7" Data_length="21" Max_data_length="1970324836974591" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" />
</table_structure>
<!--
@@ -4937,7 +4951,7 @@ END
</row>
</table_data>
<triggers name="t2">
- <trigger Trigger="trig1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
+ <trigger Trigger="trig1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci" Created="--TIME--">
<![CDATA[
CREATE DEFINER=`root`@`localhost` TRIGGER trig1 BEFORE INSERT ON t2
FOR EACH ROW BEGIN
@@ -4945,7 +4959,7 @@ INSERT INTO t2 VALUES(1);
END
]]>
</trigger>
- <trigger Trigger="trig2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
+ <trigger Trigger="trig2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci" Created="--TIME--">
<![CDATA[
CREATE DEFINER=`root`@`localhost` TRIGGER trig2 AFTER INSERT ON t2
FOR EACH ROW BEGIN
@@ -4964,8 +4978,8 @@ END
-->
<table_structure name="v1">
- <field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
- <field Field="c2" Type="varchar(20)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
+ <field Field="c2" Type="varchar(20)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
<options Name="v1" Comment="VIEW" />
</table_structure>
<!--
@@ -4975,7 +4989,7 @@ END
-->
<table_structure name="v2">
- <field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
<options Name="v2" Comment="VIEW" />
</table_structure>
<!--
@@ -5038,13 +5052,15 @@ END
# Test to check 'Insufficient privileges' error.
GRANT ALL PRIVILEGES ON BUG52792.* TO user1;
+connect conn_1, localhost, user1, , BUG52792, $MASTER_MYPORT, $MASTER_MYSOCK;
+connection conn_1;
# Running 'replace_regex on timestamp'
<?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="BUG52792">
<table_structure name="t1">
- <field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
- <field Field="c2" Type="varchar(20)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
+ <field Field="c2" Type="varchar(20)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
<options Name="t1" Engine="MyISAM" Version="10" Row_format="Dynamic" Rows="3" Avg_row_length="20" Data_length="60" Max_data_length="281474976710655" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" />
</table_structure>
<table_data name="t1">
@@ -5062,7 +5078,7 @@ GRANT ALL PRIVILEGES ON BUG52792.* TO user1;
</row>
</table_data>
<table_structure name="t2">
- <field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
<options Name="t2" Engine="MyISAM" Version="10" Row_format="Fixed" Rows="3" Avg_row_length="7" Data_length="21" Max_data_length="1970324836974591" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" />
</table_structure>
<table_data name="t2">
@@ -5077,7 +5093,7 @@ GRANT ALL PRIVILEGES ON BUG52792.* TO user1;
</row>
</table_data>
<triggers name="t2">
- <trigger Trigger="trig1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
+ <trigger Trigger="trig1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci" Created="--TIME--">
<![CDATA[
CREATE DEFINER=`root`@`localhost` TRIGGER trig1 BEFORE INSERT ON t2
FOR EACH ROW BEGIN
@@ -5085,7 +5101,7 @@ INSERT INTO t2 VALUES(1);
END
]]>
</trigger>
- <trigger Trigger="trig2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
+ <trigger Trigger="trig2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci" Created="--TIME--">
<![CDATA[
CREATE DEFINER=`root`@`localhost` TRIGGER trig2 AFTER INSERT ON t2
FOR EACH ROW BEGIN
@@ -5098,12 +5114,12 @@ END
</trigger>
</triggers>
<table_structure name="v1">
- <field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
- <field Field="c2" Type="varchar(20)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
+ <field Field="c2" Type="varchar(20)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
<options Name="v1" Comment="VIEW" />
</table_structure>
<table_structure name="v2">
- <field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
<options Name="v2" Comment="VIEW" />
</table_structure>
<events>
@@ -5125,6 +5141,8 @@ CREATE DEFINER=`root`@`localhost` EVENT `e2` ON SCHEDULE EVERY 1 SECOND STARTS '
<!-- - does user1 have permissions on mysql.proc?
-->
+connection default;
+disconnect conn_1;
DROP USER user1;
DROP DATABASE BUG52792;
# UTF-8
@@ -5239,7 +5257,7 @@ DROP DATABASE mysql;
SHOW CREATE TABLE mysql.general_log;
Table Create Table
general_log CREATE TABLE `general_log` (
- `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`thread_id` bigint(21) unsigned NOT NULL,
`server_id` int(10) unsigned NOT NULL,
@@ -5249,7 +5267,7 @@ general_log CREATE TABLE `general_log` (
SHOW CREATE TABLE mysql.slow_log;
Table Create Table
slow_log CREATE TABLE `slow_log` (
- `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`query_time` time(6) NOT NULL,
`lock_time` time(6) NOT NULL,
@@ -5342,7 +5360,7 @@ SHOW TRIGGERS FROM bug25717383;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trig
one INSERT tab
-one SET NEW.a = 1 BEFORE NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci
+one SET NEW.a = 1 BEFORE # root@localhost utf8 utf8_general_ci latin1_swedish_ci
SHOW EVENTS FROM bug25717383;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
bug25717383 event
@@ -5363,7 +5381,7 @@ SHOW TRIGGERS FROM bug25717383;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trig
one INSERT tab
-one SET NEW.a = 1 BEFORE NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci
+one SET NEW.a = 1 BEFORE # root@localhost utf8 utf8_general_ci latin1_swedish_ci
SHOW EVENTS FROM bug25717383;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
bug25717383 event
@@ -5578,4 +5596,53 @@ USE `db1`;
DROP DATABASE db1;
DROP DATABASE db2;
-FOUND /Database: mysql/ in bug11505.sql
+FOUND 1 /Database: mysql/ in bug11505.sql
+#
+# Test for --add-drop-trigger
+#
+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);
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `test`;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = '' */ ;
+/*!50032 DROP TRIGGER IF EXISTS tt1_t1 */;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tt1_t1 BEFORE INSERT ON t1 FOR EACH ROW
+SET NEW.b=NEW.a + 10 */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+DROP TABLE t1;
diff --git a/mysql-test/r/mysqlhotcopy_myisam.result b/mysql-test/r/mysqlhotcopy_myisam.result
index 52aeffce5cf..6080697a7a1 100644
--- a/mysql-test/r/mysqlhotcopy_myisam.result
+++ b/mysql-test/r/mysqlhotcopy_myisam.result
@@ -6,13 +6,13 @@ CREATE TABLE t2 (c1 int, c2 varchar(20)) ENGINE=MyISAM;
CREATE TABLE t3 (c1 int, c2 varchar(20)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
Warnings:
-Warning 1265 Data truncated for column 'c2' at row 2
+Warning 1406 Data too long for column 'c2' at row 2
INSERT INTO t2 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
Warnings:
-Warning 1265 Data truncated for column 'c2' at row 2
+Warning 1406 Data too long for column 'c2' at row 2
INSERT INTO t3 VALUES (1,'aaaaaaaaaaaaaaaaaaaa'),(2, 'bbbbbbbbbbbbbbbbbbbbbbb');
Warnings:
-Warning 1265 Data truncated for column 'c2' at row 2
+Warning 1406 Data too long for column 'c2' at row 2
db.opt
t1.MYD
t1.MYI
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index f904207d2da..fe269152357 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -183,6 +183,8 @@ select 7;
7
mysqltest: At line 1: End of line junk detected: "OCNE"
connect con1,localhost,root,,;
+connection default;
+disconnect con1;
select 5 from t1;
lower
case
@@ -562,14 +564,24 @@ mysqltest: At line 1: query 'connect con2,localhost,root,,illegal_db' failed: 1
mysqltest: At line 1: Illegal argument for port: 'illegal_port'
mysqltest: At line 1: Illegal option to connect: SMTP
200 connects succeeded
+connect test_con1,localhost,root,,;
+disconnect test_con1;
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql":
included from <stdin> at line 1:
At line 3: connection 'test_con1' not found in connection pool
+connect test_con1,localhost,root,,;
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql":
included from <stdin> at line 1:
At line 2: Connection test_con1 already exists
+connect con1,localhost,root,,;
+connection default;
+connection con1;
+disconnect con1;
+connect con2,localhost,root,,*NO-ONE*;
show tables;
ERROR 3D000: No database selected
+disconnect con2;
+connection default;
connect con1,localhost,root,,;
connection default;
connection con1;
@@ -953,15 +965,25 @@ select 1;
1
-- a comment for the server;
mysqltest: At line 1: Found line beginning with -- that didn't contain a valid mysqltest command, check your syntax or use # if you intended to write a comment
+connect con1,localhost,root,,;
con1
+connect con2,localhost,root,,;
con2
+connection default;
default
+connection con1;
con1
+connection con2;
con2
+connection con1;
con1
+connection con2;
con2
+disconnect con1;
con2
+disconnect con2;
-closed_connection-
+connection default;
set sql_mode=no_backslash_escapes;
select "foo\""bar";
foo\"bar
diff --git a/mysql-test/r/mysqltest_ps.result b/mysql-test/r/mysqltest_ps.result
index dcf73455055..153098ff088 100644
--- a/mysql-test/r/mysqltest_ps.result
+++ b/mysql-test/r/mysqltest_ps.result
@@ -4,8 +4,6 @@ select 1 + "2 a";
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '2 a'
create table t (a int primary key, b blob default '');
-Warnings:
-Warning 1101 BLOB/TEXT column 'b' can't have a default value
select a, (2*a) AS a from t group by a;
a a
Warnings:
@@ -17,8 +15,6 @@ select 1 + "2 a";
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '2 a'
create table t (a int primary key, b blob default '');
-Warnings:
-Warning 1101 BLOB/TEXT column 'b' can't have a default value
select a, (2*a) AS a from t group by a;
a a
Warnings:
@@ -31,8 +27,6 @@ select 1 + "2 a";
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '2 a'
create table t (a int primary key, b blob default '');
-Warnings:
-Warning 1101 BLOB/TEXT column 'b' can't have a default value
select a, (2*a) AS a from t group by a;
a a
Warnings:
diff --git a/mysql-test/r/named_pipe.result b/mysql-test/r/named_pipe.result
index 43fb44beece..66da9a874b4 100644
--- a/mysql-test/r/named_pipe.result
+++ b/mysql-test/r/named_pipe.result
@@ -1,3 +1,4 @@
+connect pipe_con,localhost,root,,,,,PIPE;
drop table if exists t1,t2,t3,t4;
CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
@@ -601,7 +602,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
+1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
1 SIMPLE t3 ref period period 4 test.t1.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
id select_type table type possible_keys key key_len ref rows Extra
@@ -1508,7 +1509,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
Warnings:
-Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> ''))
+Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> ''
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
@@ -2154,4 +2155,6 @@ Privat (Private Nutzung) Mobilfunk
Warnings:
Warning 1052 Column 'kundentyp' in group statement is ambiguous
drop table t1;
-FOUND /\[ERROR\] Create named pipe failed/ in second-mysqld.err
+connection default;
+disconnect pipe_con;
+FOUND 1 /\[ERROR\] Create named pipe failed/ in second-mysqld.err
diff --git a/mysql-test/r/negation_elimination.result b/mysql-test/r/negation_elimination.result
index aea6518b676..1b08baee60a 100644
--- a/mysql-test/r/negation_elimination.result
+++ b/mysql-test/r/negation_elimination.result
@@ -482,13 +482,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE NOT ((NOT a) XOR (a));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL a 5 NULL 21 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` xor `test`.`t1`.`a`)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` xor `test`.`t1`.`a`
# Should be simplified to "...WHERE (a XOR a)
EXPLAIN EXTENDED SELECT * FROM t1 WHERE NOT (a XOR (NOT a));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL a 5 NULL 21 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` xor `test`.`t1`.`a`)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` xor `test`.`t1`.`a`
# End XOR
delete from t1 where a > 3;
select a, not(not(a)) from t1;
@@ -502,5 +502,5 @@ explain extended select a, not(not(a)), not(a <= 2 and not(a)), not(a not like "
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 5 NULL 4 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a` <> 0) AS `not(not(a))`,((`test`.`t1`.`a` > 2) or (`test`.`t1`.`a` <> 0)) AS `not(a <= 2 and not(a))`,(`test`.`t1`.`a` like '1') AS `not(a not like "1")`,(`test`.`t1`.`a` in (1,2)) AS `not (a not in (1,2))`,(`test`.`t1`.`a` = 2) AS `not(a != 2)` from `test`.`t1` where (`test`.`t1`.`a` <> 0) having (`test`.`t1`.`a` <> 0)
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a` <> 0 AS `not(not(a))`,`test`.`t1`.`a` > 2 or `test`.`t1`.`a` <> 0 AS `not(a <= 2 and not(a))`,`test`.`t1`.`a` like '1' AS `not(a not like "1")`,`test`.`t1`.`a` in (1,2) AS `not (a not in (1,2))`,`test`.`t1`.`a` = 2 AS `not(a != 2)` from `test`.`t1` where `test`.`t1`.`a` <> 0 having `test`.`t1`.`a` <> 0
drop table t1;
diff --git a/mysql-test/r/no_password_column-mdev-11170.result b/mysql-test/r/no_password_column-mdev-11170.result
new file mode 100644
index 00000000000..81eecc95558
--- /dev/null
+++ b/mysql-test/r/no_password_column-mdev-11170.result
@@ -0,0 +1,168 @@
+#
+# MDEV-11170: MariaDB 10.2 cannot start on MySQL 5.7 datadir:
+# Fatal error: mysql.user table is damaged or in
+# unsupported 3.20 format
+#
+create table backup_user like mysql.user;
+insert into backup_user select * from mysql.user;
+#
+# Original mysql.user table
+#
+describe mysql.user;
+Field Type Null Key Default Extra
+Host char(60) NO PRI
+User char(80) NO PRI
+Password char(41) NO
+Select_priv enum('N','Y') NO N
+Insert_priv enum('N','Y') NO N
+Update_priv enum('N','Y') NO N
+Delete_priv enum('N','Y') NO N
+Create_priv enum('N','Y') NO N
+Drop_priv enum('N','Y') NO N
+Reload_priv enum('N','Y') NO N
+Shutdown_priv enum('N','Y') NO N
+Process_priv enum('N','Y') NO N
+File_priv enum('N','Y') NO N
+Grant_priv enum('N','Y') NO N
+References_priv enum('N','Y') NO N
+Index_priv enum('N','Y') NO N
+Alter_priv enum('N','Y') NO N
+Show_db_priv enum('N','Y') NO N
+Super_priv enum('N','Y') NO N
+Create_tmp_table_priv enum('N','Y') NO N
+Lock_tables_priv enum('N','Y') NO N
+Execute_priv enum('N','Y') NO N
+Repl_slave_priv enum('N','Y') NO N
+Repl_client_priv enum('N','Y') NO N
+Create_view_priv enum('N','Y') NO N
+Show_view_priv enum('N','Y') NO N
+Create_routine_priv enum('N','Y') NO N
+Alter_routine_priv enum('N','Y') NO N
+Create_user_priv enum('N','Y') NO N
+Event_priv enum('N','Y') NO N
+Trigger_priv enum('N','Y') NO N
+Create_tablespace_priv enum('N','Y') NO N
+ssl_type enum('','ANY','X509','SPECIFIED') NO
+ssl_cipher blob NO NULL
+x509_issuer blob NO NULL
+x509_subject blob NO NULL
+max_questions int(11) unsigned NO 0
+max_updates int(11) unsigned NO 0
+max_connections int(11) unsigned NO 0
+max_user_connections int(11) NO 0
+plugin char(64) NO
+authentication_string text NO NULL
+password_expired enum('N','Y') NO N
+is_role enum('N','Y') NO N
+default_role char(80) NO
+max_statement_time decimal(12,6) NO 0.000000
+#
+# Drop the password column.
+#
+alter table mysql.user drop column password;
+flush privileges;
+#
+# Create users without the password column present.
+#
+create user foo;
+create user goo identified by "foo";
+select OLD_PASSWORD("ioo");
+OLD_PASSWORD("ioo")
+7a8f886d28473e85
+create user ioo identified with "mysql_old_password" as "7a8f886d28473e85";
+#
+# Check if users have grants loaded correctly.
+#
+show grants for foo;
+Grants for foo@%
+GRANT USAGE ON *.* TO 'foo'@'%'
+show grants for goo;
+Grants for goo@%
+GRANT USAGE ON *.* TO 'goo'@'%' IDENTIFIED BY PASSWORD '*F3A2A51A9B0F2BE2468926B4132313728C250DBF'
+show grants for ioo;
+Grants for ioo@%
+GRANT USAGE ON *.* TO 'ioo'@'%' IDENTIFIED BY PASSWORD '7a8f886d28473e85'
+select user, host, select_priv, plugin, authentication_string from mysql.user
+where user like "%oo"
+order by user;
+user host select_priv plugin authentication_string
+foo % N
+goo % N mysql_native_password *F3A2A51A9B0F2BE2468926B4132313728C250DBF
+ioo % N mysql_old_password 7a8f886d28473e85
+#
+# Test setting password.
+#
+SET PASSWORD FOR foo=PASSWORD("bar");
+show grants for foo;
+Grants for foo@%
+GRANT USAGE ON *.* TO 'foo'@'%' IDENTIFIED BY PASSWORD '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB'
+show grants for goo;
+Grants for goo@%
+GRANT USAGE ON *.* TO 'goo'@'%' IDENTIFIED BY PASSWORD '*F3A2A51A9B0F2BE2468926B4132313728C250DBF'
+show grants for ioo;
+Grants for ioo@%
+GRANT USAGE ON *.* TO 'ioo'@'%' IDENTIFIED BY PASSWORD '7a8f886d28473e85'
+select user, host, select_priv, plugin, authentication_string from mysql.user
+where user like "%oo"
+order by user;
+user host select_priv plugin authentication_string
+foo % N mysql_native_password *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB
+goo % N mysql_native_password *F3A2A51A9B0F2BE2468926B4132313728C250DBF
+ioo % N mysql_old_password 7a8f886d28473e85
+#
+# Test flush privileges without password column.
+#
+flush privileges;
+show grants for foo;
+Grants for foo@%
+GRANT USAGE ON *.* TO 'foo'@'%' IDENTIFIED BY PASSWORD '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB'
+show grants for goo;
+Grants for goo@%
+GRANT USAGE ON *.* TO 'goo'@'%' IDENTIFIED BY PASSWORD '*F3A2A51A9B0F2BE2468926B4132313728C250DBF'
+show grants for ioo;
+Grants for ioo@%
+GRANT USAGE ON *.* TO 'ioo'@'%' IDENTIFIED BY PASSWORD '7a8f886d28473e85'
+#
+# Test granting of privileges.
+#
+grant select on *.* to foo;
+grant select on *.* to goo;
+grant select on *.* to ioo;
+show grants for foo;
+Grants for foo@%
+GRANT SELECT ON *.* TO 'foo'@'%' IDENTIFIED BY PASSWORD '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB'
+show grants for goo;
+Grants for goo@%
+GRANT SELECT ON *.* TO 'goo'@'%' IDENTIFIED BY PASSWORD '*F3A2A51A9B0F2BE2468926B4132313728C250DBF'
+show grants for ioo;
+Grants for ioo@%
+GRANT SELECT ON *.* TO 'ioo'@'%' IDENTIFIED BY PASSWORD '7a8f886d28473e85'
+#
+# Check to see if grants are stable on flush.
+#
+flush privileges;
+show grants for foo;
+Grants for foo@%
+GRANT SELECT ON *.* TO 'foo'@'%' IDENTIFIED BY PASSWORD '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB'
+show grants for goo;
+Grants for goo@%
+GRANT SELECT ON *.* TO 'goo'@'%' IDENTIFIED BY PASSWORD '*F3A2A51A9B0F2BE2468926B4132313728C250DBF'
+show grants for ioo;
+Grants for ioo@%
+GRANT SELECT ON *.* TO 'ioo'@'%' IDENTIFIED BY PASSWORD '7a8f886d28473e85'
+#
+# Check internal table representation.
+#
+select user, host, select_priv, plugin, authentication_string from mysql.user
+where user like "%oo"
+order by user;
+user host select_priv plugin authentication_string
+foo % Y mysql_native_password *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB
+goo % Y mysql_native_password *F3A2A51A9B0F2BE2468926B4132313728C250DBF
+ioo % Y mysql_old_password 7a8f886d28473e85
+#
+# Reset to final original state.
+#
+drop table mysql.user;
+rename table backup_user to mysql.user;
+flush privileges;
diff --git a/mysql-test/r/non_blocking_api.result b/mysql-test/r/non_blocking_api.result
index 248e372593b..4cb5c270f38 100644
--- a/mysql-test/r/non_blocking_api.result
+++ b/mysql-test/r/non_blocking_api.result
@@ -1,4 +1,7 @@
drop table if exists t1;
+connect con_nonblock,localhost,root,,test;
+connect con_normal,localhost,root,,test;
+connection con_nonblock;
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
@@ -7,4 +10,5 @@ a
SELECT * FROM t1;
a
1
+connection con_normal;
DROP TABLE t1;
diff --git a/mysql-test/r/not_embedded_server.result b/mysql-test/r/not_embedded_server.result
index 1cd54b131c3..ba68ca8619b 100644
--- a/mysql-test/r/not_embedded_server.result
+++ b/mysql-test/r/not_embedded_server.result
@@ -23,7 +23,7 @@ DROP TABLE t1;
# Bug#54812: assert in Diagnostics_area::set_ok_status during EXPLAIN
#
CREATE USER nopriv_user@localhost;
-connection: default
+connection default;
DROP TABLE IF EXISTS t1,t2,t3;
DROP FUNCTION IF EXISTS f;
CREATE TABLE t1 (key1 INT PRIMARY KEY);
@@ -32,7 +32,8 @@ INSERT INTO t1 VALUES (1),(2);
CREATE FUNCTION f() RETURNS INT RETURN 1;
GRANT FILE ON *.* TO 'nopriv_user'@'localhost';
FLUSH PRIVILEGES;
-connection: con1
+connect con1,localhost,nopriv_user,,;
+connection con1;
SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE '<outfile>';
ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
INSERT INTO t2 SELECT MAX(key1) FROM t1 WHERE f() < 1;
@@ -41,7 +42,8 @@ SELECT MAX(key1) INTO @dummy FROM t1 WHERE f() < 1;
ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
CREATE TABLE t3 (i INT) AS SELECT MAX(key1) FROM t1 WHERE f() < 1;
ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
-connection: default
+disconnect con1;
+connection default;
DROP TABLE t1,t2;
DROP FUNCTION f;
DROP USER nopriv_user@localhost;
diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result
index d25e78c1ce4..0ff5c3243d8 100644
--- a/mysql-test/r/null.result
+++ b/mysql-test/r/null.result
@@ -2,11 +2,15 @@ drop table if exists t1, t2;
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;
NULL NULL isnull(null) isnull(1/0) isnull(1/0 = null) ifnull(null,1) ifnull(null,"TRUE") ifnull("TRUE","ERROR") 1/0 is null 1 is not null
NULL NULL 1 1 1 1 TRUE TRUE 1 1
+Warnings:
+Warning 1365 Division by 0
+Warning 1365 Division by 0
+Warning 1365 Division by 0
explain extended select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select NULL AS `NULL`,NULL AS `NULL`,isnull(NULL) AS `isnull(null)`,isnull((1 / 0)) AS `isnull(1/0)`,isnull(((1 / 0) = NULL)) AS `isnull(1/0 = null)`,ifnull(NULL,1) AS `ifnull(null,1)`,ifnull(NULL,'TRUE') AS `ifnull(null,"TRUE")`,ifnull('TRUE','ERROR') AS `ifnull("TRUE","ERROR")`,isnull((1 / 0)) AS `1/0 is null`,(1 is not null) AS `1 is not null`
+Note 1003 select NULL AS `NULL`,NULL AS `NULL`,NULL is null AS `isnull(null)`,1 / 0 is null AS `isnull(1/0)`,1 / 0 = NULL is null AS `isnull(1/0 = null)`,ifnull(NULL,1) AS `ifnull(null,1)`,ifnull(NULL,'TRUE') AS `ifnull(null,"TRUE")`,ifnull('TRUE','ERROR') AS `ifnull("TRUE","ERROR")`,1 / 0 is null AS `1/0 is null`,1 is not null AS `1 is not null`
select 1 | NULL,1 & NULL,1+NULL,1-NULL;
1 | NULL 1 & NULL 1+NULL 1-NULL
NULL NULL NULL NULL
@@ -32,7 +36,7 @@ explain extended select 2 between null and 1,2 between 3 AND NULL,NULL between 1
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select (2 between NULL and 1) AS `2 between null and 1`,(2 between 3 and NULL) AS `2 between 3 AND NULL`,(NULL between 1 and 2) AS `NULL between 1 and 2`,(2 between NULL and 3) AS `2 between NULL and 3`,(2 between 1 and NULL) AS `2 between 1 AND null`
+Note 1003 select 2 between NULL and 1 AS `2 between null and 1`,2 between 3 and NULL AS `2 between 3 AND NULL`,NULL between 1 and 2 AS `NULL between 1 and 2`,2 between NULL and 3 AS `2 between NULL and 3`,2 between 1 and NULL AS `2 between 1 AND null`
SELECT NULL AND NULL, 1 AND NULL, NULL AND 1, NULL OR NULL, 0 OR NULL, NULL OR 0;
NULL AND NULL 1 AND NULL NULL AND 1 NULL OR NULL 0 OR NULL NULL OR 0
NULL NULL NULL NULL NULL NULL
@@ -50,6 +54,9 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select inet_ntoa(NULL) AS `inet_ntoa(null)`,inet_aton(NULL) AS `inet_aton(null)`,inet_aton('122.256') AS `inet_aton("122.256")`,inet_aton('122.226.') AS `inet_aton("122.226.")`,inet_aton('') AS `inet_aton("")`
+select not null is true, not null or true, not null and false, not null <=> null;
+not null is true not null or true not null and false not null <=> null
+1 1 0 0
create table t1 (x int);
insert into t1 values (null);
select * from t1 where x != 0;
@@ -89,20 +96,20 @@ NULL this is null
NULL this is null
drop table t1;
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 INTO t1 SET a = "", d= "2003-01-14 03:54:55";
+INSERT IGNORE INTO t1 SET a = "", d= "2003-01-14 03:54:55";
Warnings:
Warning 1265 Data truncated for column 'd' at row 1
-UPDATE t1 SET d=1/NULL;
+UPDATE IGNORE t1 SET d=1/NULL;
Warnings:
Warning 1048 Column 'd' cannot be null
-UPDATE t1 SET d=NULL;
+UPDATE IGNORE t1 SET d=NULL;
Warnings:
Warning 1048 Column 'd' cannot be null
INSERT INTO t1 (a) values (null);
ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 (a) values (1/null);
ERROR 23000: Column 'a' cannot be null
-INSERT INTO t1 (a) values (null),(null);
+INSERT IGNORE INTO t1 (a) values (null),(null);
Warnings:
Warning 1048 Column 'a' cannot be null
Warning 1048 Column 'a' cannot be null
@@ -110,7 +117,7 @@ INSERT INTO t1 (b) values (null);
ERROR 23000: Column 'b' cannot be null
INSERT INTO t1 (b) values (1/null);
ERROR 23000: Column 'b' cannot be null
-INSERT INTO t1 (b) values (null),(null);
+INSERT IGNORE INTO t1 (b) values (null),(null);
Warnings:
Warning 1048 Column 'b' cannot be null
Warning 1048 Column 'b' cannot be null
@@ -118,7 +125,7 @@ INSERT INTO t1 (c) values (null);
ERROR 23000: Column 'c' cannot be null
INSERT INTO t1 (c) values (1/null);
ERROR 23000: Column 'c' cannot be null
-INSERT INTO t1 (c) values (null),(null);
+INSERT IGNORE INTO t1 (c) values (null),(null);
Warnings:
Warning 1048 Column 'c' cannot be null
Warning 1048 Column 'c' cannot be null
@@ -126,7 +133,7 @@ INSERT INTO t1 (d) values (null);
ERROR 23000: Column 'd' cannot be null
INSERT INTO t1 (d) values (1/null);
ERROR 23000: Column 'd' cannot be null
-INSERT INTO t1 (d) values (null),(null);
+INSERT IGNORE INTO t1 (d) values (null),(null);
Warnings:
Warning 1048 Column 'd' cannot be null
Warning 1048 Column 'd' cannot be null
@@ -174,6 +181,7 @@ id select_type table type possible_keys key key_len ref rows Extra
select count(*) from t1 where i=2 or i is null;
count(*)
10
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 change i i int not null;
Warnings:
Warning 1265 Data truncated for column 'i' at row 513
@@ -351,7 +359,7 @@ INSERT INTO t1 VALUES (NOW()),(NOW());
EXPLAIN
SELECT * FROM t1 WHERE concat( dt, '2012-12-21 12:12:12' ) IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
SELECT * FROM t1 WHERE concat( dt, '2012-12-21 12:12:12' ) IS NULL;
dt
DROP TABLE t1;
@@ -360,7 +368,7 @@ INSERT INTO t1 VALUES (1),(2);
EXPLAIN
SELECT * FROM t1 WHERE concat( dt, '1' ) IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
SELECT * FROM t1 WHERE concat( dt, '1' ) IS NULL;
dt
DROP TABLE t1;
@@ -369,7 +377,7 @@ INSERT INTO t1 VALUES (1),(2);
EXPLAIN
SELECT * FROM t1 WHERE NOT (concat( dt, '1' ) IS NOT NULL);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
SELECT * FROM t1 WHERE NOT (concat( dt, '1' ) IS NOT NULL);
dt
DROP TABLE t1;
@@ -426,6 +434,7 @@ t2 CREATE TABLE `t2` (
DROP TABLE t1,t2;
SELECT NULLIF(_latin1'a' COLLATE latin1_general_ci, _latin1'a' COLLATE latin1_bin);
ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'nullif'
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t1 AS SELECT
NULLIF(1,1),
NULLIF(1,1.0),
@@ -444,6 +453,7 @@ t1 CREATE TABLE `t1` (
`NULLIF(1,TIME'00:00:00')` int(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
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),
@@ -462,6 +472,7 @@ t1 CREATE TABLE `t1` (
`NULLIF(1.0,TIME'00:00:00')` decimal(2,1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t1 AS SELECT
NULLIF(1e0,1),
NULLIF(1e0,1.0),
@@ -496,6 +507,7 @@ t1 CREATE TABLE `t1` (
`NULLIF('1',TIME'00:00:00')` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
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),
@@ -516,6 +528,7 @@ t1 CREATE TABLE `t1` (
`NULLIF(TIMESTAMP'2001-01-01 00:00:00',TIME'00:00:00')` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
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),
@@ -906,22 +919,22 @@ FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `NULLIF(c_text, 1)` longtext,
- `NULLIF(c_text, c_smallint)` longtext,
- `NULLIF(c_text, c_tinyint)` longtext,
- `NULLIF(c_text, c_int)` longtext,
- `NULLIF(c_text, c_bigint)` longtext,
- `NULLIF(c_text, c_float)` longtext,
- `NULLIF(c_text, c_double)` longtext,
- `NULLIF(c_text, c_decimal103)` longtext,
- `NULLIF(c_text, c_varchar10)` longtext,
- `NULLIF(c_text, c_text)` longtext,
- `NULLIF(c_text, c_blob)` longtext,
- `NULLIF(c_text, c_enum)` longtext,
- `NULLIF(c_text, c_datetime3)` longtext,
- `NULLIF(c_text, c_timestamp3)` longtext,
- `NULLIF(c_text, c_date)` longtext,
- `NULLIF(c_text, c_time)` longtext
+ `NULLIF(c_text, 1)` longtext DEFAULT NULL,
+ `NULLIF(c_text, c_smallint)` longtext DEFAULT NULL,
+ `NULLIF(c_text, c_tinyint)` longtext DEFAULT NULL,
+ `NULLIF(c_text, c_int)` longtext DEFAULT NULL,
+ `NULLIF(c_text, c_bigint)` longtext DEFAULT NULL,
+ `NULLIF(c_text, c_float)` longtext DEFAULT NULL,
+ `NULLIF(c_text, c_double)` longtext DEFAULT NULL,
+ `NULLIF(c_text, c_decimal103)` longtext DEFAULT NULL,
+ `NULLIF(c_text, c_varchar10)` longtext DEFAULT NULL,
+ `NULLIF(c_text, c_text)` longtext DEFAULT NULL,
+ `NULLIF(c_text, c_blob)` longtext DEFAULT NULL,
+ `NULLIF(c_text, c_enum)` longtext DEFAULT NULL,
+ `NULLIF(c_text, c_datetime3)` longtext DEFAULT NULL,
+ `NULLIF(c_text, c_timestamp3)` longtext DEFAULT NULL,
+ `NULLIF(c_text, c_date)` longtext DEFAULT NULL,
+ `NULLIF(c_text, c_time)` longtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT
@@ -945,22 +958,22 @@ FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `NULLIF(c_blob, 1)` longblob,
- `NULLIF(c_blob, c_smallint)` longblob,
- `NULLIF(c_blob, c_tinyint)` longblob,
- `NULLIF(c_blob, c_int)` longblob,
- `NULLIF(c_blob, c_bigint)` longblob,
- `NULLIF(c_blob, c_float)` longblob,
- `NULLIF(c_blob, c_double)` longblob,
- `NULLIF(c_blob, c_decimal103)` longblob,
- `NULLIF(c_blob, c_varchar10)` longblob,
- `NULLIF(c_blob, c_text)` longblob,
- `NULLIF(c_blob, c_blob)` longblob,
- `NULLIF(c_blob, c_enum)` longblob,
- `NULLIF(c_blob, c_datetime3)` longblob,
- `NULLIF(c_blob, c_timestamp3)` longblob,
- `NULLIF(c_blob, c_date)` longblob,
- `NULLIF(c_blob, c_time)` longblob
+ `NULLIF(c_blob, 1)` longblob DEFAULT NULL,
+ `NULLIF(c_blob, c_smallint)` longblob DEFAULT NULL,
+ `NULLIF(c_blob, c_tinyint)` longblob DEFAULT NULL,
+ `NULLIF(c_blob, c_int)` longblob DEFAULT NULL,
+ `NULLIF(c_blob, c_bigint)` longblob DEFAULT NULL,
+ `NULLIF(c_blob, c_float)` longblob DEFAULT NULL,
+ `NULLIF(c_blob, c_double)` longblob DEFAULT NULL,
+ `NULLIF(c_blob, c_decimal103)` longblob DEFAULT NULL,
+ `NULLIF(c_blob, c_varchar10)` longblob DEFAULT NULL,
+ `NULLIF(c_blob, c_text)` longblob DEFAULT NULL,
+ `NULLIF(c_blob, c_blob)` longblob DEFAULT NULL,
+ `NULLIF(c_blob, c_enum)` longblob DEFAULT NULL,
+ `NULLIF(c_blob, c_datetime3)` longblob DEFAULT NULL,
+ `NULLIF(c_blob, c_timestamp3)` longblob DEFAULT NULL,
+ `NULLIF(c_blob, c_date)` longblob DEFAULT NULL,
+ `NULLIF(c_blob, c_time)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t2 AS SELECT
@@ -1369,7 +1382,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND NULLIF(10.1,a) IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010
SELECT * FROM t1 WHERE a=2010 AND CASE WHEN 10.1=a THEN NULL ELSE 10.1 END IS NULL;
a
2010
@@ -1377,9 +1390,10 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND CASE WHEN 10.1=a THEN NULL EL
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010
DROP TABLE t1;
# 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
@@ -1406,7 +1420,7 @@ EXPLAIN EXTENDED SELECT NULLIF(a,_utf8'a' COLLATE utf8_bin) IS NULL AS expr FROM
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
-Note 1003 select isnull((case when convert(`test`.`t1`.`a` using utf8) = (_utf8'a' collate utf8_bin) then NULL else `test`.`t1`.`a` end)) AS `expr` from `test`.`t1`
+Note 1003 select (case when convert(`test`.`t1`.`a` using utf8) = _utf8'a' collate utf8_bin then NULL else `test`.`t1`.`a` end) is null AS `expr` from `test`.`t1`
DROP TABLE t1;
#
# MDEV-8740 Wrong result for SELECT..WHERE year_field=10 AND NULLIF(year_field,2011.1)='2011'
@@ -1429,13 +1443,13 @@ SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)='2011';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 2010) and ((case when 2010 = 2011 then NULL else `test`.`t1`.`a` end) = '2011'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 and (case when 2010 = 2011 then NULL else `test`.`t1`.`a` end) = '2011'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)=CONCAT('2011',RAND());
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 2010) and ((case when 2010 = 2011 then NULL else `test`.`t1`.`a` end) = concat('2011',rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 and (case when 2010 = 2011 then NULL else `test`.`t1`.`a` end) = concat('2011',rand())
DROP TABLE t1;
#
# MDEV-8754 Wrong result for SELECT..WHERE year_field=2020 AND NULLIF(year_field,2010)='2020'
@@ -1456,13 +1470,13 @@ SELECT * FROM t1 WHERE a=2020 AND NULLIF(a,2010)='2020';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 2020) and ((case when 2020 = 2010 then NULL else `test`.`t1`.`a` end) = '2020'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2020 and (case when 2020 = 2010 then NULL else `test`.`t1`.`a` end) = '2020'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a=2020 AND NULLIF(a,2010)=CONCAT('2020',RAND());
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 2020) and ((case when 2020 = 2010 then NULL else `test`.`t1`.`a` end) = concat('2020',rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2020 and (case when 2020 = 2010 then NULL else `test`.`t1`.`a` end) = concat('2020',rand())
DROP TABLE t1;
#
# MDEV-9181 (NULLIF(count(table.col)), 0) gives wrong result on 10.1.x
@@ -1598,7 +1612,7 @@ SELECT * FROM t1 WHERE ((c1 IS NOT NULL) >= (NOT TRUE)) IS NOT NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (((`test`.`t1`.`c1` is not null) >= <cache>((not(1)))) is not null)
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where `test`.`t1`.`c1` is not null >= 0 is not null
SELECT * FROM t1 WHERE ((c1 IS NOT NULL) >= (NOT TRUE)) IS NOT NULL;
c1
1
diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result
index 81bfa1ac994..4b4a4b80dee 100644
--- a/mysql-test/r/null_key.result
+++ b/mysql-test/r/null_key.result
@@ -342,7 +342,7 @@ id2 integer not null,
index (id),
index (id2)
);
-insert into t1 values(null,null),(1,1);
+insert ignore into t1 values(null,null),(1,1);
Warnings:
Warning 1048 Column 'id2' cannot be null
select * from t1;
diff --git a/mysql-test/r/old-mode.result b/mysql-test/r/old-mode.result
index b9a3edd4e94..73ad613048a 100644
--- a/mysql-test/r/old-mode.result
+++ b/mysql-test/r/old-mode.result
@@ -35,7 +35,7 @@ SELECT CAST(TIME'830:20:30' AS DATETIME);
CAST(TIME'830:20:30' AS DATETIME)
0000-01-03 14:20:30
CREATE TABLE t1 (a DATETIME);
-INSERT INTO t1 VALUES (TIME'-10:20:30');
+INSERT IGNORE INTO t1 VALUES (TIME'-10:20:30');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
INSERT INTO t1 VALUES (TIME'10:20:30');
@@ -47,13 +47,13 @@ a
0000-01-03 14:20:30
DROP TABLE t1;
CREATE TABLE t1 (a TIMESTAMP);
-INSERT INTO t1 VALUES (TIME'-10:20:30');
+INSERT IGNORE INTO t1 VALUES (TIME'-10:20:30');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
-INSERT INTO t1 VALUES (TIME'10:20:30');
+INSERT IGNORE INTO t1 VALUES (TIME'10:20:30');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
-INSERT INTO t1 VALUES (TIME'830:20:30');
+INSERT IGNORE INTO t1 VALUES (TIME'830:20:30');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
SELECT * FROM t1;
@@ -132,21 +132,29 @@ 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;
a unix_timestamp(a)
2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:26 1288481126
2010-10-31 02:25:26 1288481126
set global mysql56_temporal_format=true;
select a, unix_timestamp(a) from t1;
a unix_timestamp(a)
2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:26 1288481126
2010-10-31 02:25:26 1288481126
alter table t1 modify a timestamp;
select a, unix_timestamp(a) from t1;
a unix_timestamp(a)
2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:26 1288481126
2010-10-31 02:25:26 1288481126
drop table t1;
set global mysql56_temporal_format=false;
diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result
index bb817af5e2e..5495f8ffd34 100644
--- a/mysql-test/r/openssl_1.result
+++ b/mysql-test/r/openssl_1.result
@@ -4,60 +4,73 @@ drop table if exists t1;
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 "DHE-RSA-AES256-SHA";
-grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client";
-grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-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 "DHE-RSA-AES256-SHA" AND SUBJECT "xxx";
+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;
connect(localhost,ssl_user2,,test,MASTER_PORT,MASTER_SOCKET);
+connect con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES128-SHA;
ERROR 28000: Access denied for user 'ssl_user2'@'localhost' (using password: NO)
+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;
connect(localhost,ssl_user5,,test,MASTER_PORT,MASTER_SOCKET);
+connect con5,localhost,ssl_user5,,,,,SSL-CIPHER=AES256-SHA;
ERROR 28000: Access denied for user 'ssl_user5'@'localhost' (using password: NO)
+connection con1;
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
-Ssl_cipher DHE-RSA-AES256-SHA
+Ssl_cipher AES256-SHA
select * from t1;
f1
5
delete from t1;
ERROR 42000: DELETE command denied to user 'ssl_user1'@'localhost' for table 't1'
+connection con2;
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
-Ssl_cipher DHE-RSA-AES256-SHA
+Ssl_cipher AES256-SHA
select * from t1;
f1
5
delete from t1;
ERROR 42000: DELETE command denied to user 'ssl_user2'@'localhost' for table 't1'
+connection con3;
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
-Ssl_cipher DHE-RSA-AES256-SHA
+Ssl_cipher AES256-SHA
select * from t1;
f1
5
delete from t1;
ERROR 42000: DELETE command denied to user 'ssl_user3'@'localhost' for table 't1'
+connection con4;
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
-Ssl_cipher DHE-RSA-AES256-SHA
+Ssl_cipher AES256-SHA
select * from t1;
f1
5
delete from t1;
ERROR 42000: DELETE command denied to user 'ssl_user4'@'localhost' for table '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;
mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx
mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx
mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx
-SSL error: Unable to get private key from ''
-mysqltest: Could not open connection 'default': 2026 SSL connection error: Unable to get private key
-SSL error: Unable to get certificate from ''
-mysqltest: Could not open connection 'default': 2026 SSL connection error: Unable to get certificate
+mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx
+mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
-Ssl_cipher DHE-RSA-AES256-SHA
+Ssl_cipher AES256-SHA
have_ssl
1
End of 5.0 tests
@@ -87,8 +100,7 @@ Ssl_cipher AES128-SHA
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
Ssl_cipher AES128-SHA
-mysqltest: Could not open connection 'default': 2026 SSL connection error: Failed to set ciphers to use
-CREATE TABLE t1(a int);
+mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxxCREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
@@ -192,8 +204,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-SSL error: Unable to get private key from 'MYSQL_TEST_DIR/std_data/client-cert.pem'
-mysqldump: Got error: 2026: "SSL connection error: Unable to get private key" when trying to connect
+mysqldump: Got error: 2026: SSL connection error: xxxx
DROP TABLE t1;
Variable_name Value
Ssl_cipher AES256-SHA
@@ -204,9 +215,12 @@ result
is still running; no cipher request crashed the server
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';
have_ssl
1
+disconnect con1;
+connection default;
DROP USER bug42158@localhost;
set global sql_mode=default;
End of 5.1 tests
diff --git a/mysql-test/r/openssl_6975,tlsv10.result b/mysql-test/r/openssl_6975,tlsv10.result
index 7a4465f4826..b76a91bd134 100644
--- a/mysql-test/r/openssl_6975,tlsv10.result
+++ b/mysql-test/r/openssl_6975,tlsv10.result
@@ -3,14 +3,14 @@ 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";
TLS1.2 ciphers: user is ok with any cipher
-ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
-ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
+ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure
+ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure
TLS1.2 ciphers: user requires SSLv3 cipher AES128-SHA
-ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
-ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
+ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure
+ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure
TLS1.2 ciphers: user requires TLSv1.2 cipher AES128-SHA256
-ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
-ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
+ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure
+ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure
SSLv3 ciphers: user is ok with any cipher
Variable_name Value
Ssl_cipher AES256-SHA
diff --git a/mysql-test/r/openssl_6975,tlsv12.result b/mysql-test/r/openssl_6975,tlsv12.result
index a014cbd0d9e..c16e503c339 100644
--- a/mysql-test/r/openssl_6975,tlsv12.result
+++ b/mysql-test/r/openssl_6975,tlsv12.result
@@ -15,13 +15,13 @@ Variable_name Value
Ssl_cipher AES128-SHA256
ERROR 1045 (28000): Access denied for user 'ssl_tls12'@'localhost' (using password: NO)
SSLv3 ciphers: user is ok with any cipher
-ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
-ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
+ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure
+ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure
SSLv3 ciphers: user requires SSLv3 cipher AES128-SHA
-ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
-ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
+ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure
+ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure
SSLv3 ciphers: user requires TLSv1.2 cipher AES128-SHA256
-ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
-ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
+ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure
+ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure
drop user ssl_sslv3@localhost;
drop user ssl_tls12@localhost;
diff --git a/mysql-test/r/order_by-mdev-10122.result b/mysql-test/r/order_by-mdev-10122.result
new file mode 100644
index 00000000000..57c0ecdd970
--- /dev/null
+++ b/mysql-test/r/order_by-mdev-10122.result
@@ -0,0 +1,127 @@
+#
+# MariaDB does not support group functions in some contexts where MySQL does
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (10),(20),(30);
+# All these queries must pass, not returning "Invalid use of group function".
+(SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a));
+a
+10
+20
+30
+(SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) LIMIT 1;
+a
+10
+(SELECT a FROM t1 GROUP BY a ORDER BY a,GROUP_CONCAT(a));
+a
+10
+20
+30
+(SELECT a FROM t1 GROUP BY a ORDER BY a,GROUP_CONCAT(a)) LIMIT 1;
+a
+10
+(SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER BY a;
+a
+10
+20
+30
+(SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER BY a LIMIT 1;
+a
+10
+(SELECT a FROM t1 GROUP BY a ORDER BY a,GROUP_CONCAT(a)) ORDER BY a;
+a
+10
+20
+30
+(SELECT a FROM t1 GROUP BY a ORDER BY a,GROUP_CONCAT(a)) ORDER BY a LIMIT 1;
+a
+10
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a));
+a
+1
+10
+20
+30
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) LIMIT 1;
+a
+1
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER BY a;
+a
+1
+10
+20
+30
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER BY a LIMIT 1;
+a
+1
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY a,GROUP_CONCAT(a));
+a
+1
+10
+20
+30
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY a,GROUP_CONCAT(a)) LIMIT 1;
+a
+1
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY a,GROUP_CONCAT(a)) ORDER BY a;
+a
+1
+10
+20
+30
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY a,GROUP_CONCAT(a)) ORDER BY a LIMIT 1;
+a
+1
+(SELECT a FROM t1 GROUP BY a ORDER BY MAX(a)) ORDER BY a;
+a
+10
+20
+30
+(SELECT a FROM t1 GROUP BY a ORDER BY MAX(a)) ORDER BY a LIMIT 1;
+a
+10
+(SELECT a FROM t1 GROUP BY a ORDER BY a,MAX(a)) ORDER BY a;
+a
+10
+20
+30
+(SELECT a FROM t1 GROUP BY a ORDER BY a,MAX(a)) ORDER BY a LIMIT 1;
+a
+10
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY MAX(a));
+a
+1
+10
+20
+30
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY MAX(a)) LIMIT 1;
+a
+1
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY MAX(a)) ORDER BY a;
+a
+1
+10
+20
+30
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY MAX(a)) ORDER BY a LIMIT 1;
+a
+1
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY a,MAX(a));
+a
+1
+10
+20
+30
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY a,MAX(a)) LIMIT 1;
+a
+1
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY a,MAX(a)) ORDER BY a;
+a
+1
+10
+20
+30
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY a,MAX(a)) ORDER BY a LIMIT 1;
+a
+1
+drop table t1;
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 4cd9aebdf49..1ca3034c610 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("Sort aborted.*");
drop table if exists t1,t2,t3;
call mtr.add_suppression("Out of sort memory; increase server sort buffer size");
CREATE TABLE t1 (
@@ -284,11 +285,7 @@ info text NOT NULL default '',
ipnr varchar(30) NOT NULL default '',
PRIMARY KEY (member_id)
) ENGINE=MyISAM PACK_KEYS=1;
-Warnings:
-Warning 1101 BLOB/TEXT column 'info' can't have a default value
insert into t1 (member_id) values (1),(2),(3);
-Warnings:
-Warning 1364 Field 'info' doesn't have a default value
select member_id, nickname, voornaam FROM t1
ORDER by lastchange_datum DESC LIMIT 2;
member_id nickname voornaam
@@ -373,6 +370,7 @@ a b c
1 1 NULL
1 NULL b
1 NULL NULL
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 modify b int not null, modify c varchar(10) not null;
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
@@ -2574,7 +2572,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE r range PRIMARY PRIMARY 4 NULL 12 100.00 Using where; Using index
1 SIMPLE s eq_ref PRIMARY PRIMARY 4 test.r.a 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`r`.`a` AS `a`,`test`.`s`.`a` AS `a` from `test`.`t1` `r` join `test`.`t1` `s` where ((`test`.`s`.`a` = `test`.`r`.`a`) and ((`test`.`r`.`a` in (2,9)) or ((`test`.`r`.`a` < 100) and (`test`.`r`.`a` <> 0)))) order by 1 limit 10
+Note 1003 select `test`.`r`.`a` AS `a`,`test`.`s`.`a` AS `a` from `test`.`t1` `r` join `test`.`t1` `s` where `test`.`s`.`a` = `test`.`r`.`a` and (`test`.`r`.`a` in (2,9) or `test`.`r`.`a` < 100 and `test`.`r`.`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;
@@ -2641,7 +2639,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 5 100.00 Using index
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i1 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`i2` = `test`.`t1`.`i1`) order by `test`.`t1`.`i1` limit 5
+Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`i2` = `test`.`t1`.`i1` order by `test`.`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;
@@ -2682,28 +2680,28 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00
Warnings:
-Note 1003 select `test`.`t2`.`b` AS `field1` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`a` = `test`.`t1`.`b`) group by `test`.`t2`.`b` order by `test`.`t1`.`b`
+Note 1003 select `test`.`t2`.`b` AS `field1` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` group by `test`.`t2`.`b` order by `test`.`t1`.`b`
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;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00
Warnings:
-Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`a` = `test`.`t1`.`b`) group by `test`.`t2`.`b` order by `test`.`t1`.`b`
+Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` group by `test`.`t2`.`b` order by `test`.`t1`.`b`
explain extended
SELECT t2.b,t1.b FROM t1, t2 WHERE t1.b = t2.a GROUP BY t2.b ORDER BY t1.b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00
Warnings:
-Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`a` = `test`.`t1`.`b`) group by `test`.`t2`.`b` order by `test`.`t1`.`b`
+Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` group by `test`.`t2`.`b` order by `test`.`t1`.`b`
explain extended
SELECT t2.b FROM t1, t2 WHERE t1.b = t2.a GROUP BY t2.b ORDER BY t1.b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00
Warnings:
-Note 1003 select `test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`a` = `test`.`t1`.`b`) group by `test`.`t2`.`b` order by `test`.`t1`.`b`
+Note 1003 select `test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` group by `test`.`t2`.`b` order by `test`.`t1`.`b`
drop table t1,t2;
End of 5.2 tests
#
@@ -2994,7 +2992,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3a ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary
1 PRIMARY t3b ref f3_key f3_key 6 test.t3a.f3 1 100.00 Using where; End temporary
Warnings:
-Note 1003 select concat('foo',`test`.`t2`.`f2`) AS `field` from `test`.`t2` semi join ((`test`.`t3` `t3a` join `test`.`t3` `t3b`)) where ((`test`.`t3a`.`f3` < 'foo') or (`test`.`t3b`.`f3` <> 'foo')) order by concat('foo',`test`.`t2`.`f2`)
+Note 1003 select concat('foo',`test`.`t2`.`f2`) AS `field` from `test`.`t2` semi join ((`test`.`t3` `t3a` join `test`.`t3` `t3b`)) where `test`.`t3a`.`f3` < 'foo' or `test`.`t3b`.`f3` <> 'foo' order by concat('foo',`test`.`t2`.`f2`)
DROP TABLE t1,t2,t3;
End of 5.5 tests
#
@@ -3207,3 +3205,51 @@ pk
2
3
DROP TABLE t1;
+#
+# MDEV-13994: Bad join results with orderby_uses_equalities=on
+#
+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);
+SET @save_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch='orderby_uses_equalities=off';
+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;
+wing_id department_id
+707 11768
+SET optimizer_switch='orderby_uses_equalities=on';
+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;
+wing_id department_id
+707 11768
+explain extended 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;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 1 100.00 Using temporary; Using filesort
+1 PRIMARY wings eq_ref PRIMARY PRIMARY 4 test.books.wings_id 1 100.00
+2 MATERIALIZED books ref library_idx library_idx 4 const 1 100.00 Using where
+Warnings:
+Note 1003 select `test`.`wings`.`id` AS `wing_id`,`test`.`wings`.`department_id` AS `department_id` from `test`.`wings` semi join (`test`.`books`) where `test`.`books`.`library_id` = 8663 and `test`.`books`.`scheduled_for_removal` = 0 and `test`.`wings`.`id` = `test`.`books`.`wings_id` order by `test`.`wings`.`id`
+set optimizer_switch= @save_optimizer_switch;
+DROP TABLE books, wings;
diff --git a/mysql-test/r/order_by_innodb.result b/mysql-test/r/order_by_innodb.result
index 4f59a2f8c20..3ff1f92e94a 100644
--- a/mysql-test/r/order_by_innodb.result
+++ b/mysql-test/r/order_by_innodb.result
@@ -48,3 +48,76 @@ where key1<3 or key2<3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using sort_union(key1,key2); Using where
drop table t0, t1;
+#
+# MDEV-14071: wrong results with orderby_uses_equalities=on
+# (duplicate of MDEV-13994)
+#
+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');
+SET @save_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch='orderby_uses_equalities=off';
+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;
+i n
+188 eight
+218 eight
+338 four
+409 seven
+466 eight
+469 eight
+498 eight
+656 eight
+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;
+i n
+188 eight
+218 eight
+338 four
+409 seven
+466 eight
+469 eight
+498 eight
+656 eight
+SET optimizer_switch='orderby_uses_equalities=on';
+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;
+i n
+188 eight
+218 eight
+338 four
+409 seven
+466 eight
+469 eight
+498 eight
+656 eight
+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;
+i n
+188 eight
+218 eight
+338 four
+409 seven
+466 eight
+469 eight
+498 eight
+656 eight
+set optimizer_switch= @save_optimizer_switch;
+DROP TABLE t1,t2,t3;
diff --git a/mysql-test/r/order_by_optimizer.result b/mysql-test/r/order_by_optimizer.result
new file mode 100644
index 00000000000..8f128552a86
--- /dev/null
+++ b/mysql-test/r/order_by_optimizer.result
@@ -0,0 +1,30 @@
+drop table if exists t0,t1,t2,t3;
+#
+# MDEV-7885: EXPLAIN shows wrong info for ORDER BY query
+#
+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);
+# This must show "Using filesort":
+explain
+select * from t2 ignore index for order by (key1) where col1<0 order by key1 limit 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1010 Using where; Using filesort
+drop table t0, t1, t2;
+#
+# MDEV-8857: [Upstream too] EXPLAIN incorrectly shows Distinct for tables using join 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, 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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE A ALL NULL NULL NULL NULL 10 Using temporary
+1 SIMPLE B index NULL a 5 NULL 20 Using where; Using index; Using join buffer (flat, BNL join)
+drop table t0, t1;
diff --git a/mysql-test/r/order_by_optimizer_innodb.result b/mysql-test/r/order_by_optimizer_innodb.result
index f3167db4b9a..0b62ba997d8 100644
--- a/mysql-test/r/order_by_optimizer_innodb.result
+++ b/mysql-test/r/order_by_optimizer_innodb.result
@@ -40,11 +40,11 @@ pk1 count(*)
# 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;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range ux_pk1_fd5 ux_pk1_fd5 13 NULL 137 Using where
+1 SIMPLE t2 range ux_pk1_fd5 ux_pk1_fd5 13 NULL 138 Using where
# 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;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range PRIMARY,ux_pk1_fd5 ux_pk1_fd5 13 NULL 137 Using where
+1 SIMPLE t2 range PRIMARY,ux_pk1_fd5 ux_pk1_fd5 13 NULL 138 Using where
drop table t0,t1, t2;
#
# MDEV-6814: Server crashes in calculate_key_len on query with ORDER BY
diff --git a/mysql-test/r/order_by_zerolength-4285.result b/mysql-test/r/order_by_zerolength-4285.result
index f60ce7d90c7..e6902105f20 100644
--- a/mysql-test/r/order_by_zerolength-4285.result
+++ b/mysql-test/r/order_by_zerolength-4285.result
@@ -3,6 +3,7 @@ insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
select * from t1 order by now(), cast(pk as char(0));
pk
1
+10
2
3
4
@@ -11,8 +12,8 @@ pk
7
8
9
-10
-Warnings:
+show warnings;
+Level Code Message
Warning 1292 Truncated incorrect CHAR(0) value: '1'
Warning 1292 Truncated incorrect CHAR(0) value: '2'
Warning 1292 Truncated incorrect CHAR(0) value: '3'
diff --git a/mysql-test/r/outfile.result b/mysql-test/r/outfile.result
index daea60c53eb..cafa9d9db4d 100644
--- a/mysql-test/r/outfile.result
+++ b/mysql-test/r/outfile.result
Binary files differ
diff --git a/mysql-test/r/overflow.result b/mysql-test/r/overflow.result
index a5fa7154833..a3e93aa5cba 100644
--- a/mysql-test/r/overflow.result
+++ b/mysql-test/r/overflow.result
@@ -1,2 +1,6 @@
+connect con1,localhost,root,,;
+connection con1;
drop database AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;
Got one of the listed errors
+connection default;
+disconnect con1;
diff --git a/mysql-test/r/packet.result b/mysql-test/r/packet.result
index dcc2c608d0b..254ad93d78e 100644
--- a/mysql-test/r/packet.result
+++ b/mysql-test/r/packet.result
@@ -13,18 +13,26 @@ len
select repeat('a',2000);
repeat('a',2000)
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+connect con1,localhost,root,,;
+connection con1;
select @@net_buffer_length, @@max_allowed_packet;
@@net_buffer_length @@max_allowed_packet
1024 1024
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
ERROR 08S01: Got a packet bigger than 'max_allowed_packet' bytes
+connection default;
+disconnect con1;
set global max_allowed_packet=default;
set global net_buffer_length=default;
+connect con2,localhost,root,,;
+connection con2;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
len
100
select length(repeat('a',2000));
length(repeat('a',2000))
2000
+connection default;
+disconnect con2;
set global max_allowed_packet=@max_allowed_packet;
set global net_buffer_length=@net_buffer_length;
diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result
index 3ebd84ff521..09bbd7cf176 100644
--- a/mysql-test/r/parser.result
+++ b/mysql-test/r/parser.result
@@ -722,7 +722,7 @@ FOR UPDATE) a;
SELECT 1 FROM
(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
PROCEDURE ANALYSE() FOR UPDATE) a;
-ERROR HY000: Incorrect usage of PROCEDURE and subquery
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE() FOR UPDATE) a' at line 3
SELECT 1 FROM t1
WHERE EXISTS(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
FOR UPDATE);
@@ -730,7 +730,7 @@ FOR UPDATE);
SELECT 1 FROM t1
WHERE EXISTS(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
PROCEDURE ANALYSE() FOR UPDATE);
-ERROR HY000: Incorrect usage of PROCEDURE and subquery
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE() FOR UPDATE)' at line 3
SELECT 1 FROM t1
UNION
SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
@@ -741,11 +741,12 @@ SELECT 1 FROM t1
UNION
SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
PROCEDURE ANALYSE() FOR UPDATE;
-ERROR HY000: Incorrect usage of PROCEDURE and subquery
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE() FOR UPDATE' at line 4
SELECT 1 FROM DUAL PROCEDURE ANALYSE()
UNION
SELECT 1 FROM t1;
-ERROR HY000: Incorrect usage of UNION and SELECT ... PROCEDURE ANALYSE()
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION
+SELECT 1 FROM t1' at line 2
(SELECT 1 FROM t1)
UNION
(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
@@ -756,7 +757,7 @@ FOR UPDATE);
UNION
(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
PROCEDURE ANALYSE() FOR UPDATE);
-ERROR HY000: Incorrect usage of PROCEDURE and subquery
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE() FOR UPDATE)' at line 4
# "FOR UPDATE" tests
SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1;
1
@@ -775,10 +776,10 @@ Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
SELECT 1 INTO @var17727401 FROM DUAL;
SELECT 1 INTO @var17727401_1 FROM t1 INTO @var17727401_2;
-ERROR HY000: Incorrect usage of INTO and INTO
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var17727401_2' at line 1
SELECT 1 INTO @var17727401_1 FROM DUAL
INTO @var17727401_2;
-ERROR HY000: Incorrect usage of INTO and INTO
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var17727401_2' at line 2
SELECT 1 INTO @var17727401 FROM t1 WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1;
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
@@ -790,7 +791,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT 1 INTO @var17727401_1
FROM t1 WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1
INTO @var17727401_2;
-ERROR HY000: Incorrect usage of INTO and INTO
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var17727401_2' at line 3
SELECT (SELECT 1 FROM t1 INTO @var17727401);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var17727401)' at line 1
SELECT 1 FROM (SELECT 1 FROM t1 INTO @var17727401) a;
@@ -798,16 +799,16 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT EXISTS(SELECT 1 FROM t1 INTO @var17727401);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var17727401)' at line 1
SELECT 1 FROM t1 INTO @var17727401 UNION SELECT 1 FROM t1 INTO t1;
-ERROR HY000: Incorrect usage of UNION and INTO
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 INTO t1' at line 1
(SELECT 1 FROM t1 INTO @var17727401) UNION (SELECT 1 FROM t1 INTO t1);
ERROR HY000: Incorrect usage of UNION and INTO
SELECT 1 FROM t1 UNION SELECT 1 FROM t1 INTO @var17727401;
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
SELECT 1 INTO @var17727401 FROM t1 PROCEDURE ANALYSE();
-ERROR HY000: Incorrect usage of PROCEDURE and INTO
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE()' at line 1
SELECT 1 FROM t1 PROCEDURE ANALYSE() INTO @var17727401;
-ERROR HY000: Incorrect usage of PROCEDURE and INTO
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var17727401' at line 1
# ORDER and LIMIT clause combinations
(SELECT 1 FROM t1 ORDER BY 1) ORDER BY 1;
1
@@ -853,53 +854,53 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT 1 FROM (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1 ORDER BY 1) a;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY 1) a' at line 1
SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1;
-ERROR HY000: Incorrect usage of UNION and ORDER BY
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1' at line 1
SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1);
-ERROR HY000: Incorrect usage of UNION and ORDER BY
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1)' at line 1
SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1) a;
-ERROR HY000: Incorrect usage of UNION and ORDER BY
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1) a' at line 1
SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1;
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1' at line 1
SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1);
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1)' at line 1
SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1) a;
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1) a' at line 1
SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1;
-ERROR HY000: Incorrect usage of UNION and ORDER BY
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1' at line 1
SELECT (SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1);
-ERROR HY000: Incorrect usage of UNION and ORDER BY
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1)' at line 1
SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1) a;
-ERROR HY000: Incorrect usage of UNION and ORDER BY
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1) a' at line 1
SELECT 1 FROM t1 LIMIT 1 ORDER BY 1 UNION SELECT 1 FROM t1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY 1 UNION SELECT 1 FROM t1' at line 1
SELECT (SELECT 1 FROM t1 LIMIT 1 ORDER BY 1 UNION SELECT 1 FROM t1);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY 1 UNION SELECT 1 FROM t1)' at line 1
SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 ORDER BY 1 UNION SELECT 1 FROM t1) a;
-ERROR HY000: Incorrect usage of UNION and ORDER BY
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY 1 UNION SELECT 1 FROM t1) a' at line 1
SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1;
-ERROR HY000: Incorrect usage of UNION and ORDER BY
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1' at line 1
SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1);
-ERROR HY000: Incorrect usage of UNION and ORDER BY
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1)' at line 1
SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1) a;
-ERROR HY000: Incorrect usage of UNION and ORDER BY
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1) a' at line 1
SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1;
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1' at line 1
SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1);
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1)' at line 1
SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1) a;
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1) a' at line 1
SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1;
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1' at line 1
SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1);
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1)' at line 1
SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1) a;
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1) a' at line 1
SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1;
-ERROR HY000: Incorrect usage of UNION and ORDER BY
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1' at line 1
SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1);
-ERROR HY000: Incorrect usage of UNION and ORDER BY
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1)' at line 1
SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1) a;
-ERROR HY000: Incorrect usage of UNION and ORDER BY
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1) a' at line 1
DROP TABLE t1;
#
# MDEV-8380: Subquery parse error
@@ -913,3 +914,415 @@ a
2
1
DROP TABLE t1;
+#
+# MDEV-10080 Derived tables allow double LIMIT clause
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT * FROM (SELECT * FROM t1 LIMIT 1 LIMIT 2) t1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LIMIT 2) t1' at line 1
+DROP TABLE t1;
+#
+# MDEV-10109 Disallow syntactically INSERT .. SELECT .. {ORDER BY ..| LIMIT ..} .. UNION ..
+#
+INSERT INTO t1 SELECT 1 ORDER BY 1 UNION SELECT 2;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 2' at line 1
+INSERT INTO t1 SELECT 1 LIMIT 1 UNION SELECT 2;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 2' at line 1
+CREATE TABLE t1 AS SELECT 1 ORDER BY 1 UNION SELECT 2;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 2' at line 1
+CREATE TABLE t1 AS SELECT 1 LIMIT 1 UNION SELECT 2;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 2' at line 1
+#
+# MDEV-8909 union parser cleanup
+#
+# UNION with a non-parenthesized term
+# The following two queries return a wrong result
+# This will change when MDEV-10120 is fixed
+# 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);
+a
+1
+SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a ORDER BY a);
+a
+1
+DROP TABLE t1;
+# 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);
+a
+1
+10
+20
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a));
+a
+1
+10
+20
+30
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) LIMIT 1;
+a
+1
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER BY a;
+a
+1
+10
+20
+30
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER BY a LIMIT 1;
+a
+1
+DROP TABLE t1;
+# 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);
+a
+1
+10
+20
+30
+NULL
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP) LIMIT 1;
+a
+1
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP) ORDER BY a LIMIT 1;
+a
+NULL
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP LIMIT 2);
+a
+1
+10
+20
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY a);
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a));
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a));
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+DROP TABLE t1;
+# UNION with a non-parethesized term with ROLLUP
+# This will change after: MDEV-10120 Wrong result of UNION .. ORDER BY GROUP_CONCAT()
+# 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);
+a
+1
+SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a);
+a
+1
+SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a) LIMIT 1;
+a
+1
+DROP TABLE t1;
+# 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;
+a
+10
+20
+30
+NULL
+SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 LIMIT 1;
+a
+10
+SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY a;
+a
+NULL
+10
+20
+30
+SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY a LIMIT 1;
+a
+NULL
+SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY a DESC LIMIT 1;
+a
+30
+SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY GROUP_CONCAT(a);
+a GROUP_CONCAT(a)
+10 10,20,30
+SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY GROUP_CONCAT(a ORDER BY a);
+a GROUP_CONCAT(a)
+10 10,20,30
+SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY GROUP_CONCAT(a) LIMIT 1;
+a GROUP_CONCAT(a)
+10 10,20,30
+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;
+a GROUP_CONCAT(a)
+10 10,20,30
+SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a);
+a GROUP_CONCAT(a)
+NULL NULL
+10 10
+20 20
+30 30
+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);
+a GROUP_CONCAT(a)
+NULL NULL
+10 10
+20 20
+30 30
+SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a) DESC;
+a GROUP_CONCAT(a)
+30 30
+20 20
+10 10
+NULL NULL
+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;
+a GROUP_CONCAT(a)
+30 30
+20 20
+10 10
+NULL NULL
+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;
+a GROUP_CONCAT(a)
+NULL NULL
+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;
+a GROUP_CONCAT(a)
+NULL NULL
+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;
+a GROUP_CONCAT(a)
+30 30
+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;
+a GROUP_CONCAT(a)
+30 30
+SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a) t1;
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) t1;
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a)) t1;
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a)) t1;
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+DROP TABLE t1;
+# 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 * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL)
+NULL
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL);
+(SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL)
+10
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1);
+(SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
+10
+SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1);
+(SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
+10
+SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1);
+(SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
+10
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL) FROM t1;
+(SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL)
+NULL
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL) FROM t1;
+(SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL)
+10
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
+(SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
+10
+SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
+(SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
+10
+SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
+(SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
+10
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP);
+ERROR 21000: Subquery returns more than 1 row
+SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP);
+ERROR 21000: Subquery returns more than 1 row
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP) FROM t1;
+ERROR 21000: Subquery returns more than 1 row
+SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP) FROM t1;
+ERROR 21000: Subquery returns more than 1 row
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a);
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1);
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a));
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) AS a;
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a) FROM t1;
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) FROM t1;
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a)) FROM t1;
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) AS a FROM t1;
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+DROP TABLE t1;
+# 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 * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
+10
+SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1);
+(SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
+10
+SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1);
+(SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
+10
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
+(SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
+10
+10
+10
+SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
+(SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
+10
+10
+10
+SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
+(SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
+10
+10
+10
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP);
+ERROR 21000: Subquery returns more than 1 row
+SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP);
+ERROR 21000: Subquery returns more than 1 row
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP) FROM t1;
+ERROR 21000: Subquery returns more than 1 row
+SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP) FROM t1;
+ERROR 21000: Subquery returns more than 1 row
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a);
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1);
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a));
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) AS a;
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a) FROM t1;
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) FROM t1;
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a)) FROM t1;
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) AS a FROM t1;
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+DROP TABLE t1;
+
+MDEV-10101 Wrong error message of SELECT 1 UNION (SELECT 1 FROM t1 GROUP BY 1 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);
+a
+1
+10
+20
+30
+NULL
+(SELECT a FROM t1 GROUP BY a WITH ROLLUP) UNION SELECT 1;
+a
+10
+20
+30
+NULL
+1
+SELECT a FROM t1 GROUP BY a WITH ROLLUP UNION SELECT 1;
+a
+10
+20
+30
+NULL
+1
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP) LIMIT 1;
+a
+1
+(SELECT a FROM t1 GROUP BY a WITH ROLLUP) UNION SELECT 1 LIMIT 1;
+a
+10
+SELECT a FROM t1 GROUP BY a WITH ROLLUP UNION SELECT 1 LIMIT 1;
+a
+10
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP) ORDER BY a LIMIT 1;
+a
+NULL
+(SELECT a FROM t1 GROUP BY a WITH ROLLUP) UNION SELECT 1 ORDER BY a LIMIT 1;
+a
+NULL
+SELECT a FROM t1 GROUP BY a WITH ROLLUP UNION SELECT 1 ORDER BY a LIMIT 1;
+a
+NULL
+SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP LIMIT 2);
+a
+1
+10
+20
+(SELECT a FROM t1 GROUP BY a WITH ROLLUP LIMIT 2) UNION SELECT 1;
+a
+10
+20
+1
+DROP TABLE t1;
+#
+# MDEV-10779 Failing assertion lex->proc_list.elements == 0 or syntax error on PROCEDURE ANALYSE in UNION
+#
+CREATE TABLE t1 (i INT);
+(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
+UNION
+(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10));
+ERROR HY000: Incorrect usage of UNION and SELECT ... PROCEDURE ANALYSE()
+(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
+UNION
+SELECT * FROM t1 PROCEDURE ANALYSE(10, 10);
+ERROR HY000: Incorrect usage of UNION and SELECT ... PROCEDURE ANALYSE()
+(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
+UNION
+(SELECT 1);
+ERROR HY000: Incorrect usage of UNION and SELECT ... PROCEDURE ANALYSE()
+(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
+UNION
+SELECT 1;
+ERROR HY000: Incorrect usage of UNION and SELECT ... PROCEDURE ANALYSE()
+SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)
+UNION
+(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION
+(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))' at line 2
+SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)
+UNION
+SELECT * FROM t1 PROCEDURE ANALYSE(10, 10);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION
+SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)' at line 2
+SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)
+UNION
+(SELECT 1);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION
+(SELECT 1)' at line 2
+SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)
+UNION
+SELECT 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION
+SELECT 1' at line 2
+DROP TABLE t1;
+create table t1 (a serial null);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'null)' at line 1
+create table t1 (a serial auto_increment);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'auto_increment)' at line 1
+create table t1 (a serial serial default value);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'serial default value)' at line 1
+create table t1 (a serial collate binary);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'collate binary)' at line 1
+create table t1 (i int, vc serial as (i));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'as (i))' at line 1
+create function fs() returns serial return 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'serial return 1' at line 1
+create table t1 ( id serial );
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ UNIQUE KEY `id` (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/r/parser_not_embedded.result b/mysql-test/r/parser_not_embedded.result
index fd545605c02..25349e51577 100644
--- a/mysql-test/r/parser_not_embedded.result
+++ b/mysql-test/r/parser_not_embedded.result
@@ -52,7 +52,11 @@
COMMIT AND CHAIN RELEASE;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RELEASE' at line 1
COMMIT AND NO CHAIN RELEASE;
+disconnect default;
+connect default, localhost, root,,;
COMMIT RELEASE;
+disconnect default;
+connect default, localhost, root,,;
COMMIT CHAIN RELEASE;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CHAIN RELEASE' at line 1
COMMIT NO CHAIN RELEASE;
@@ -72,11 +76,17 @@ COMMIT AND NO CHAIN NO RELEASE;
ROLLBACK AND CHAIN RELEASE;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RELEASE' at line 1
ROLLBACK AND NO CHAIN RELEASE;
+disconnect default;
+connect default, localhost, root,,;
ROLLBACK RELEASE;
+disconnect default;
+connect default, localhost, root,,;
ROLLBACK CHAIN RELEASE;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CHAIN RELEASE' at line 1
ROLLBACK NO CHAIN RELEASE;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CHAIN RELEASE' at line 1
+disconnect default;
+connect default, localhost, root,,;
ROLLBACK AND NO RELEASE;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RELEASE' at line 1
ROLLBACK AND RELEASE;
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 53f89c9cd55..549579ccd9c 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -77,7 +77,7 @@ EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a > 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`a` > 1)
+Note 1003 select 1 AS `1` from `test`.`t1` where `test`.`t1`.`a` > 1
DROP TABLE t1;
#
# Bug#57778: failed primary key add to partitioned innodb table
@@ -94,8 +94,8 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a)
-PARTITIONS 2 */
+ PARTITION BY KEY (`a`)
+PARTITIONS 2
SELECT * FROM t1;
a b
0 1
@@ -172,27 +172,27 @@ 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';
PARTITION_EXPRESSION SUBPARTITION_EXPRESSION
-ID `ID`,`aaaa,aaaaa`
-ID `ID`,`aaaa,aaaaa`
-ID `ID`,`aaaa,aaaaa`
-ID `ID`,`aaaa,aaaaa`
-ID `ID`,`aaaa,aaaaa`
-ID `ID`,`aaaa,aaaaa`
+`ID` `ID`,`aaaa,aaaaa`
+`ID` `ID`,`aaaa,aaaaa`
+`ID` `ID`,`aaaa,aaaaa`
+`ID` `ID`,`aaaa,aaaaa`
+`ID` `ID`,`aaaa,aaaaa`
+`ID` `ID`,`aaaa,aaaaa`
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`ID` int(11) NOT NULL,
- `aaaa,aaaaa` tinyint(3) unsigned NOT NULL DEFAULT '0',
- `ddddddddd` int(11) NOT NULL DEFAULT '0',
+ `aaaa,aaaaa` tinyint(3) unsigned NOT NULL DEFAULT 0,
+ `ddddddddd` int(11) NOT NULL DEFAULT 0,
`new_field0` varchar(50) DEFAULT NULL,
PRIMARY KEY (`ID`,`aaaa,aaaaa`,`ddddddddd`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (ID)
+ PARTITION BY RANGE (`ID`)
SUBPARTITION BY LINEAR KEY (`ID`,`aaaa,aaaaa`)
SUBPARTITIONS 2
-(PARTITION p01 VALUES LESS THAN (100) ENGINE = MyISAM,
- PARTITION p11 VALUES LESS THAN (200) ENGINE = MyISAM,
- PARTITION p21 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+(PARTITION `p01` VALUES LESS THAN (100) ENGINE = MyISAM,
+ PARTITION `p11` VALUES LESS THAN (200) ENGINE = MyISAM,
+ PARTITION `p21` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
drop table t1;
CREATE TABLE t1 (a INT, b INT)
PARTITION BY LIST (a)
@@ -260,14 +260,14 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `a` timestamp NOT NULL DEFAULT current_timestamp(),
`b` varchar(10) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (UNIX_TIMESTAMP(a))
-(PARTITION p1 VALUES LESS THAN (1199134800) ENGINE = MyISAM,
- PARTITION p3 VALUES LESS THAN (1247688000) ENGINE = MyISAM,
- PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+ PARTITION BY RANGE (unix_timestamp(`a`))
+(PARTITION `p1` VALUES LESS THAN (1199134800) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (1247688000) ENGINE = MyISAM,
+ PARTITION `pmax` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
DROP TABLE t1;
create table t1 (a int NOT NULL, b varchar(5) NOT NULL)
default charset=utf8
@@ -300,7 +300,7 @@ create index i on t1 (a);
ERROR 42000: Duplicate key name 'i'
create index i2 on t1 (a);
Warnings:
-Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release
drop table t1;
CREATE TABLE t1 (a INT, FOREIGN KEY (a) REFERENCES t0 (a))
ENGINE=MyISAM
@@ -376,9 +376,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY HASH (a)
-(PARTITION p0 ENGINE = MEMORY,
- PARTITION p1 ENGINE = MEMORY) */
+ PARTITION BY HASH (`a`)
+(PARTITION `p0` ENGINE = MEMORY,
+ PARTITION `p1` ENGINE = MEMORY)
DROP TABLE t1;
SET sql_mode=DEFAULT;
CREATE TABLE t1 (a INT NOT NULL, KEY(a))
@@ -775,20 +775,20 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-SUBPARTITION BY KEY (a)
-(PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN (2) ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+SUBPARTITION BY KEY (`a`)
+(PARTITION `p0` VALUES LESS THAN (1) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN (2) ENGINE = MyISAM)
alter table t1 reorganize partition p1 into (partition p1 values less than (3));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-SUBPARTITION BY KEY (a)
-(PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN (3) ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+SUBPARTITION BY KEY (`a`)
+(PARTITION `p0` VALUES LESS THAN (1) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN (3) ENGINE = MyISAM)
drop table t1;
CREATE TABLE t1 (
a int not null,
@@ -807,7 +807,7 @@ t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a) */
+ PARTITION BY KEY (`a`)
drop table t1;
CREATE TABLE t1 (
a int not null,
@@ -985,8 +985,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST (a)
-(PARTITION x1 VALUES IN (1) ENGINE = MEMORY) */
+ PARTITION BY LIST (`a`)
+(PARTITION `x1` VALUES IN (1) ENGINE = MEMORY)
drop table t1;
CREATE TABLE t1 (a int, unique(a))
PARTITION BY LIST (a)
@@ -1011,8 +1011,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY HASH (a)
-PARTITIONS 5 */
+ PARTITION BY HASH (`a`)
+PARTITIONS 5
drop table t1;
CREATE TABLE t1 (a int)
PARTITION BY RANGE (a)
@@ -1040,10 +1040,10 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN (20) ENGINE = MyISAM,
- PARTITION p2 VALUES LESS THAN (30) ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (30) ENGINE = MyISAM)
drop table t1;
CREATE TABLE t1 (a int, b int)
PARTITION BY RANGE (a)
@@ -1065,15 +1065,15 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION x1 VALUES LESS THAN (6) ENGINE = MyISAM,
- PARTITION x3 VALUES LESS THAN (8) ENGINE = MyISAM,
- PARTITION x4 VALUES LESS THAN (10) ENGINE = MyISAM,
- PARTITION x5 VALUES LESS THAN (12) ENGINE = MyISAM,
- PARTITION x6 VALUES LESS THAN (14) ENGINE = MyISAM,
- PARTITION x7 VALUES LESS THAN (16) ENGINE = MyISAM,
- PARTITION x8 VALUES LESS THAN (18) ENGINE = MyISAM,
- PARTITION x9 VALUES LESS THAN (20) ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `x1` VALUES LESS THAN (6) ENGINE = MyISAM,
+ PARTITION `x3` VALUES LESS THAN (8) ENGINE = MyISAM,
+ PARTITION `x4` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `x5` VALUES LESS THAN (12) ENGINE = MyISAM,
+ PARTITION `x6` VALUES LESS THAN (14) ENGINE = MyISAM,
+ PARTITION `x7` VALUES LESS THAN (16) ENGINE = MyISAM,
+ PARTITION `x8` VALUES LESS THAN (18) ENGINE = MyISAM,
+ PARTITION `x9` VALUES LESS THAN (20) ENGINE = MyISAM)
drop table t1;
create table t1 (a int not null, b int not null) partition by LIST (a+b) (
partition p0 values in (12),
@@ -1128,36 +1128,36 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a)
-(PARTITION p0 ENGINE = MyISAM,
- PARTITION p1 ENGINE = MyISAM) */
+ PARTITION BY KEY (`a`)
+(PARTITION `p0` ENGINE = MyISAM,
+ PARTITION `p1` ENGINE = MyISAM)
alter table t1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a)
-(PARTITION p0 ENGINE = MyISAM,
- PARTITION p1 ENGINE = MyISAM) */
+ PARTITION BY KEY (`a`)
+(PARTITION `p0` ENGINE = MyISAM,
+ PARTITION `p1` ENGINE = MyISAM)
alter table t1 engine=myisam;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a)
-(PARTITION p0 ENGINE = MyISAM,
- PARTITION p1 ENGINE = MyISAM) */
+ PARTITION BY KEY (`a`)
+(PARTITION `p0` ENGINE = MyISAM,
+ PARTITION `p1` ENGINE = MyISAM)
alter table t1 engine=heap;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a)
-(PARTITION p0 ENGINE = MEMORY,
- PARTITION p1 ENGINE = MEMORY) */
+ PARTITION BY KEY (`a`)
+(PARTITION `p0` ENGINE = MEMORY,
+ PARTITION `p1` ENGINE = MEMORY)
alter table t1 remove partitioning;
show create table t1;
Table Create Table
@@ -1175,9 +1175,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a)
-(PARTITION p0 ENGINE = MyISAM,
- PARTITION p1 ENGINE = MyISAM) */
+ PARTITION BY KEY (`a`)
+(PARTITION `p0` ENGINE = MyISAM,
+ PARTITION `p1` ENGINE = MyISAM)
alter table t1 add column b int remove partitioning;
show create table t1;
Table Create Table
@@ -1195,9 +1195,9 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a)
-(PARTITION p0 ENGINE = MyISAM,
- PARTITION p1 ENGINE = MyISAM) */
+ PARTITION BY KEY (`a`)
+(PARTITION `p0` ENGINE = MyISAM,
+ PARTITION `p1` ENGINE = MyISAM)
alter table t1
engine=heap
partition by key(a)
@@ -1208,9 +1208,9 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a)
-(PARTITION p0 ENGINE = MEMORY,
- PARTITION p1 ENGINE = MEMORY) */
+ PARTITION BY KEY (`a`)
+(PARTITION `p0` ENGINE = MEMORY,
+ PARTITION `p1` ENGINE = MEMORY)
alter table t1 engine=myisam, add column c int remove partitioning;
show create table t1;
Table Create Table
@@ -1230,9 +1230,9 @@ t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a)
-(PARTITION p0 ENGINE = MEMORY,
- PARTITION p1 ENGINE = MEMORY) */
+ PARTITION BY KEY (`a`)
+(PARTITION `p0` ENGINE = MEMORY,
+ PARTITION `p1` ENGINE = MEMORY)
alter table t1
partition by key (a)
(partition p0, partition p1);
@@ -1243,9 +1243,9 @@ t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a)
-(PARTITION p0 ENGINE = MEMORY,
- PARTITION p1 ENGINE = MEMORY) */
+ PARTITION BY KEY (`a`)
+(PARTITION `p0` ENGINE = MEMORY,
+ PARTITION `p1` ENGINE = MEMORY)
alter table t1
engine=heap
partition by key (a)
@@ -1257,9 +1257,9 @@ t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a)
-(PARTITION p0 ENGINE = MEMORY,
- PARTITION p1 ENGINE = MEMORY) */
+ PARTITION BY KEY (`a`)
+(PARTITION `p0` ENGINE = MEMORY,
+ PARTITION `p1` ENGINE = MEMORY)
alter table t1
partition by key(a)
(partition p0, partition p1 engine=heap);
@@ -1403,9 +1403,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a)
-(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+SUBPARTITION BY HASH (`a`)
+(PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM)
alter table t1 add partition (partition p1 values less than (200)
(subpartition subpart21));
show create table t1;
@@ -1413,12 +1413,12 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a)
-(PARTITION p0 VALUES LESS THAN (100)
- (SUBPARTITION p0sp0 ENGINE = MyISAM),
- PARTITION p1 VALUES LESS THAN (200)
- (SUBPARTITION subpart21 ENGINE = MyISAM)) */
+ PARTITION BY RANGE (`a`)
+SUBPARTITION BY HASH (`a`)
+(PARTITION `p0` VALUES LESS THAN (100)
+ (SUBPARTITION `p0sp0` ENGINE = MyISAM),
+ PARTITION `p1` VALUES LESS THAN (200)
+ (SUBPARTITION `subpart21` ENGINE = MyISAM))
drop table t1;
create table t1 (a int)
partition by key (a);
@@ -1427,16 +1427,16 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a) */
+ PARTITION BY KEY (`a`)
alter table t1 add partition (partition p1);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a)
-(PARTITION p0 ENGINE = MyISAM,
- PARTITION p1 ENGINE = MyISAM) */
+ PARTITION BY KEY (`a`)
+(PARTITION `p0` ENGINE = MyISAM,
+ PARTITION `p1` ENGINE = MyISAM)
drop table t1;
create table t1 (a int, b int)
partition by range (a)
@@ -1520,9 +1520,9 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST (a)
-(PARTITION p1 VALUES IN (1) ENGINE = MyISAM,
- PARTITION p2 VALUES IN (2) ENGINE = MyISAM) */
+ PARTITION BY LIST (`a`)
+(PARTITION `p1` VALUES IN (1) ENGINE = MyISAM,
+ PARTITION `p2` VALUES IN (2) ENGINE = MyISAM)
drop table t1;
create table t1 (a int unsigned not null auto_increment primary key)
partition by key(a);
@@ -1534,7 +1534,7 @@ t2 CREATE TABLE `t2` (
`c` char(10) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='no comment'
-/*!50100 PARTITION BY KEY (a) */
+ PARTITION BY KEY (`a`)
drop table t2;
create table t1 (f1 int) partition by hash (f1) as select 1;
drop table t1;
@@ -1731,8 +1731,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST (a)
-(PARTITION p0 VALUES IN (NULL) ENGINE = MyISAM) */
+ PARTITION BY LIST (`a`)
+(PARTITION `p0` VALUES IN (NULL) ENGINE = MyISAM)
DROP TABLE t1;
CREATE TABLE t1 (a int)
PARTITION BY RANGE(a)
@@ -1769,8 +1769,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
)
-/*!50100 PARTITION BY KEY (a)
-(PARTITION p0) */
+ PARTITION BY KEY (`a`)
+(PARTITION `p0`)
set session sql_mode='';
drop table t1;
create table t1 (a int)
@@ -1785,7 +1785,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a) */
+ PARTITION BY KEY (`a`)
drop table t1;
CREATE TABLE t1 (a int) ENGINE = MYISAM PARTITION BY KEY(a);
INSERT into t1 values (1), (2);
@@ -1858,8 +1858,8 @@ t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a)
-PARTITIONS 10 */
+ PARTITION BY KEY (`a`)
+PARTITIONS 10
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE),
(18446744073709551613), (18446744073709551612);
select * from t1;
@@ -2024,9 +2024,9 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (b)
-(PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM,
- PARTITION p2 VALUES LESS THAN (20) ENGINE = MyISAM) */
+ PARTITION BY RANGE (`b`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = MyISAM)
drop table t1, t2;
create table t1
(s1 timestamp on update current_timestamp, s2 int)
@@ -2164,12 +2164,12 @@ t1 CREATE TABLE `t1` (
`user` char(25) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (id)
-SUBPARTITION BY HASH (id)
+ PARTITION BY RANGE (`id`)
+SUBPARTITION BY HASH (`id`)
SUBPARTITIONS 2
-(PARTITION pa1 VALUES LESS THAN (10) ENGINE = MyISAM,
- PARTITION pa2 VALUES LESS THAN (20) ENGINE = MyISAM,
- PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+(PARTITION `pa1` VALUES LESS THAN (10) ENGINE = MyISAM,
+ PARTITION `pa2` VALUES LESS THAN (20) ENGINE = MyISAM,
+ PARTITION `pa11` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
drop table t1;
CREATE TABLE t1 (
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -2467,16 +2467,16 @@ partkey nokey
# Case 1
# Update is refused because partitioning key is updated
UPDATE t1_part AS A NATURAL JOIN t1_part B SET A.partkey = 2, B.nokey = 3;
-ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'
UPDATE t1_part AS A NATURAL JOIN t1_part B SET A.nokey = 2, B.partkey = 3;
-ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'
# Case 2
# Like 1, but partition accessed through a view
UPDATE t1_part AS A NATURAL JOIN v1 as B SET A.nokey = 2 , B.partkey = 3;
-ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'
UPDATE v1 AS A NATURAL JOIN t1_part as B SET A.nokey = 2 , B.partkey = 3;
-ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'
# Should be (1,1),(10,10)
SELECT * FROM t1_part;
diff --git a/mysql-test/r/partition_alter.result b/mysql-test/r/partition_alter.result
index 4275ef72f24..6aa0039c8d2 100644
--- a/mysql-test/r/partition_alter.result
+++ b/mysql-test/r/partition_alter.result
@@ -59,18 +59,22 @@ partition p2 values less than ('2020-10-19'));
insert t1 values (0, '2000-01-02', 0);
insert t1 values (1, '2020-01-02', 10);
alter table t1 add check (b in (0, 1));
+ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`#sql-temporary`
+alter table t1 add check (b in (0, 10));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`d` date NOT NULL,
- `b` tinyint(1) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`,`d`)
+ `b` tinyint(1) NOT NULL DEFAULT 0,
+ PRIMARY KEY (`id`,`d`),
+ CONSTRAINT `CONSTRAINT_1` CHECK (`b` in (0,10))
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY RANGE COLUMNS(d)
-(PARTITION p1 VALUES LESS THAN ('2016-10-18') ENGINE = InnoDB,
- PARTITION p2 VALUES LESS THAN ('2020-10-19') ENGINE = InnoDB) */
+ PARTITION BY RANGE COLUMNS(`d`)
+(PARTITION `p1` VALUES LESS THAN ('2016-10-18') ENGINE = InnoDB,
+ PARTITION `p2` VALUES LESS THAN ('2020-10-19') ENGINE = InnoDB)
insert t1 values (2, '2020-01-03', 20);
+ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
drop table t1;
create table t1(id int, d date not null, b bool not null default 0, primary key(id,d))
partition by range columns (d) (
@@ -79,18 +83,22 @@ partition p2 values less than ('2020-10-19'));
insert t1 values (0, '2000-01-02', 0);
insert t1 values (1, '2020-01-02', 10);
alter table t1 add check (b in (0, 1));
+ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`#sql-temporary`
+alter table t1 add check (b in (0, 10));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`d` date NOT NULL,
- `b` tinyint(1) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`,`d`)
+ `b` tinyint(1) NOT NULL DEFAULT 0,
+ PRIMARY KEY (`id`,`d`),
+ CONSTRAINT `CONSTRAINT_1` CHECK (`b` in (0,10))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY RANGE COLUMNS(d)
-(PARTITION p1 VALUES LESS THAN ('2016-10-18') ENGINE = MyISAM,
- PARTITION p2 VALUES LESS THAN ('2020-10-19') ENGINE = MyISAM) */
+ PARTITION BY RANGE COLUMNS(`d`)
+(PARTITION `p1` VALUES LESS THAN ('2016-10-18') ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN ('2020-10-19') ENGINE = MyISAM)
insert t1 values (2, '2020-01-03', 20);
+ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
drop table t1;
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());
@@ -102,13 +110,13 @@ t1 CREATE TABLE `t1` (
`id_2` int(11) NOT NULL,
`id_3` int(11) NOT NULL,
`d1` date DEFAULT NULL,
- `dt1` datetime DEFAULT CURRENT_TIMESTAMP,
- `dt2` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `dt1` datetime DEFAULT current_timestamp(),
+ `dt2` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id_2`,`id_3`),
KEY `id_1` (`id_1`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
-/*!50100 PARTITION BY HASH (id_2)
-(PARTITION p01 ENGINE = MyISAM,
- PARTITION p02 ENGINE = MyISAM,
- PARTITION p03 ENGINE = MyISAM) */
+ PARTITION BY HASH (`id_2`)
+(PARTITION `p01` ENGINE = MyISAM,
+ PARTITION `p02` ENGINE = MyISAM,
+ PARTITION `p03` ENGINE = MyISAM)
drop table t1;
diff --git a/mysql-test/r/partition_bug18198.result b/mysql-test/r/partition_bug18198.result
index 80f11edaaf6..ee7bf514807 100644
--- a/mysql-test/r/partition_bug18198.result
+++ b/mysql-test/r/partition_bug18198.result
@@ -130,8 +130,7 @@ ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitio
create table t1 (col1 datetime)
partition by range(week(col1))
(partition p0 values less than (10), partition p1 values less than (30));
-ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
-(partition p0 values less than (10), partition p1 values less than (30))' at line 2
+ERROR HY000: This 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));
diff --git a/mysql-test/r/partition_cache.result b/mysql-test/r/partition_cache.result
index 39ba4841337..697ba1bcd15 100644
--- a/mysql-test/r/partition_cache.result
+++ b/mysql-test/r/partition_cache.result
@@ -113,9 +113,10 @@ select count(*) from t1;
count(*)
1
drop table t1;
+connect connection1,localhost,root,,;
SET SESSION STORAGE_ENGINE = InnoDB;
SET @@autocommit=1;
-connection default
+connection default;
SHOW VARIABLES LIKE 'have_query_cache';
Variable_name Value
have_query_cache YES
@@ -137,7 +138,7 @@ count(*)
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
-connection connection1
+connection connection1;
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
@@ -153,7 +154,7 @@ count(*)
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
-connection default
+connection default;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
@@ -167,7 +168,7 @@ count(*)
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
-connection connection1
+connection connection1;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
@@ -179,7 +180,7 @@ INSERT INTO t2 VALUES (6,'w');
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
3
-connection default
+connection default;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
@@ -192,7 +193,7 @@ SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
COMMIT;
-connection connection1
+connection connection1;
COMMIT;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
@@ -203,6 +204,8 @@ Qcache_queries_in_cache 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 1
+disconnect connection1;
+connection default;
set @@global.query_cache_size = @save_query_cache_size;
drop table t2;
SET global query_cache_type=default;
diff --git a/mysql-test/r/partition_cache_innodb.result b/mysql-test/r/partition_cache_innodb.result
index 271b23eed92..e6e69ee686e 100644
--- a/mysql-test/r/partition_cache_innodb.result
+++ b/mysql-test/r/partition_cache_innodb.result
@@ -21,12 +21,12 @@ Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`created_at` datetime NOT NULL,
- `cool` tinyint(4) DEFAULT '0'
+ `cool` tinyint(4) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (TO_DAYS(created_at))
-(PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = InnoDB,
- PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = InnoDB,
- PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
+ PARTITION BY RANGE (to_days(`created_at`))
+(PARTITION `month_2010_4` VALUES LESS THAN (734258) ENGINE = InnoDB,
+ PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = InnoDB,
+ PARTITION `month_max` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
INSERT INTO t1 VALUES (1, now(), 0);
flush status;
show status like "Qcache_queries_in_cache";
@@ -70,14 +70,14 @@ Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`created_at` datetime NOT NULL,
- `cool` tinyint(4) DEFAULT '0'
+ `cool` tinyint(4) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (TO_DAYS(created_at))
-SUBPARTITION BY HASH (cool)
+ PARTITION BY RANGE (to_days(`created_at`))
+SUBPARTITION BY HASH (`cool`)
SUBPARTITIONS 3
-(PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = InnoDB,
- PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = InnoDB,
- PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
+(PARTITION `month_2010_4` VALUES LESS THAN (734258) ENGINE = InnoDB,
+ PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = InnoDB,
+ PARTITION `month_max` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
INSERT INTO t1 VALUES (1, now(), 0);
flush status;
show status like "Qcache_queries_in_cache";
diff --git a/mysql-test/r/partition_cache_myisam.result b/mysql-test/r/partition_cache_myisam.result
index b7d3dc53599..d8e4f837ff7 100644
--- a/mysql-test/r/partition_cache_myisam.result
+++ b/mysql-test/r/partition_cache_myisam.result
@@ -21,12 +21,12 @@ Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`created_at` datetime NOT NULL,
- `cool` tinyint(4) DEFAULT '0'
+ `cool` tinyint(4) DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (TO_DAYS(created_at))
-(PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = MyISAM,
- PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = MyISAM,
- PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+ PARTITION BY RANGE (to_days(`created_at`))
+(PARTITION `month_2010_4` VALUES LESS THAN (734258) ENGINE = MyISAM,
+ PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = MyISAM,
+ PARTITION `month_max` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
INSERT INTO t1 VALUES (1, now(), 0);
flush status;
show status like "Qcache_queries_in_cache";
@@ -70,14 +70,14 @@ Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`created_at` datetime NOT NULL,
- `cool` tinyint(4) DEFAULT '0'
+ `cool` tinyint(4) DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (TO_DAYS(created_at))
-SUBPARTITION BY HASH (cool)
+ PARTITION BY RANGE (to_days(`created_at`))
+SUBPARTITION BY HASH (`cool`)
SUBPARTITIONS 3
-(PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = MyISAM,
- PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = MyISAM,
- PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+(PARTITION `month_2010_4` VALUES LESS THAN (734258) ENGINE = MyISAM,
+ PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = MyISAM,
+ PARTITION `month_max` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
INSERT INTO t1 VALUES (1, now(), 0);
flush status;
show status like "Qcache_queries_in_cache";
diff --git a/mysql-test/r/partition_column.result b/mysql-test/r/partition_column.result
index f18e9b39e1e..067245fc682 100644
--- a/mysql-test/r/partition_column.result
+++ b/mysql-test/r/partition_column.result
@@ -30,9 +30,9 @@ t1 CREATE TABLE `t1` (
`department` varchar(10) DEFAULT NULL,
`country` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY LIST COLUMNS(department,country)
-(PARTITION first_office VALUES IN (('dep1','Russia'),('dep1','Croatia')) ENGINE = MyISAM,
- PARTITION second_office VALUES IN (('dep2','Russia')) ENGINE = MyISAM) */
+ PARTITION BY LIST COLUMNS(`department`,`country`)
+(PARTITION `first_office` VALUES IN (('dep1','Russia'),('dep1','Croatia')) ENGINE = MyISAM,
+ PARTITION `second_office` VALUES IN (('dep2','Russia')) ENGINE = MyISAM)
SELECT * FROM t1 WHERE department = 'dep2' and country = 'Croatia';
id name department country
SELECT * FROM t1 WHERE department = 'dep1' and country = 'Croatia';
@@ -173,10 +173,10 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY LIST COLUMNS(a)
-(PARTITION p0 VALUES IN ('''') ENGINE = MyISAM,
- PARTITION p1 VALUES IN ('\\') ENGINE = MyISAM,
- PARTITION p2 VALUES IN ('\0') ENGINE = MyISAM) */
+ PARTITION BY LIST COLUMNS(`a`)
+(PARTITION `p0` VALUES IN ('''') ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN ('\\') ENGINE = MyISAM,
+ PARTITION `p2` VALUES IN ('\0') ENGINE = MyISAM)
drop table t1;
set @@sql_mode=allow_invalid_dates;
create table t1 (a char, b char, c date)
@@ -232,13 +232,13 @@ t1 CREATE TABLE `t1` (
`c` varchar(25) DEFAULT NULL,
`d` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY RANGE COLUMNS(a,b,c,d)
-SUBPARTITION BY HASH (to_seconds(d))
+ 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') ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN (1,'a',MAXVALUE,'1999-01-01') ENGINE = MyISAM,
- PARTITION p2 VALUES LESS THAN (1,'b',MAXVALUE,MAXVALUE) ENGINE = MyISAM,
- PARTITION p3 VALUES LESS THAN (1,MAXVALUE,MAXVALUE,MAXVALUE) ENGINE = MyISAM) */
+(PARTITION `p0` VALUES LESS THAN (1,'0',MAXVALUE,'1900-01-01') ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN (1,'a',MAXVALUE,'1999-01-01') ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (1,'b',MAXVALUE,MAXVALUE) ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (1,MAXVALUE,MAXVALUE,MAXVALUE) ENGINE = MyISAM)
drop table t1;
create table t1 (a int, b int)
partition by range columns (a,b)
@@ -315,10 +315,10 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY LIST COLUMNS(a,b)
-(PARTITION p0 VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM,
- PARTITION p1 VALUES IN ((1,1),(2,2)) ENGINE = MyISAM,
- PARTITION p2 VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM) */
+ PARTITION BY LIST COLUMNS(`a`,`b`)
+(PARTITION `p0` VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN ((1,1),(2,2)) ENGINE = MyISAM,
+ PARTITION `p2` VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM)
insert into t1 values (3, NULL);
insert into t1 values (NULL, 1);
insert into t1 values (NULL, NULL);
@@ -349,10 +349,10 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY LIST COLUMNS(a,b)
-(PARTITION p0 VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM,
- PARTITION p1 VALUES IN ((1,1),(2,2)) ENGINE = MyISAM,
- PARTITION p2 VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM) */
+ PARTITION BY LIST COLUMNS(`a`,`b`)
+(PARTITION `p0` VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN ((1,1),(2,2)) ENGINE = MyISAM,
+ PARTITION `p2` VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM)
drop table t1;
create table t1 (a int)
partition by list (a)
@@ -366,16 +366,16 @@ partition p1 values in (4, NULL, 3));
select partition_method, partition_expression, partition_description
from information_schema.partitions where table_name = "t1";
partition_method partition_expression partition_description
-LIST a 2,1
-LIST a NULL,4,3
+LIST `a` 2,1
+LIST `a` NULL,4,3
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST (a)
-(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM,
- PARTITION p1 VALUES IN (NULL,4,3) ENGINE = MyISAM) */
+ PARTITION BY LIST (`a`)
+(PARTITION `p0` VALUES IN (2,1) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN (NULL,4,3) ENGINE = MyISAM)
insert into t1 values (1);
insert into t1 values (2);
insert into t1 values (3);
@@ -403,9 +403,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY LIST COLUMNS(a)
-(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM,
- PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM) */
+ PARTITION BY LIST COLUMNS(`a`)
+(PARTITION `p0` VALUES IN (2,1) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN (4,NULL,3) ENGINE = MyISAM)
insert into t1 values (1);
insert into t1 values (2);
insert into t1 values (3);
@@ -418,9 +418,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY LIST COLUMNS(a)
-(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM,
- PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM) */
+ PARTITION BY LIST COLUMNS(`a`)
+(PARTITION `p0` VALUES IN (2,1) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN (4,NULL,3) ENGINE = MyISAM)
drop table t1;
create table t1 (a int, b char(10), c varchar(5), d int)
partition by range columns(a,b,c)
@@ -453,13 +453,13 @@ t1 CREATE TABLE `t1` (
`c` varchar(5) DEFAULT NULL,
`d` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY RANGE COLUMNS(a,b,c)
-SUBPARTITION BY KEY (c,d)
+ PARTITION BY RANGE COLUMNS(`a`,`b`,`c`)
+SUBPARTITION BY KEY (`c`,`d`)
SUBPARTITIONS 3
-(PARTITION p0 VALUES LESS THAN (1,'abc','abc') ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN (2,'abc','abc') ENGINE = MyISAM,
- PARTITION p2 VALUES LESS THAN (3,'abc','abc') ENGINE = MyISAM,
- PARTITION p3 VALUES LESS THAN (4,'abc','abc') ENGINE = MyISAM) */
+(PARTITION `p0` VALUES LESS THAN (1,'abc','abc') ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN (2,'abc','abc') ENGINE = MyISAM,
+ PARTITION `p2` VALUES LESS THAN (3,'abc','abc') ENGINE = MyISAM,
+ PARTITION `p3` VALUES LESS THAN (4,'abc','abc') ENGINE = MyISAM)
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);
@@ -486,9 +486,9 @@ t1 CREATE TABLE `t1` (
`b` varchar(2) DEFAULT NULL,
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY RANGE COLUMNS(a,b,c)
-(PARTITION p0 VALUES LESS THAN (1,'A',1) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN (1,'B',1) ENGINE = MyISAM) */
+ PARTITION BY RANGE COLUMNS(`a`,`b`,`c`)
+(PARTITION `p0` VALUES LESS THAN (1,'A',1) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN (1,'B',1) ENGINE = MyISAM)
insert into t1 values (1, 'A', 1);
explain partitions select * from t1 where a = 1 AND b <= 'A' and c = 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/r/partition_csv.result b/mysql-test/r/partition_csv.result
index 18e28d4670a..836c49682b2 100644
--- a/mysql-test/r/partition_csv.result
+++ b/mysql-test/r/partition_csv.result
@@ -34,10 +34,13 @@ SET GLOBAL general_log =1;
# 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;
i
1
+disconnect con1;
+connection default;
USE mysql;
SET GLOBAL general_log =0;
ALTER TABLE general_log RENAME TO gl_partitioned;
diff --git a/mysql-test/r/partition_datatype.result b/mysql-test/r/partition_datatype.result
index eb09d81969f..2e518c194f0 100644
--- a/mysql-test/r/partition_datatype.result
+++ b/mysql-test/r/partition_datatype.result
@@ -312,6 +312,7 @@ select * from t1 where a = 'bbbb';
a
bbbb
drop table t1;
+set sql_mode='';
create table t1 (a varchar(3070)) partition by key (a);
ERROR HY000: The total length of the partitioning fields is too large
create table t1 (a varchar(65532) not null) partition by key (a);
@@ -322,6 +323,7 @@ create table t1 (a varchar(65534) not null) partition by key (a);
ERROR HY000: A BLOB field is not allowed in partition function
create table t1 (a varchar(65535)) partition by key (a);
ERROR HY000: A BLOB field is not allowed in partition function
+set sql_mode=default;
create table t1 (a bit(27), primary key (a)) engine=myisam
partition by hash (a)
(partition p0, partition p1, partition p2);
@@ -331,10 +333,10 @@ t1 CREATE TABLE `t1` (
`a` bit(27) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY HASH (a)
-(PARTITION p0 ENGINE = MyISAM,
- PARTITION p1 ENGINE = MyISAM,
- PARTITION p2 ENGINE = MyISAM) */
+ PARTITION BY HASH (`a`)
+(PARTITION `p0` ENGINE = MyISAM,
+ PARTITION `p1` ENGINE = MyISAM,
+ PARTITION `p2` ENGINE = MyISAM)
insert into t1 values (1),(4),(7),(10),(13),(16),(19),(22),(25),(28),(31),(34);
select hex(a) from t1 where a = 7;
hex(a)
@@ -365,16 +367,16 @@ PARTITION `pMax` VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (NULL, 'UTC');
INSERT INTO t1 VALUES ('0000-00-00 00:00:00', 'UTC');
# Test invalid values
-INSERT INTO t1 VALUES ('1901-01-01 00:00:00', 'UTCI');
+INSERT IGNORE INTO t1 VALUES ('1901-01-01 00:00:00', 'UTCI');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-INSERT INTO t1 VALUES ('1969-12-31 23:59:59', 'UTCI');
+INSERT IGNORE INTO t1 VALUES ('1969-12-31 23:59:59', 'UTCI');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-INSERT INTO t1 VALUES ('2038-01-19 03:14:08', 'UTCI');
+INSERT IGNORE INTO t1 VALUES ('2038-01-19 03:14:08', 'UTCI');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-INSERT INTO t1 VALUES ('1970-01-01 00:00:00', 'UTCI');
+INSERT IGNORE INTO t1 VALUES ('1970-01-01 00:00:00', 'UTCI');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
# Test start range
@@ -401,32 +403,32 @@ SET @@session.time_zone = 'Europe/Moscow';
INSERT INTO t1 VALUES (NULL, 'Moscow');
INSERT INTO t1 VALUES ('0000-00-00 00:00:00', 'Moscow');
# Test invalid values
-INSERT INTO t1 VALUES ('0000-00-00 03:00:00', 'MoscowI');
+INSERT IGNORE INTO t1 VALUES ('0000-00-00 03:00:00', 'MoscowI');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
-INSERT INTO t1 VALUES ('1901-01-01 00:00:00', 'MoscowI');
+INSERT IGNORE INTO t1 VALUES ('1901-01-01 00:00:00', 'MoscowI');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-INSERT INTO t1 VALUES ('1969-12-31 23:59:59', 'MoscowI');
+INSERT IGNORE INTO t1 VALUES ('1969-12-31 23:59:59', 'MoscowI');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-INSERT INTO t1 VALUES ('1970-01-01 02:29:29', 'MoscowI');
+INSERT IGNORE INTO t1 VALUES ('1970-01-01 02:29:29', 'MoscowI');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-INSERT INTO t1 VALUES ('2038-01-19 06:14:08', 'MoscowI');
+INSERT IGNORE INTO t1 VALUES ('2038-01-19 06:14:08', 'MoscowI');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-INSERT INTO t1 VALUES ('1970-01-01 03:00:00', 'MoscowI');
+INSERT IGNORE INTO t1 VALUES ('1970-01-01 03:00:00', 'MoscowI');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
# values truncated to 03:00:00 due to daylight saving shift
-INSERT INTO t1 VALUES ('2011-03-27 02:00:00', 'MoscowI');
+INSERT IGNORE INTO t1 VALUES ('2011-03-27 02:00:00', 'MoscowI');
Warnings:
Warning 1299 Invalid TIMESTAMP value in column 'a' at row 1
-INSERT INTO t1 VALUES ('2011-03-27 02:00:01', 'MoscowI');
+INSERT IGNORE INTO t1 VALUES ('2011-03-27 02:00:01', 'MoscowI');
Warnings:
Warning 1299 Invalid TIMESTAMP value in column 'a' at row 1
-INSERT INTO t1 VALUES ('2011-03-27 02:59:59', 'MoscowI');
+INSERT IGNORE INTO t1 VALUES ('2011-03-27 02:59:59', 'MoscowI');
Warnings:
Warning 1299 Invalid TIMESTAMP value in column 'a' at row 1
# Test start range
@@ -680,7 +682,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 7 Using where; Using filesort
# Test end range changes
DELETE FROM t2 WHERE a = 0;
-INSERT INTO t2 VALUES ('1970-01-01 00:00:00', 'UTC');
+INSERT IGNORE INTO t2 VALUES ('1970-01-01 00:00:00', 'UTC');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
SELECT COUNT(*) FROM t2;
@@ -699,7 +701,7 @@ a tz
2038-01-19 03:14:07 Moscow
2038-01-19 03:14:07 UTC
2038-01-19 03:14:06 Moscow
-UPDATE t2 SET a = TIMESTAMPADD(SECOND, 1, a);
+UPDATE IGNORE t2 SET a = TIMESTAMPADD(SECOND, 1, a);
Warnings:
Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
Warning 1264 Out of range value for column 'a' at row 34
@@ -763,7 +765,7 @@ NULL UTC
2038-01-19 03:14:07 Moscow
2038-01-19 03:14:07 UTC
# Test start range changes
-INSERT INTO t2 VALUES ('1970-01-01 00:00:00', 'UTC');
+INSERT IGNORE INTO t2 VALUES ('1970-01-01 00:00:00', 'UTC');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
SELECT COUNT(*) FROM t2;
@@ -782,7 +784,7 @@ a tz
2038-01-19 03:14:07 Moscow
2038-01-19 03:14:07 UTC
2011-10-30 00:00:02 Moscow
-UPDATE t2 SET a = TIMESTAMPADD(SECOND, -1, a);
+UPDATE IGNORE t2 SET a = TIMESTAMPADD(SECOND, -1, a);
Warnings:
Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
@@ -852,16 +854,16 @@ t2 CREATE TABLE `t2` (
`a` timestamp NULL DEFAULT NULL,
`tz` varchar(16) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (UNIX_TIMESTAMP(a))
-(PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM,
+ PARTITION BY RANGE (unix_timestamp(`a`))
+(PARTITION `p0` VALUES LESS THAN (0) ENGINE = MyISAM,
PARTITION `p-2000` VALUES LESS THAN (946684800) ENGINE = MyISAM,
PARTITION `p-2011-MSK` VALUES LESS THAN (1301180400) ENGINE = MyISAM,
PARTITION `p-2011-MSD-1` VALUES LESS THAN (1319925600) ENGINE = MyISAM,
PARTITION `p-2011-MSD-2` VALUES LESS THAN (1319929200) ENGINE = MyISAM,
PARTITION `p-2012-MSK-1` VALUES LESS THAN (1319932800) ENGINE = MyISAM,
PARTITION `p-2012-MSK-2` VALUES LESS THAN (1332630000) ENGINE = MyISAM,
- PARTITION pEnd VALUES LESS THAN (2147483647) ENGINE = MyISAM,
- PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+ PARTITION `pEnd` VALUES LESS THAN (2147483647) ENGINE = MyISAM,
+ PARTITION `pMax` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
TRUNCATE TABLE t2;
SET @@session.time_zone = 'Europe/Moscow';
INSERT INTO t2 SELECT * FROM t1;
@@ -1160,7 +1162,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 22 Using where; Using filesort
# Test end range changes
DELETE FROM t2 WHERE a = 0;
-INSERT INTO t2 VALUES ('1970-01-01 00:00:00', 'Moscow');
+INSERT IGNORE INTO t2 VALUES ('1970-01-01 00:00:00', 'Moscow');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
SELECT COUNT(*) FROM t2;
@@ -1179,7 +1181,7 @@ a tz
2038-01-19 06:14:07 Moscow
2038-01-19 06:14:07 UTC
2038-01-19 06:14:06 Moscow
-UPDATE t2 SET a = TIMESTAMPADD(SECOND, 1, a);
+UPDATE IGNORE t2 SET a = TIMESTAMPADD(SECOND, 1, a);
Warnings:
Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
Warning 1299 Invalid TIMESTAMP value in column 'a' at row 8
@@ -1245,7 +1247,7 @@ NULL UTC
2038-01-19 06:14:07 Moscow
2038-01-19 06:14:07 UTC
# Test start range changes
-INSERT INTO t2 VALUES ('1970-01-01 00:00:00', 'Moscow');
+INSERT IGNORE INTO t2 VALUES ('1970-01-01 00:00:00', 'Moscow');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
SELECT COUNT(*) FROM t2;
@@ -1264,7 +1266,7 @@ a tz
2038-01-19 06:14:07 Moscow
2038-01-19 06:14:07 UTC
2011-10-30 03:00:02 Moscow
-UPDATE t2 SET a = TIMESTAMPADD(SECOND, -1, a);
+UPDATE IGNORE t2 SET a = TIMESTAMPADD(SECOND, -1, a);
Warnings:
Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
@@ -1336,16 +1338,16 @@ t2 CREATE TABLE `t2` (
`a` timestamp NULL DEFAULT NULL,
`tz` varchar(16) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (UNIX_TIMESTAMP(a))
-(PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM,
+ PARTITION BY RANGE (unix_timestamp(`a`))
+(PARTITION `p0` VALUES LESS THAN (0) ENGINE = MyISAM,
PARTITION `p-2000` VALUES LESS THAN (946684800) ENGINE = MyISAM,
PARTITION `p-2011-MSK` VALUES LESS THAN (1301180400) ENGINE = MyISAM,
PARTITION `p-2011-MSD-1` VALUES LESS THAN (1319925600) ENGINE = MyISAM,
PARTITION `p-2011-MSD-2` VALUES LESS THAN (1319929200) ENGINE = MyISAM,
PARTITION `p-2012-MSK-1` VALUES LESS THAN (1319932800) ENGINE = MyISAM,
PARTITION `p-2012-MSK-2` VALUES LESS THAN (1332630000) ENGINE = MyISAM,
- PARTITION pEnd VALUES LESS THAN (2147483647) ENGINE = MyISAM,
- PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+ PARTITION `pEnd` VALUES LESS THAN (2147483647) ENGINE = MyISAM,
+ PARTITION `pMax` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
TRUNCATE TABLE t2;
DROP TABLE t1, t2;
SET @@session.time_zone= @old_time_zone;
diff --git a/mysql-test/r/partition_debug_sync.result b/mysql-test/r/partition_debug_sync.result
index 7abe0163a98..b79385686b7 100644
--- a/mysql-test/r/partition_debug_sync.result
+++ b/mysql-test/r/partition_debug_sync.result
@@ -8,7 +8,7 @@ SET DEBUG_SYNC= 'RESET';
# by adding a small sleep to verify that the delete waits. This happens
# only until ALTER tries to upgrade its MDL lock, which ends up in MDL
# deadlock which is correctly reported.
-# Con 1
+connect con1, localhost, root,,;
SET DEBUG_SYNC= 'RESET';
CREATE TABLE t1
(a INTEGER,
@@ -23,14 +23,16 @@ 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';
ALTER TABLE t1 REMOVE PARTITIONING;
-# Con default
+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;
-# Con 1
+connection con1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection default;
SET DEBUG_SYNC= 'RESET';
+connection con1;
SET DEBUG_SYNC= 'RESET';
#
# Bug#42438: Crash ha_partition::change_table_ptr
@@ -50,39 +52,15 @@ 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';
ALTER TABLE t2 REMOVE PARTITIONING;
-# Con default
+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;
-# Con 1
+connection con1;
ERROR 42S02: Table 'test.t2' doesn't exist
SET DEBUG_SYNC= 'RESET';
-# Con default
+disconnect con1;
+connection default;
SET DEBUG_SYNC= 'RESET';
End of 5.1 tests
-#
-# Coverage test for non pruned ha_partition::store_lock()
-#
-CREATE TABLE t1 (a int) ENGINE = InnoDB;
-CREATE TABLE t2 (a int PRIMARY KEY)
-ENGINE = InnoDB PARTITION BY HASH (a) PARTITIONS 3;
-HANDLER t1 OPEN;
-# Con1
-LOCK TABLES t1 WRITE, t2 READ;
-# Default
-SET DEBUG_SYNC="wait_for_lock SIGNAL locking";
-INSERT INTO t2 VALUES (1), (2), (3);
-# Con1
-SET DEBUG_SYNC="now WAIT_FOR locking";
-ALTER TABLE t1 ADD COLUMN b int;
-# Default
-ERROR HY000: Wait on a lock was aborted due to a pending exclusive lock
-SELECT 1;
-1
-1
-# Con1
-UNLOCK TABLES;
-# Default
-SET DEBUG_SYNC = 'RESET';
-DROP TABLE t1, t2;
diff --git a/mysql-test/r/partition_default.result b/mysql-test/r/partition_default.result
new file mode 100644
index 00000000000..db3b714bbcc
--- /dev/null
+++ b/mysql-test/r/partition_default.result
@@ -0,0 +1,1267 @@
+create table t1 (a int, b int)
+PARTITION BY LIST (a)
+(
+PARTITION p2 VALUES IN (4,5,6),
+PARTITION p1 VALUES IN (1)
+)
+;
+insert into t1 values (10,10);
+ERROR HY000: Table has no partition for value 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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST (`a`)
+(PARTITION `p2` VALUES IN (4,5,6) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN (1) ENGINE = MyISAM,
+ PARTITION `p0` DEFAULT ENGINE = MyISAM)
+insert into t1 values (10,10);
+insert into t1 values (4,4);
+select * from t1;
+a b
+4 4
+10 10
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 1
+p1 0
+p2 1
+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,
+PARTITION p3 DEFAULT
+)
+;
+ERROR HY000: Only one DEFAULT partition allowed
+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
+)
+;
+ERROR HY000: Only one DEFAULT partition allowed
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST (`a`)
+(PARTITION `p0` DEFAULT ENGINE = MyISAM,
+ PARTITION `p2` VALUES IN (4,5,6) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN (1) ENGINE = MyISAM)
+insert into t1 values (10,10);
+select * from t1;
+a b
+10 10
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 1
+p1 0
+p2 0
+drop table t1;
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST (`a`)
+(PARTITION `p0` DEFAULT ENGINE = MyISAM,
+ PARTITION `p2` VALUES IN (4,5,6) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN (1,0) ENGINE = MyISAM)
+insert into t1 values (10,10);
+select * from t1;
+a b
+10 10
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 1
+p1 0
+p2 0
+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)),
+PARTITION p1 VALUES IN ((1,1),(0,0)),
+PARTITION p0 DEFAULT
+)
+;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST COLUMNS(`a`,`b`)
+(PARTITION `p2` VALUES IN ((1,4),(2,5),(3,6)) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN ((1,1),(0,0)) ENGINE = MyISAM,
+ PARTITION `p0` DEFAULT ENGINE = MyISAM)
+insert into t1 values (10,10);
+select * from t1;
+a b
+10 10
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 1
+p1 0
+p2 0
+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)),
+PARTITION p1 VALUES IN ((1,1),(0,0)),
+PARTITION p0 DEFAULT,
+PARTITION p3 DEFAULT
+)
+;
+ERROR HY000: Only one DEFAULT partition allowed
+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
+)
+;
+ERROR HY000: Only one DEFAULT partition allowed
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST (`a`)
+(PARTITION `p2` VALUES IN (4,5,6) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN (1,20) ENGINE = MyISAM,
+ PARTITION `p0` DEFAULT ENGINE = MyISAM)
+insert into t1 values (10,10);
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 1
+p1 0
+p2 0
+select * from t1 where a=10;
+a b
+10 10
+select * from t1 where a<=10;
+a b
+10 10
+select * from t1 where a<=20;
+a b
+10 10
+select * from t1 where a>=10;
+a b
+10 10
+select * from t1 where a>=5;
+a b
+10 10
+insert into t1 values (20,20),(5,5);
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 1
+p1 1
+p2 1
+select * from t1 where a=10;
+a b
+10 10
+select * from t1 where a<=10;
+a b
+5 5
+10 10
+select * from t1 where a<=20;
+a b
+5 5
+20 20
+10 10
+select * from t1 where a>=10;
+a b
+20 20
+10 10
+select * from t1 where a>=5;
+a b
+5 5
+20 20
+10 10
+explain partitions select * from t1 where a=10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 system NULL NULL NULL NULL 1
+explain partitions select * from t1 where a=5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 system NULL NULL NULL NULL 1
+select * from t1 where a=10 or a=5;
+a b
+5 5
+10 10
+explain partitions select * from t1 where a=10 or a=5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2,p0 ALL NULL NULL NULL NULL 2 Using where
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST COLUMNS(`a`,`b`)
+(PARTITION `p2` VALUES IN ((1,4),(2,5),(3,6),(5,5)) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN ((1,1),(20,20)) ENGINE = MyISAM,
+ PARTITION `p0` DEFAULT ENGINE = MyISAM)
+insert into t1 values (10,10);
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 1
+p1 0
+p2 0
+select * from t1 where a=10 and b=10;
+a b
+10 10
+explain partitions select * from t1 where a=10 and b=10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 system NULL NULL NULL NULL 1
+select * from t1 where a=10;
+a b
+10 10
+explain partitions select * from t1 where a=10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 system NULL NULL NULL NULL 1
+select * from t1 where a<=10;
+a b
+10 10
+select * from t1 where a>=10;
+a b
+10 10
+insert into t1 values (20,20),(5,5);
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 1
+p1 1
+p2 1
+select * from t1 where a=10 and b=10;
+a b
+10 10
+explain partitions select * from t1 where a=10 and b=10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 system NULL NULL NULL NULL 1
+select * from t1 where a=10 and b=10 or a=20 and b=20;
+a b
+20 20
+10 10
+explain partitions select * from t1 where a=10 and b=10 or a=20 and b=20;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p0 ALL NULL NULL NULL NULL 2 Using where
+drop table t1;
+create table t1 (a int, b int);
+insert into t1 values (10,10),(2,5),(0,0);
+select * from t1;
+a b
+10 10
+2 5
+0 0
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST (`a` + `b`)
+(PARTITION `p2` VALUES IN (1,2,3,7) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN (21,0) ENGINE = MyISAM,
+ PARTITION `p0` DEFAULT ENGINE = MyISAM)
+select * from t1;
+a b
+2 5
+0 0
+10 10
+explain partitions select * from t1 where a=2 and b=5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 system NULL NULL NULL NULL 1
+explain partitions select * from t1 where a=10 and b=10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 system NULL NULL NULL NULL 1
+drop table t1;
+create table t1 (a int, b int);
+insert into t1 values (10,10),(2,5),(0,0);
+select * from t1;
+a b
+10 10
+2 5
+0 0
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST (`a` + 5)
+(PARTITION `p2` VALUES IN (1,2,3,7) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN (0) ENGINE = MyISAM,
+ PARTITION `p0` DEFAULT ENGINE = MyISAM)
+select * from t1;
+a b
+2 5
+10 10
+0 0
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 2
+p1 0
+p2 1
+explain partitions select * from t1 where a>=2;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2,p1,p0 ALL NULL NULL NULL NULL 3 Using where
+explain partitions select * from t1 where a>=2 and a<=3;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2,p0 ALL NULL NULL NULL NULL 3 Using where
+explain partitions select * from t1 where a=10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 Using where
+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')));
+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');
+SELECT * FROM t1 WHERE a < '1001-01-01';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+SELECT * FROM t1 WHERE a <= '1001-01-01';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+SELECT * FROM t1 WHERE a >= '1001-01-01';
+a
+1001-01-01
+1002-00-00
+2001-01-01
+SELECT * FROM t1 WHERE a > '1001-01-01';
+a
+1002-00-00
+2001-01-01
+SELECT * FROM t1 WHERE a = '1001-01-01';
+a
+1001-01-01
+SELECT * FROM t1 WHERE a < '1001-00-00';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+SELECT * FROM t1 WHERE a <= '1001-00-00';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+SELECT * FROM t1 WHERE a >= '1001-00-00';
+a
+1001-00-00
+1001-01-01
+1002-00-00
+2001-01-01
+SELECT * FROM t1 WHERE a > '1001-00-00';
+a
+1001-01-01
+1002-00-00
+2001-01-01
+SELECT * FROM t1 WHERE a = '1001-00-00';
+a
+1001-00-00
+# Disabling warnings for the invalid date
+SELECT * FROM t1 WHERE a < '1999-02-31';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+1002-00-00
+SELECT * FROM t1 WHERE a <= '1999-02-31';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+1002-00-00
+SELECT * FROM t1 WHERE a >= '1999-02-31';
+a
+2001-01-01
+SELECT * FROM t1 WHERE a > '1999-02-31';
+a
+2001-01-01
+SELECT * FROM t1 WHERE a = '1999-02-31';
+a
+SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+1002-00-00
+SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
+a
+1001-00-00
+1001-01-01
+1002-00-00
+SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01';
+a
+0001-01-01
+1001-00-00
+1001-01-01
+# test without index
+ALTER TABLE t1 DROP KEY a;
+SELECT * FROM t1 WHERE a < '1001-01-01';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+SELECT * FROM t1 WHERE a <= '1001-01-01';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+SELECT * FROM t1 WHERE a >= '1001-01-01';
+a
+1001-01-01
+1002-00-00
+2001-01-01
+SELECT * FROM t1 WHERE a > '1001-01-01';
+a
+1002-00-00
+2001-01-01
+SELECT * FROM t1 WHERE a = '1001-01-01';
+a
+1001-01-01
+SELECT * FROM t1 WHERE a < '1001-00-00';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+SELECT * FROM t1 WHERE a <= '1001-00-00';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+SELECT * FROM t1 WHERE a >= '1001-00-00';
+a
+1001-00-00
+1001-01-01
+1002-00-00
+2001-01-01
+SELECT * FROM t1 WHERE a > '1001-00-00';
+a
+1001-01-01
+1002-00-00
+2001-01-01
+SELECT * FROM t1 WHERE a = '1001-00-00';
+a
+1001-00-00
+# Disabling warnings for the invalid date
+SELECT * FROM t1 WHERE a < '1999-02-31';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+1002-00-00
+SELECT * FROM t1 WHERE a <= '1999-02-31';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+1002-00-00
+SELECT * FROM t1 WHERE a >= '1999-02-31';
+a
+2001-01-01
+SELECT * FROM t1 WHERE a > '1999-02-31';
+a
+2001-01-01
+SELECT * FROM t1 WHERE a = '1999-02-31';
+a
+SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+1002-00-00
+SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
+a
+1001-00-00
+1001-01-01
+1002-00-00
+SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01';
+a
+0001-01-01
+1001-00-00
+1001-01-01
+DROP TABLE t1;
+# 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')));
+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');
+SELECT * FROM t1 WHERE a < '1001-01-01';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+SELECT * FROM t1 WHERE a <= '1001-01-01';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+SELECT * FROM t1 WHERE a >= '1001-01-01';
+a
+1001-01-01
+1002-00-00
+2001-01-01
+SELECT * FROM t1 WHERE a > '1001-01-01';
+a
+1002-00-00
+2001-01-01
+SELECT * FROM t1 WHERE a = '1001-01-01';
+a
+1001-01-01
+SELECT * FROM t1 WHERE a < '1001-00-00';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+SELECT * FROM t1 WHERE a <= '1001-00-00';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+SELECT * FROM t1 WHERE a >= '1001-00-00';
+a
+1001-00-00
+1001-01-01
+1002-00-00
+2001-01-01
+SELECT * FROM t1 WHERE a > '1001-00-00';
+a
+1001-01-01
+1002-00-00
+2001-01-01
+SELECT * FROM t1 WHERE a = '1001-00-00';
+a
+1001-00-00
+# Disabling warnings for the invalid date
+SELECT * FROM t1 WHERE a < '1999-02-31';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+1002-00-00
+SELECT * FROM t1 WHERE a <= '1999-02-31';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+1002-00-00
+SELECT * FROM t1 WHERE a >= '1999-02-31';
+a
+2001-01-01
+SELECT * FROM t1 WHERE a > '1999-02-31';
+a
+2001-01-01
+SELECT * FROM t1 WHERE a = '1999-02-31';
+a
+SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+1002-00-00
+SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
+a
+1001-00-00
+1001-01-01
+1002-00-00
+SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01';
+a
+0001-01-01
+1001-00-00
+1001-01-01
+# test without index
+ALTER TABLE t1 DROP KEY a;
+SELECT * FROM t1 WHERE a < '1001-01-01';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+SELECT * FROM t1 WHERE a <= '1001-01-01';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+SELECT * FROM t1 WHERE a >= '1001-01-01';
+a
+1001-01-01
+1002-00-00
+2001-01-01
+SELECT * FROM t1 WHERE a > '1001-01-01';
+a
+1002-00-00
+2001-01-01
+SELECT * FROM t1 WHERE a = '1001-01-01';
+a
+1001-01-01
+SELECT * FROM t1 WHERE a < '1001-00-00';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+SELECT * FROM t1 WHERE a <= '1001-00-00';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+SELECT * FROM t1 WHERE a >= '1001-00-00';
+a
+1001-00-00
+1001-01-01
+1002-00-00
+2001-01-01
+SELECT * FROM t1 WHERE a > '1001-00-00';
+a
+1001-01-01
+1002-00-00
+2001-01-01
+SELECT * FROM t1 WHERE a = '1001-00-00';
+a
+1001-00-00
+# Disabling warnings for the invalid date
+SELECT * FROM t1 WHERE a < '1999-02-31';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+1002-00-00
+SELECT * FROM t1 WHERE a <= '1999-02-31';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+1002-00-00
+SELECT * FROM t1 WHERE a >= '1999-02-31';
+a
+2001-01-01
+SELECT * FROM t1 WHERE a > '1999-02-31';
+a
+2001-01-01
+SELECT * FROM t1 WHERE a = '1999-02-31';
+a
+SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+1002-00-00
+SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01';
+a
+0000-00-00
+0000-01-02
+0001-01-01
+1001-00-00
+1001-01-01
+SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00';
+a
+1001-00-00
+1001-01-01
+1002-00-00
+SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01';
+a
+0001-01-01
+1001-00-00
+1001-01-01
+DROP TABLE t1;
+create table t1 (a int, b int);
+insert into t1 values (10,10),(2,5),(0,0);
+select * from t1;
+a b
+10 10
+2 5
+0 0
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST (`a`)
+(PARTITION `p2` VALUES IN (1,2,3) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN (20,0) ENGINE = MyISAM,
+ PARTITION `p0` DEFAULT ENGINE = MyISAM)
+select * from t1;
+a b
+2 5
+0 0
+10 10
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 1
+p1 1
+p2 1
+explain partitions select * from t1 where a=2 and b=5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 system NULL NULL NULL NULL 1
+explain partitions select * from t1 where a=10 and b=10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 system NULL NULL NULL NULL 1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST (`a`)
+(PARTITION `p2` VALUES IN (1,2,3) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN (20,0) ENGINE = MyISAM,
+ PARTITION `p0` VALUES IN (10) ENGINE = MyISAM)
+select * from t1;
+a b
+2 5
+0 0
+10 10
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 1
+p1 1
+p2 1
+explain partitions select * from t1 where a=2 and b=5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 system NULL NULL NULL NULL 1
+explain partitions select * from t1 where a=10 and b=10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 system NULL NULL NULL NULL 1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST (`a`)
+(PARTITION `p2` DEFAULT ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN (20,0) ENGINE = MyISAM,
+ PARTITION `p0` VALUES IN (10) ENGINE = MyISAM)
+select * from t1;
+a b
+2 5
+0 0
+10 10
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 1
+p1 1
+p2 1
+explain partitions select * from t1 where a=2 and b=5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 system NULL NULL NULL NULL 1
+explain partitions select * from t1 where a=10 and b=10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 system NULL NULL NULL NULL 1
+alter table t1 drop partition p2;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST (`a`)
+(PARTITION `p1` VALUES IN (20,0) ENGINE = MyISAM,
+ PARTITION `p0` VALUES IN (10) ENGINE = MyISAM)
+select * from t1;
+a b
+0 0
+10 10
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 1
+p1 1
+alter table t1 add partition (PARTITION pd DEFAULT);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST (`a`)
+(PARTITION `p1` VALUES IN (20,0) ENGINE = MyISAM,
+ PARTITION `p0` VALUES IN (10) ENGINE = MyISAM,
+ PARTITION `pd` DEFAULT ENGINE = MyISAM)
+alter table t1 add partition (PARTITION pdd DEFAULT);
+ERROR HY000: Only one DEFAULT partition allowed
+alter table t1 drop partition pd;
+alter table t1 add partition (PARTITION pdd DEFAULT,
+PARTITION pd DEFAULT);
+ERROR HY000: Only one DEFAULT partition allowed
+drop table t1;
+create table t1 (a int, b int);
+insert into t1 values (10,10),(2,5),(0,0);
+select * from t1;
+a b
+10 10
+2 5
+0 0
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST COLUMNS(`a`,`b`)
+(PARTITION `p2` VALUES IN ((1,4),(2,5),(3,6)) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN ((1,1),(0,0)) ENGINE = MyISAM,
+ PARTITION `p0` DEFAULT ENGINE = MyISAM)
+select * from t1;
+a b
+2 5
+0 0
+10 10
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 1
+p1 1
+p2 1
+explain partitions select * from t1 where a=2 and b=5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 system NULL NULL NULL NULL 1
+explain partitions select * from t1 where a=10 and b=10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 system NULL NULL NULL NULL 1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST COLUMNS(`a`,`b`)
+(PARTITION `p2` VALUES IN ((1,4),(2,5),(3,6)) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN ((1,1),(0,0)) ENGINE = MyISAM,
+ PARTITION `p0` VALUES IN ((10,10)) ENGINE = MyISAM)
+select * from t1;
+a b
+2 5
+0 0
+10 10
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 1
+p1 1
+p2 1
+explain partitions select * from t1 where a=2 and b=5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 system NULL NULL NULL NULL 1
+explain partitions select * from t1 where a=10 and b=10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 system NULL NULL NULL NULL 1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST COLUMNS(`a`,`b`)
+(PARTITION `p2` DEFAULT ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN ((1,1),(0,0)) ENGINE = MyISAM,
+ PARTITION `p0` VALUES IN ((10,10)) ENGINE = MyISAM)
+select * from t1;
+a b
+2 5
+0 0
+10 10
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 1
+p1 1
+p2 1
+explain partitions select * from t1 where a=2 and b=5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 system NULL NULL NULL NULL 1
+explain partitions select * from t1 where a=10 and b=10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 system NULL NULL NULL NULL 1
+alter table t1 drop partition p2;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST COLUMNS(`a`,`b`)
+(PARTITION `p1` VALUES IN ((1,1),(0,0)) ENGINE = MyISAM,
+ PARTITION `p0` VALUES IN ((10,10)) ENGINE = MyISAM)
+select * from t1;
+a b
+0 0
+10 10
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 1
+p1 1
+alter table t1 add partition (PARTITION pd DEFAULT);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST COLUMNS(`a`,`b`)
+(PARTITION `p1` VALUES IN ((1,1),(0,0)) ENGINE = MyISAM,
+ PARTITION `p0` VALUES IN ((10,10)) ENGINE = MyISAM,
+ PARTITION `pd` DEFAULT ENGINE = MyISAM)
+alter table t1 add partition (PARTITION pdd DEFAULT);
+ERROR HY000: Only one DEFAULT partition allowed
+alter table t1 drop partition pd;
+alter table t1 add partition (PARTITION pdd DEFAULT,
+PARTITION pd DEFAULT);
+ERROR HY000: Only one DEFAULT partition allowed
+drop table t1;
+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);
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p1 1
+p2 1
+pd 2
+alter table t1 add partition
+(partition p0 VALUES IN (2,3));
+select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
+partition_name table_rows
+p0 0
+p1 1
+p2 1
+pd 2
+drop table t1;
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST COLUMNS(`a`,`b`)
+(PARTITION `p0` DEFAULT ENGINE = MyISAM,
+ PARTITION `p2` VALUES IN ((1,4),(2,5),(3,6)) ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN ((1,1),(0,0)) ENGINE = MyISAM)
+drop table t1;
+#
+# MDEV-10765: Wrong result - query does not retrieve values from
+# default partition on a table partitioned by list columns
+#
+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;
+i j
+10 1
+explain partitions
+select * from t1 where i = 10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p2 system NULL NULL NULL NULL 1
+select * from t1 where i = 10 and j=1;
+i j
+10 1
+explain partitions
+select * from t1 where i = 10 and j=1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 system NULL NULL NULL NULL 1
+insert into t1 values (10,10);
+select * from t1 where i = 10 and j=10;
+i j
+10 10
+explain partitions
+select * from t1 where i = 10 and j=10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 system NULL NULL NULL NULL 1
+drop table t1;
+create table t1
+(
+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);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p2,p3 ALL NULL NULL NULL NULL 3 Using where
+drop table t1;
+#
+# MDEV-10763: Wrong result - server does not return NULL values
+# from default list partition after ALTER table
+#
+create table t1 (i int) partition by list (i) ( partition p1 default);
+insert into t1 values (null);
+select * from t1 where i is null;
+i
+NULL
+alter table t1 partition by list (i) ( partition p1 values in (1), partition p2 default);
+select * from t1 where i is null;
+i
+NULL
+explain partitions
+select * from t1 where i is null;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p2 system NULL NULL NULL NULL 1
+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;
+i
+NULL
+explain partitions
+select * from t1 where i is null;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0 system NULL NULL NULL NULL 1
+drop table t1;
+#
+# MDEV-12395: DROP PARTITION does not work as expected when
+# table has DEFAULT LIST partition
+#
+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;
+i
+10
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST (`i`)
+(PARTITION `pdef` DEFAULT ENGINE = MyISAM)
+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;
+i
+1
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY LIST (`i`)
+(PARTITION `p` VALUES IN (1,2,3,4) ENGINE = MyISAM)
+DROP TABLE t1;
diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result
index f05b145053d..349e9771367 100644
--- a/mysql-test/r/partition_error.result
+++ b/mysql-test/r/partition_error.result
@@ -71,7 +71,7 @@ ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitio
CREATE TABLE t1 (a DATE)
PARTITION BY RANGE (DAYOFWEEK(a))
(PARTITION a1 VALUES LESS THAN (60));
-INSERT INTO t1 VALUES ('test'),('a'),('5');
+INSERT IGNORE INTO t1 VALUES ('test'),('a'),('5');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'a' at row 2
@@ -85,7 +85,7 @@ DROP TABLE t1;
CREATE TABLE t1 (a DATETIME)
PARTITION BY RANGE (DAYOFWEEK(a))
(PARTITION a1 VALUES LESS THAN (60));
-INSERT INTO t1 VALUES ('test'),('a'),('5');
+INSERT IGNORE INTO t1 VALUES ('test'),('a'),('5');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'a' at row 2
@@ -781,9 +781,9 @@ t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`purchased` date DEFAULT NULL
) ENGINE=<curr_engine> DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (YEAR(purchased))
-SUBPARTITION BY HASH (TO_DAYS(purchased))
-(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = <curr_engine>) */
+ PARTITION BY RANGE (year(`purchased`))
+SUBPARTITION BY HASH (to_days(`purchased`))
+(PARTITION `p0` VALUES LESS THAN MAXVALUE ENGINE = <curr_engine>)
DROP TABLE t1;
CREATE TABLE t1 (id INT, purchased DATE)
PARTITION BY RANGE(YEAR(purchased))
@@ -802,11 +802,11 @@ t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`purchased` date DEFAULT NULL
) ENGINE=<curr_engine> DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (YEAR(purchased))
-SUBPARTITION BY HASH (TO_DAYS(purchased))
-(PARTITION p0 VALUES LESS THAN MAXVALUE
- (SUBPARTITION sp0 ENGINE = <curr_engine>,
- SUBPARTITION sp1 ENGINE = <curr_engine>)) */
+ PARTITION BY RANGE (year(`purchased`))
+SUBPARTITION BY HASH (to_days(`purchased`))
+(PARTITION `p0` VALUES LESS THAN MAXVALUE
+ (SUBPARTITION `sp0` ENGINE = <curr_engine>,
+ SUBPARTITION `sp1` ENGINE = <curr_engine>))
DROP TABLE t1;
CREATE TABLE t1 (id INT, purchased DATE)
PARTITION BY RANGE(YEAR(purchased))
@@ -822,8 +822,8 @@ t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`purchased` date DEFAULT NULL
) ENGINE=<curr_engine> DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (YEAR(purchased))
-(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = <curr_engine>) */
+ PARTITION BY RANGE (year(`purchased`))
+(PARTITION `p0` VALUES LESS THAN MAXVALUE ENGINE = <curr_engine>)
DROP TABLE t1;
SET @@sql_mode= @org_mode;
CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a));
@@ -1783,14 +1783,14 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST (a)
-SUBPARTITION BY HASH (a)
-(PARTITION p1 VALUES IN (1)
- (SUBPARTITION p1spFirst COMMENT = 'SubPartition comment in p1spFirst' ENGINE = MyISAM,
- SUBPARTITION p1spSecond COMMENT = 'SubPartition comment in p1spSecond' ENGINE = MyISAM),
- PARTITION p2 VALUES IN (2)
- (SUBPARTITION p2spFirst COMMENT = 'SubPartition comment in p2spFirst' ENGINE = MyISAM,
- SUBPARTITION p2spSecond COMMENT = 'SubPartition comment in p2spSecond' ENGINE = MyISAM)) */
+ PARTITION BY LIST (`a`)
+SUBPARTITION BY HASH (`a`)
+(PARTITION `p1` VALUES IN (1)
+ (SUBPARTITION `p1spFirst` COMMENT = 'SubPartition comment in p1spFirst' ENGINE = MyISAM,
+ SUBPARTITION `p1spSecond` COMMENT = 'SubPartition comment in p1spSecond' ENGINE = MyISAM),
+ PARTITION `p2` VALUES IN (2)
+ (SUBPARTITION `p2spFirst` COMMENT = 'SubPartition comment in p2spFirst' ENGINE = MyISAM,
+ SUBPARTITION `p2spSecond` COMMENT = 'SubPartition comment in p2spSecond' ENGINE = MyISAM))
SELECT PARTITION_NAME, SUBPARTITION_NAME, PARTITION_COMMENT FROM INFORMATION_SCHEMA.PARTITIONS
WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
PARTITION_NAME SUBPARTITION_NAME PARTITION_COMMENT
@@ -1813,14 +1813,14 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST (a)
-SUBPARTITION BY HASH (a)
-(PARTITION p1 VALUES IN (1)
- (SUBPARTITION p1spFirst COMMENT = 'SubPartition comment in p1spFirst' ENGINE = MyISAM,
- SUBPARTITION p1spSecond ENGINE = MyISAM),
- PARTITION p2 VALUES IN (2)
- (SUBPARTITION p2spFirst COMMENT = 'Comment in p2' ENGINE = MyISAM,
- SUBPARTITION p2spSecond COMMENT = 'SubPartition comment in p2spSecond' ENGINE = MyISAM)) */
+ PARTITION BY LIST (`a`)
+SUBPARTITION BY HASH (`a`)
+(PARTITION `p1` VALUES IN (1)
+ (SUBPARTITION `p1spFirst` COMMENT = 'SubPartition comment in p1spFirst' ENGINE = MyISAM,
+ SUBPARTITION `p1spSecond` ENGINE = MyISAM),
+ PARTITION `p2` VALUES IN (2)
+ (SUBPARTITION `p2spFirst` COMMENT = 'Comment in p2' ENGINE = MyISAM,
+ SUBPARTITION `p2spSecond` COMMENT = 'SubPartition comment in p2spSecond' ENGINE = MyISAM))
SELECT PARTITION_NAME, SUBPARTITION_NAME, PARTITION_COMMENT FROM INFORMATION_SCHEMA.PARTITIONS
WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
PARTITION_NAME SUBPARTITION_NAME PARTITION_COMMENT
@@ -1829,6 +1829,7 @@ p1 p1spSecond
p2 p2spFirst Comment in p2
p2 p2spSecond SubPartition comment in p2spSecond
DROP TABLE t1;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t1
(a INT ,
KEY inx_a (a) )
@@ -1849,14 +1850,14 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
KEY `inx_a` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a)
-(PARTITION pUpTo10 VALUES LESS THAN (10)
+ PARTITION BY RANGE (`a`)
+SUBPARTITION BY HASH (`a`)
+(PARTITION `pUpTo10` VALUES LESS THAN (10)
(SUBPARTITION `p-10sp0` COMMENT = 'This is a long comment (2050 ascii characters) 50 pUpTo10 partition ......80-!.................. 100 ................................................................................................ 200....................................................................................................................................................................................................................................................................................................... 500 ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 1000 ..............1024-|' ENGINE = MyISAM,
SUBPARTITION `p-10sp1` COMMENT = 'This is a long comment (2050 ascii characters) 50 pUpTo10 partition ......80-!.................. 100 ................................................................................................ 200....................................................................................................................................................................................................................................................................................................... 500 ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 1000 ..............1024-|' ENGINE = MyISAM),
- PARTITION pMax VALUES LESS THAN MAXVALUE
- (SUBPARTITION pMaxsp0 COMMENT = 'This is a long comment (2050 ascii characters) 50 pMax partition comment .80-!.................. 100 ................................................................................................ 200....................................................................................................................................................................................................................................................................................................... 500 ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 1000 ..............1024-|' ENGINE = MyISAM,
- SUBPARTITION pMaxsp1 COMMENT = 'This is a long comment (2050 ascii characters) 50 pMax partition comment .80-!.................. 100 ................................................................................................ 200....................................................................................................................................................................................................................................................................................................... 500 ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 1000 ..............1024-|' ENGINE = MyISAM)) */
+ PARTITION `pMax` VALUES LESS THAN MAXVALUE
+ (SUBPARTITION `pMaxsp0` COMMENT = 'This is a long comment (2050 ascii characters) 50 pMax partition comment .80-!.................. 100 ................................................................................................ 200....................................................................................................................................................................................................................................................................................................... 500 ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 1000 ..............1024-|' ENGINE = MyISAM,
+ SUBPARTITION `pMaxsp1` COMMENT = 'This is a long comment (2050 ascii characters) 50 pMax partition comment .80-!.................. 100 ................................................................................................ 200....................................................................................................................................................................................................................................................................................................... 500 ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 1000 ..............1024-|' ENGINE = MyISAM))
SELECT PARTITION_NAME, SUBPARTITION_NAME, PARTITION_COMMENT FROM INFORMATION_SCHEMA.PARTITIONS
WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
PARTITION_NAME SUBPARTITION_NAME PARTITION_COMMENT
diff --git a/mysql-test/r/partition_example.result b/mysql-test/r/partition_example.result
index 2129eea0818..3aa1ed639ca 100644
--- a/mysql-test/r/partition_example.result
+++ b/mysql-test/r/partition_example.result
@@ -8,9 +8,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST (a)
-(PARTITION p0 VALUES IN (1) ENGINE = EXAMPLE,
- PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE) */
+ PARTITION BY LIST (`a`)
+(PARTITION `p0` VALUES IN (1) ENGINE = EXAMPLE,
+ PARTITION `p1` VALUES IN (2) ENGINE = EXAMPLE)
drop table t1;
create table t1 (a int not null)
engine=example ull=12340
@@ -21,9 +21,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340
-/*!50100 PARTITION BY LIST (a)
-(PARTITION p0 VALUES IN (1) ENGINE = EXAMPLE,
- PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE) */
+ PARTITION BY LIST (`a`)
+(PARTITION `p0` VALUES IN (1) ENGINE = EXAMPLE,
+ PARTITION `p1` VALUES IN (2) ENGINE = EXAMPLE)
drop table t1;
select 1;
1
diff --git a/mysql-test/r/partition_exchange.result b/mysql-test/r/partition_exchange.result
index 0f6ac2cf480..f37ba183560 100644
--- a/mysql-test/r/partition_exchange.result
+++ b/mysql-test/r/partition_exchange.result
@@ -28,8 +28,8 @@ Create Table CREATE TABLE `t1` (
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
-/*!50100 PARTITION BY HASH (id)
-PARTITIONS 2 */
+ PARTITION BY HASH (`id`)
+PARTITIONS 2
SHOW CREATE TABLE t2;
Table t2
Create Table CREATE TABLE `t2` (
@@ -64,8 +64,8 @@ Create Table CREATE TABLE `t1` (
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
-/*!50100 PARTITION BY HASH (id)
-PARTITIONS 2 */
+ PARTITION BY HASH (`id`)
+PARTITIONS 2
SHOW CREATE TABLE t2;
Table t2
Create Table CREATE TABLE `t2` (
@@ -112,8 +112,8 @@ Create Table CREATE TABLE `t1` (
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
-/*!50100 PARTITION BY HASH (id)
-PARTITIONS 2 */
+ PARTITION BY HASH (`id`)
+PARTITIONS 2
SHOW CREATE TABLE t2;
Table t2
Create Table CREATE TABLE `t2` (
@@ -172,8 +172,8 @@ Create Table CREATE TABLE `t1` (
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY HASH (id)
-PARTITIONS 2 */
+ PARTITION BY HASH (`id`)
+PARTITIONS 2
SHOW CREATE TABLE t2;
Table t2
Create Table CREATE TABLE `t2` (
@@ -232,8 +232,8 @@ Create Table CREATE TABLE `t1` (
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY HASH (id)
-PARTITIONS 2 */
+ PARTITION BY HASH (`id`)
+PARTITIONS 2
SHOW CREATE TABLE t2;
Table t2
Create Table CREATE TABLE `t2` (
@@ -292,8 +292,8 @@ Create Table CREATE TABLE `t1` (
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
-/*!50100 PARTITION BY HASH (id)
-PARTITIONS 2 */
+ PARTITION BY HASH (`id`)
+PARTITIONS 2
SHOW CREATE TABLE t2;
Table t2
Create Table CREATE TABLE `t2` (
@@ -349,8 +349,8 @@ Create Table CREATE TABLE `t1` (
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY HASH (id)
-PARTITIONS 2 */
+ PARTITION BY HASH (`id`)
+PARTITIONS 2
SHOW CREATE TABLE t2;
Table t2
Create Table CREATE TABLE `t2` (
@@ -406,8 +406,8 @@ Create Table CREATE TABLE `t1` (
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
-/*!50100 PARTITION BY HASH (id)
-PARTITIONS 2 */
+ PARTITION BY HASH (`id`)
+PARTITIONS 2
SHOW CREATE TABLE t2;
Table t2
Create Table CREATE TABLE `t2` (
@@ -496,9 +496,9 @@ tp CREATE TABLE `tp` (
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
SELECT * FROM t;
a b
1 First value
@@ -534,9 +534,9 @@ tp CREATE TABLE `tp` (
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
SELECT * FROM t;
a b
10 Ten
@@ -594,9 +594,9 @@ tp CREATE TABLE `tp` (
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
SELECT * FROM t;
a b
1 First value
@@ -650,9 +650,9 @@ tp CREATE TABLE `tp` (
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
SHOW CREATE TABLE tsp;
Table Create Table
tsp CREATE TABLE `tsp` (
@@ -660,14 +660,14 @@ tsp CREATE TABLE `tsp` (
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a)
-(PARTITION p0 VALUES LESS THAN (100)
- (SUBPARTITION sp0 ENGINE = MyISAM,
- SUBPARTITION sp1 ENGINE = MyISAM),
- PARTITION p1 VALUES LESS THAN MAXVALUE
- (SUBPARTITION sp2 ENGINE = MyISAM,
- SUBPARTITION sp3 ENGINE = MyISAM)) */
+ PARTITION BY RANGE (`a`)
+SUBPARTITION BY HASH (`a`)
+(PARTITION `p0` VALUES LESS THAN (100)
+ (SUBPARTITION `sp0` ENGINE = MyISAM,
+ SUBPARTITION `sp1` ENGINE = MyISAM),
+ PARTITION `p1` VALUES LESS THAN MAXVALUE
+ (SUBPARTITION `sp2` ENGINE = MyISAM,
+ SUBPARTITION `sp3` ENGINE = MyISAM))
SELECT * FROM t;
a b
1 First value
@@ -704,9 +704,9 @@ tp CREATE TABLE `tp` (
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
SELECT * FROM t;
a b
10 Ten
@@ -742,9 +742,9 @@ tp CREATE TABLE `tp` (
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
SELECT * FROM t;
a b
1 First value
@@ -781,14 +781,14 @@ tsp CREATE TABLE `tsp` (
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a)
-(PARTITION p0 VALUES LESS THAN (100)
- (SUBPARTITION sp0 ENGINE = MyISAM,
- SUBPARTITION sp1 ENGINE = MyISAM),
- PARTITION p1 VALUES LESS THAN MAXVALUE
- (SUBPARTITION sp2 ENGINE = MyISAM,
- SUBPARTITION sp3 ENGINE = MyISAM)) */
+ PARTITION BY RANGE (`a`)
+SUBPARTITION BY HASH (`a`)
+(PARTITION `p0` VALUES LESS THAN (100)
+ (SUBPARTITION `sp0` ENGINE = MyISAM,
+ SUBPARTITION `sp1` ENGINE = MyISAM),
+ PARTITION `p1` VALUES LESS THAN MAXVALUE
+ (SUBPARTITION `sp2` ENGINE = MyISAM,
+ SUBPARTITION `sp3` ENGINE = MyISAM))
SELECT * FROM t;
a b
61 Sixty one
@@ -826,9 +826,9 @@ tp CREATE TABLE `tp` (
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
- PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (100) ENGINE = InnoDB,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
SELECT * FROM t;
a b
1 First value
@@ -864,9 +864,9 @@ tp CREATE TABLE `tp` (
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
- PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (100) ENGINE = InnoDB,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
SELECT * FROM t;
a b
10 Ten
@@ -905,9 +905,9 @@ tp CREATE TABLE `tp` (
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
- PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (100) ENGINE = InnoDB,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MariaDB
SHOW CREATE TABLE t;
@@ -924,9 +924,9 @@ tp CREATE TABLE `tp` (
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
- PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (100) ENGINE = InnoDB,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
# Test different charsets
ALTER TABLE t ENGINE = MyISAM;
CREATE TABLE tmp LIKE t;
@@ -957,9 +957,9 @@ tp CREATE TABLE `tp` (
`b` varchar(55) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
ERROR HY000: Non matching attribute 'MAX_ROWS' between partition and table
SHOW WARNINGS;
@@ -988,9 +988,9 @@ tp CREATE TABLE `tp` (
PRIMARY KEY (`a`),
KEY `ba_key` (`b`,`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
SELECT * FROM t;
a b
10 Ten
@@ -1047,9 +1047,9 @@ tp CREATE TABLE `tp` (
PRIMARY KEY (`a`),
KEY `ba_key` (`b`,`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
ERROR HY000: Table to exchange with partition is temporary: 't'
SHOW CREATE TABLE t;
@@ -1068,9 +1068,9 @@ tp CREATE TABLE `tp` (
PRIMARY KEY (`a`),
KEY `ba_key` (`b`,`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (100) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
DROP TEMPORARY TABLE t;
ALTER TABLE tmp2 RENAME TO t;
# Test non partitioned table
diff --git a/mysql-test/r/partition_explicit_prune.result b/mysql-test/r/partition_explicit_prune.result
index 3ca1e688e8f..a29f1aa7a8a 100644
--- a/mysql-test/r/partition_explicit_prune.result
+++ b/mysql-test/r/partition_explicit_prune.result
@@ -126,7 +126,7 @@ HANDLER_WRITE 2
# 4 locks (1 table, 1 partition lock/unlock)
FLUSH STATUS;
INSERT INTO v1 VALUES (31);
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
@@ -135,7 +135,7 @@ HANDLER_TMP_WRITE 23
# 2 locks (1 table, all partitions pruned)
FLUSH STATUS;
INSERT INTO v1 VALUES (32);
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
@@ -202,20 +202,20 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a`),
KEY `b` (`b`,`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a)
-(PARTITION pNeg VALUES LESS THAN (0)
- (SUBPARTITION subp0 ENGINE = InnoDB,
- SUBPARTITION subp1 ENGINE = InnoDB),
+ PARTITION BY RANGE (`a`)
+SUBPARTITION BY HASH (`a`)
+(PARTITION `pNeg` VALUES LESS THAN (0)
+ (SUBPARTITION `subp0` ENGINE = InnoDB,
+ SUBPARTITION `subp1` ENGINE = InnoDB),
PARTITION `p0-9` VALUES LESS THAN (10)
- (SUBPARTITION subp2 ENGINE = InnoDB,
- SUBPARTITION subp3 ENGINE = InnoDB),
+ (SUBPARTITION `subp2` ENGINE = InnoDB,
+ SUBPARTITION `subp3` ENGINE = InnoDB),
PARTITION `p10-99` VALUES LESS THAN (100)
- (SUBPARTITION subp4 ENGINE = InnoDB,
- SUBPARTITION subp5 ENGINE = InnoDB),
+ (SUBPARTITION `subp4` ENGINE = InnoDB,
+ SUBPARTITION `subp5` ENGINE = InnoDB),
PARTITION `p100-99999` VALUES LESS THAN (100000)
- (SUBPARTITION subp6 ENGINE = InnoDB,
- SUBPARTITION subp7 ENGINE = InnoDB)) */
+ (SUBPARTITION `subp6` ENGINE = InnoDB,
+ SUBPARTITION `subp7` ENGINE = InnoDB))
# First test that the syntax is OK
SHOW CREATE TABLE t1 PARTITION (subp0);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PARTITION (subp0)' at line 1
@@ -1125,20 +1125,20 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a`),
KEY `b` (`b`,`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a)
-(PARTITION pNeg VALUES LESS THAN (0)
- (SUBPARTITION subp0 ENGINE = InnoDB,
- SUBPARTITION subp1 ENGINE = InnoDB),
+ PARTITION BY RANGE (`a`)
+SUBPARTITION BY HASH (`a`)
+(PARTITION `pNeg` VALUES LESS THAN (0)
+ (SUBPARTITION `subp0` ENGINE = InnoDB,
+ SUBPARTITION `subp1` ENGINE = InnoDB),
PARTITION `p0-9` VALUES LESS THAN (10)
- (SUBPARTITION subp2 ENGINE = InnoDB,
- SUBPARTITION subp3 ENGINE = InnoDB),
+ (SUBPARTITION `subp2` ENGINE = InnoDB,
+ SUBPARTITION `subp3` ENGINE = InnoDB),
PARTITION `p10-99` VALUES LESS THAN (100)
- (SUBPARTITION subp4 ENGINE = InnoDB,
- SUBPARTITION subp5 ENGINE = InnoDB),
+ (SUBPARTITION `subp4` ENGINE = InnoDB,
+ SUBPARTITION `subp5` ENGINE = InnoDB),
PARTITION `p100-99999` VALUES LESS THAN (100000)
- (SUBPARTITION subp6 ENGINE = InnoDB,
- SUBPARTITION subp7 ENGINE = InnoDB)) */
+ (SUBPARTITION `subp6` ENGINE = InnoDB,
+ SUBPARTITION `subp7` ENGINE = InnoDB))
SELECT * FROM t1;
a b
-4 (pNeg-)subp0, Updated, Updated2, Updated from a = -2
@@ -1157,20 +1157,20 @@ t2 CREATE TABLE `t2` (
PRIMARY KEY (`a`),
KEY `b` (`b`,`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a)
-(PARTITION pNeg VALUES LESS THAN (0)
- (SUBPARTITION subp0 ENGINE = InnoDB,
- SUBPARTITION subp1 ENGINE = InnoDB),
+ PARTITION BY RANGE (`a`)
+SUBPARTITION BY HASH (`a`)
+(PARTITION `pNeg` VALUES LESS THAN (0)
+ (SUBPARTITION `subp0` ENGINE = InnoDB,
+ SUBPARTITION `subp1` ENGINE = InnoDB),
PARTITION `p0-9` VALUES LESS THAN (10)
- (SUBPARTITION subp2 ENGINE = InnoDB,
- SUBPARTITION subp3 ENGINE = InnoDB),
+ (SUBPARTITION `subp2` ENGINE = InnoDB,
+ SUBPARTITION `subp3` ENGINE = InnoDB),
PARTITION `p10-99` VALUES LESS THAN (100)
- (SUBPARTITION subp4 ENGINE = InnoDB,
- SUBPARTITION subp5 ENGINE = InnoDB),
+ (SUBPARTITION `subp4` ENGINE = InnoDB,
+ SUBPARTITION `subp5` ENGINE = InnoDB),
PARTITION `p100-99999` VALUES LESS THAN (100000)
- (SUBPARTITION subp6 ENGINE = InnoDB,
- SUBPARTITION subp7 ENGINE = InnoDB)) */
+ (SUBPARTITION `subp6` ENGINE = InnoDB,
+ SUBPARTITION `subp7` ENGINE = InnoDB))
SELECT * FROM t2;
a b
10 p10-99
@@ -1657,28 +1657,28 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a`),
KEY `b` (`b`,`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a)
-(PARTITION pNeg VALUES LESS THAN (0)
- (SUBPARTITION subp0 ENGINE = InnoDB,
- SUBPARTITION subp1 ENGINE = InnoDB,
- SUBPARTITION subp2 ENGINE = InnoDB),
+ PARTITION BY RANGE (`a`)
+SUBPARTITION BY HASH (`a`)
+(PARTITION `pNeg` VALUES LESS THAN (0)
+ (SUBPARTITION `subp0` ENGINE = InnoDB,
+ SUBPARTITION `subp1` ENGINE = InnoDB,
+ SUBPARTITION `subp2` ENGINE = InnoDB),
PARTITION `p0-29` VALUES LESS THAN (30)
- (SUBPARTITION subp3 ENGINE = InnoDB,
- SUBPARTITION subp4 ENGINE = InnoDB,
- SUBPARTITION subp5 ENGINE = InnoDB),
+ (SUBPARTITION `subp3` ENGINE = InnoDB,
+ SUBPARTITION `subp4` ENGINE = InnoDB,
+ SUBPARTITION `subp5` ENGINE = InnoDB),
PARTITION `p30-299` VALUES LESS THAN (300)
- (SUBPARTITION subp6 ENGINE = InnoDB,
- SUBPARTITION subp7 ENGINE = InnoDB,
- SUBPARTITION subp8 ENGINE = InnoDB),
+ (SUBPARTITION `subp6` ENGINE = InnoDB,
+ SUBPARTITION `subp7` ENGINE = InnoDB,
+ SUBPARTITION `subp8` ENGINE = InnoDB),
PARTITION `p300-2999` VALUES LESS THAN (3000)
- (SUBPARTITION subp9 ENGINE = InnoDB,
- SUBPARTITION subp10 ENGINE = InnoDB,
- SUBPARTITION subp11 ENGINE = InnoDB),
+ (SUBPARTITION `subp9` ENGINE = InnoDB,
+ SUBPARTITION `subp10` ENGINE = InnoDB,
+ SUBPARTITION `subp11` ENGINE = InnoDB),
PARTITION `p3000-299999` VALUES LESS THAN (300000)
- (SUBPARTITION subp12 ENGINE = InnoDB,
- SUBPARTITION subp13 ENGINE = InnoDB,
- SUBPARTITION subp14 ENGINE = InnoDB)) */
+ (SUBPARTITION `subp12` ENGINE = InnoDB,
+ SUBPARTITION `subp13` ENGINE = InnoDB,
+ SUBPARTITION `subp14` ENGINE = InnoDB))
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");
diff --git a/mysql-test/r/partition_grant.result b/mysql-test/r/partition_grant.result
index f036b0bcc28..cd8f8a970d0 100644
--- a/mysql-test/r/partition_grant.result
+++ b/mysql-test/r/partition_grant.result
@@ -7,6 +7,7 @@ create user mysqltest_1@localhost;
grant usage on *.* to mysqltest_1@localhost;
revoke all privileges on *.* from mysqltest_1@localhost;
grant select,alter on mysqltest_1.* to mysqltest_1@localhost;
+connect conn1,localhost,mysqltest_1,,mysqltest_1;
show grants for current_user;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
@@ -14,21 +15,36 @@ GRANT SELECT, ALTER ON `mysqltest_1`.* TO 'mysqltest_1'@'localhost'
alter table t1 add b int;
alter table t1 drop partition p2;
ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1'
+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;
alter table t1 drop partition p3;
ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1'
+disconnect conn3;
+connection default;
revoke select,alter,drop on mysqltest_1.* from mysqltest_1@localhost;
drop table t1;
create table t1 (s1 int);
insert into t1 values (1);
grant alter on mysqltest_1.* to mysqltest_1@localhost;
+connect conn4,localhost,mysqltest_1,,mysqltest_1;
+connection conn4;
alter table t1 partition by list (s1) (partition p1 values in (2));
ERROR HY000: Table has no partition for some existing values
+connection default;
grant select, alter on mysqltest_1.* to mysqltest_1@localhost;
+disconnect conn4;
+connect conn5,localhost,mysqltest_1,,mysqltest_1;
alter table t1 partition by list (s1) (partition p1 values in (2));
ERROR HY000: Table has no partition for value 1
+disconnect conn5;
+connection default;
drop table t1;
drop user mysqltest_1@localhost;
drop schema mysqltest_1;
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index b322d63a7e1..942455f23ed 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -1,3 +1,4 @@
+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';
drop table if exists t1, t2;
@@ -89,19 +90,23 @@ BEGIN;
SELECT COUNT(*) FROM t1;
COUNT(*)
5
-# con1
+connect con1,localhost,root,,;
# SEND a ALTER PARTITION which waits on the ongoing transaction.
ALTER TABLE t1
REORGANIZE PARTITION hour_003, hour_004 INTO
(PARTITION oldest VALUES LESS THAN (4));
# Connection default wait until the ALTER is in 'waiting for table...'
# state and then continue the transaction by trying a SELECT
+connection default;
SELECT COUNT(*) FROM t1;
COUNT(*)
5
COMMIT;
-# con1, reaping ALTER.
-# Disconnecting con1 and switching to default. Cleaning up.
+# reaping ALTER.
+connection con1;
+# 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;
@@ -145,7 +150,7 @@ UPDATE t1 SET name = 'Mattias' WHERE id = 7;
SELECT * FROM t1 WHERE id = 7;
id name myDate
7 Mattias 2009-09-16
-# Connection con1
+connect con1, localhost, root,,;
SET lock_wait_timeout = 1;
# After the patch it will wait and fail on timeout.
ALTER TABLE t1 DROP PARTITION p3;
@@ -153,7 +158,8 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SHOW WARNINGS;
Level Code Message
Error 1205 Lock wait timeout exceeded; try restarting transaction
-# Connection default
+disconnect con1;
+connection default;
SELECT * FROM t1;
id name myDate
1 Lachlan 2009-09-13
@@ -380,33 +386,33 @@ DROP TABLE t1;
create table t1 (a int) engine=innodb partition by hash(a) ;
show table status like 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 InnoDB 10 Compact 2 8192 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Dynamic 2 8192 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned
drop table t1;
create table t1 (a int)
engine = innodb
partition by key (a);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 InnoDB 10 Compact 2 8192 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Dynamic 2 8192 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned
insert into t1 values (0), (1), (2), (3);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 InnoDB 10 Compact 4 4096 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Dynamic 4 4096 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned
drop table t1;
create table t1 (a int auto_increment primary key)
engine = innodb
partition by key (a);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 InnoDB 10 Compact 2 8192 16384 0 0 # 1 # NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Dynamic 2 8192 16384 0 0 # 1 # NULL NULL latin1_swedish_ci NULL partitioned
insert into t1 values (NULL), (NULL), (NULL), (NULL);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 InnoDB 10 Compact 4 4096 16384 0 0 # 5 # NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Dynamic 4 4096 16384 0 0 # 5 # NULL NULL latin1_swedish_ci NULL partitioned
insert into t1 values (NULL), (NULL), (NULL), (NULL);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 InnoDB 10 Compact 8 2048 16384 0 0 # 9 # NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Dynamic 8 2048 16384 0 0 # 9 # NULL NULL latin1_swedish_ci NULL partitioned
drop table t1;
create table t1 (a int)
partition by key (a)
@@ -441,7 +447,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a) */
+ PARTITION BY KEY (`a`)
drop table t1;
create table t1 (a int)
engine = innodb
@@ -455,8 +461,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST (a)
-(PARTITION p0 VALUES IN (0) ENGINE = InnoDB) */
+ PARTITION BY LIST (`a`)
+(PARTITION `p0` VALUES IN (0) ENGINE = InnoDB)
drop table t1;
SET SQL_MODE=default;
create table t1
@@ -534,10 +540,10 @@ t1 CREATE TABLE `t1` (
`int_column` int(11) DEFAULT NULL,
`char_column` char(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (int_column)
-SUBPARTITION BY KEY (char_column)
+ PARTITION BY RANGE (`int_column`)
+SUBPARTITION BY KEY (`char_column`)
SUBPARTITIONS 2
-(PARTITION p1 VALUES LESS THAN (5) ENGINE = MyISAM) */
+(PARTITION `p1` VALUES LESS THAN (5) ENGINE = MyISAM)
drop table t1;
CREATE TABLE t1 (a INT) ENGINE=InnoDB
PARTITION BY list(a) (PARTITION p1 VALUES IN (1));
@@ -582,8 +588,8 @@ t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a)
-PARTITIONS 2 */
+ PARTITION BY KEY (`a`)
+PARTITIONS 2
SELECT * FROM t1;
a b
1 2
@@ -611,7 +617,7 @@ c INT,
PRIMARY KEY (c,a), KEY (a),KEY (a)
) ENGINE=INNODB PARTITION BY KEY () PARTITIONS 2;
Warnings:
-Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release
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;
@@ -869,13 +875,14 @@ PRIMARY KEY (a))
ENGINE = InnoDB
PARTITION BY HASH (a) PARTITIONS 3;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
-# con1
+connect con1, localhost, root,,;
ALTER TABLE t1 ADD INDEX idx1 (b);
-# con default
+connection default;
SELECT b FROM t1 WHERE b = 0;
ERROR HY000: Table definition has changed, please retry transaction
SELECT b FROM t1 WHERE b = 0;
ERROR HY000: Table definition has changed, please retry transaction
+disconnect con1;
DROP TABLE t1;
# Same test without partitioning
CREATE TABLE t1
@@ -884,11 +891,39 @@ b INT,
PRIMARY KEY (a))
ENGINE = InnoDB;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
-# con1
+connect con1, localhost, root,,;
ALTER TABLE t1 ADD INDEX idx1 (b);
-# con default
+connection default;
SELECT b FROM t1 WHERE b = 0;
ERROR HY000: Table definition has changed, please retry transaction
SELECT b FROM t1 WHERE b = 0;
ERROR HY000: Table definition has changed, please retry transaction
+disconnect con1;
DROP TABLE t1;
+#
+# Bug#26390658 RENAMING A PARTITIONED TABLE DOES NOT UPDATE
+# MYSQL.INNODB_TABLE_STATS
+#
+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);
+SELECT database_name, table_name FROM mysql.innodb_table_stats WHERE
+database_name = 'test_jfg';
+database_name table_name
+test_jfg test_jfg1
+test_jfg test_jfg2#P#p1000
+test_jfg test_jfg2#P#pmax
+RENAME TABLE test_jfg.test_jfg1 TO test_jfg.test_jfg11;
+RENAME TABLE test_jfg.test_jfg2 TO test_jfg.test_jfg12;
+SELECT database_name, table_name FROM mysql.innodb_table_stats WHERE
+database_name = 'test_jfg';
+database_name table_name
+test_jfg test_jfg11
+test_jfg test_jfg12#P#p1000
+test_jfg test_jfg12#P#pmax
+DROP DATABASE test_jfg;
diff --git a/mysql-test/r/partition_innodb_plugin.result b/mysql-test/r/partition_innodb_plugin.result
index 63c9da69955..6842ff04caa 100644
--- a/mysql-test/r/partition_innodb_plugin.result
+++ b/mysql-test/r/partition_innodb_plugin.result
@@ -1,3 +1,5 @@
+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");
#
# Bug#11766879/Bug#60106: DIFF BETWEEN # OF INDEXES IN MYSQL VS INNODB,
# PARTITONING, ON INDEX CREATE
@@ -28,21 +30,19 @@ t1 CREATE TABLE `t1` (
`id2` bigint(20) NOT NULL,
PRIMARY KEY (`id`,`time`)
) ENGINE=InnoDB AUTO_INCREMENT=4 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) */
+ PARTITION BY RANGE (to_days(`time`))
+(PARTITION `p10` VALUES LESS THAN (734708) ENGINE = InnoDB,
+ PARTITION `p20` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
DROP TABLE t1;
call mtr.add_suppression("InnoDB: Error: table `test`.`t1` .* InnoDB internal");
#
# Bug#55091: Server crashes on ADD PARTITION after a failed attempt
#
-SET @old_innodb_file_format = @@global.innodb_file_format;
SET @old_innodb_file_per_table = @@global.innodb_file_per_table;
SET @old_innodb_strict_mode = @@global.innodb_strict_mode;
-SET @@global.innodb_file_format = Barracuda,
-@@global.innodb_file_per_table = ON,
+SET @@global.innodb_file_per_table = ON,
@@global.innodb_strict_mode = ON;
-# Connection con1
+connect con1,localhost,root,,;
CREATE TABLE t1 (id INT NOT NULL
PRIMARY KEY,
user_num CHAR(10)
@@ -59,10 +59,11 @@ t1 CREATE TABLE `t1` (
`user_num` char(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4
-/*!50100 PARTITION BY HASH (id)
-PARTITIONS 1 */
+ PARTITION BY HASH (`id`)
+PARTITIONS 1
SET GLOBAL innodb_file_per_table = OFF;
-# Connection con2
+disconnect con1;
+connect con2,localhost,root,,;
LOCK TABLE t1 WRITE;
# ALTER fails because COMPRESSED/KEY_BLOCK_SIZE
# are incompatible with innodb_file_per_table = OFF;
@@ -96,12 +97,12 @@ t1 CREATE TABLE `t1` (
`user_num` char(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4
-/*!50100 PARTITION BY HASH (id)
-PARTITIONS 3 */
+ PARTITION BY HASH (`id`)
+PARTITIONS 3
DROP TABLE t1;
-# Connection default
+disconnect con2;
+connection default;
SET @@global.innodb_strict_mode = @old_innodb_strict_mode;
-SET @@global.innodb_file_format = @old_innodb_file_format;
SET @@global.innodb_file_per_table = @old_innodb_file_per_table;
SET NAMES utf8;
CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a))
@@ -116,15 +117,15 @@ PARTITION `p1``\""e` VALUES LESS THAN (MAXVALUE)
SUBPARTITION `sp3``\""e`));
INSERT INTO `t``\""e` VALUES (0), (2), (6), (10), (14), (18), (22);
START TRANSACTION;
-# con1
+connect con1,localhost,root,,;
SET NAMES utf8;
START TRANSACTION;
-# default connection
+connection default;
UPDATE `t``\""e` SET a = 16 WHERE a = 0;
-# con1
+connection con1;
UPDATE `t``\""e` SET a = 8 WHERE a = 22;
UPDATE `t``\""e` SET a = 12 WHERE a = 0;
-# default connection
+connection default;
SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
GROUP BY lock_table;
lock_table COUNT(*)
@@ -141,15 +142,15 @@ ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
# First table reported in 'SHOW ENGINE InnoDB STATUS'
SHOW ENGINE InnoDB STATUS;
Type Name Status
-InnoDB index `PRIMARY` of table `test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */
+InnoDB index PRIMARY of table `test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */
set @old_sql_mode = @@sql_mode;
set sql_mode = 'ANSI_QUOTES';
SHOW ENGINE InnoDB STATUS;
Type Name Status
-InnoDB index `PRIMARY` of table `test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */
+InnoDB index PRIMARY of table `test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */
set @@sql_mode = @old_sql_mode;
-# con1
+connection con1;
ROLLBACK;
-# default connection
+disconnect con1;
+connection default;
DROP TABLE `t``\""e`;
-SET NAMES DEFAULT;
diff --git a/mysql-test/r/partition_innodb_semi_consistent.result b/mysql-test/r/partition_innodb_semi_consistent.result
index 11621a1ebd9..208bd0214f7 100644
--- a/mysql-test/r/partition_innodb_semi_consistent.result
+++ b/mysql-test/r/partition_innodb_semi_consistent.result
@@ -1,4 +1,7 @@
drop table if exists t1;
+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)
@@ -12,28 +15,36 @@ set autocommit=0;
select * from t1 where a=3 lock in share mode;
a
3
+connection b;
set binlog_format=mixed;
set session transaction isolation level repeatable read;
set autocommit=0;
update t1 set a=10 where a=5;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
commit;
+connection a;
commit;
+connection b;
set session transaction isolation level read committed;
update t1 set a=10 where a=5;
+connection a;
select * from t1 where a=2 for update;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t1 where a=2 limit 1 for update;
a
2
+connection b;
update t1 set a=11 where a=6;
update t1 set a=12 where a=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t1 set a=13 where a=1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection a;
commit;
+connection b;
update t1 set a=14 where a=1;
commit;
+connection a;
select * from t1;
a
10
@@ -44,10 +55,15 @@ a
4
7
drop table t1;
+connection default;
+disconnect a;
+disconnect b;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
SET SESSION AUTOCOMMIT = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
set binlog_format=mixed;
-# Switch to connection con1
+connection con1;
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256))
ENGINE = InnoDB
PARTITION BY RANGE (a)
@@ -62,11 +78,11 @@ info: Rows matched: 1 Changed: 1 Warnings: 0
SELECT * FROM t1;
a b
1 12
-# Switch to connection con2
+connection con2;
UPDATE t1 SET b = 21 WHERE a = 1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
ROLLBACK;
-# Switch to connection con1
+connection con1;
SELECT * FROM t1;
a b
1 12
@@ -97,9 +113,9 @@ info: Rows matched: 1 Changed: 1 Warnings: 0
SELECT * FROM t1;
a b
1 init+con1
-# Switch to connection con2
+connection con2;
CALL p1;;
-# Switch to connection con1
+connection con1;
SELECT * FROM t1;
a b
1 init+con1
@@ -107,12 +123,12 @@ COMMIT;
SELECT * FROM t1;
a b
1 init+con1
-# Switch to connection con2
+connection con2;
SELECT * FROM t1;
a b
1 init+con1+con2
COMMIT;
-# Switch to connection con1
+connection con1;
# 3. test for updated key column:
TRUNCATE t1;
DELETE FROM t2;
@@ -124,9 +140,9 @@ info: Rows matched: 1 Changed: 1 Warnings: 0
SELECT * FROM t1;
a b
2 init+con1
-# Switch to connection con2
+connection con2;
CALL p1;;
-# Switch to connection con1
+connection con1;
SELECT * FROM t1;
a b
2 init+con1
@@ -134,9 +150,12 @@ COMMIT;
SELECT * FROM t1;
a b
2 init+con1
-# Switch to connection con2
+connection con2;
SELECT * FROM t1;
a b
2 init+con1
+connection default;
+disconnect con1;
+disconnect con2;
DROP PROCEDURE p1;
DROP TABLE t1, t2;
diff --git a/mysql-test/r/partition_innodb_stmt.result b/mysql-test/r/partition_innodb_stmt.result
index 22a9f28708c..543d4734216 100644
--- a/mysql-test/r/partition_innodb_stmt.result
+++ b/mysql-test/r/partition_innodb_stmt.result
@@ -1,4 +1,3 @@
-# connection default
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
CREATE TABLE t1
(
@@ -21,12 +20,13 @@ id
1
2
3
-#connection con1
+connect con1, localhost, root,,;
+connection con1;
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
INSERT INTO t1 VALUES(7);
COMMIT;
-# connection default
+connection default;
COMMIT;
FLUSH TABLES;
# Test REPEATABLE READ -> READ COMMITTED
@@ -38,11 +38,13 @@ id
2
3
7
-# connection con1
+connection con1;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
INSERT INTO t1 VALUES(9);
ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
COMMIT;
+disconnect con1;
+connection default;
COMMIT;
DROP TABLE t1;
diff --git a/mysql-test/r/partition_list.result b/mysql-test/r/partition_list.result
index e22fc11e5bb..91c1c106cea 100644
--- a/mysql-test/r/partition_list.result
+++ b/mysql-test/r/partition_list.result
@@ -57,14 +57,14 @@ partition p3 values in (3));
select partition_method, partition_expression, partition_description
from information_schema.partitions where table_name = "t1";
partition_method partition_expression partition_description
-LIST a 0
-LIST a 0
-LIST a 1
-LIST a 1
-LIST a NULL,2
-LIST a NULL,2
-LIST a 3
-LIST a 3
+LIST `a` 0
+LIST `a` 0
+LIST `a` 1
+LIST `a` 1
+LIST `a` NULL,2
+LIST `a` NULL,2
+LIST `a` 3
+LIST `a` 3
insert into t1 values (0,0),(0,1),(1,0),(1,1),(null,0),(null,1);
insert into t1 values (2,0),(2,1),(3,0),(3,1);
explain partitions select * from t1 where a is null;
@@ -310,3 +310,27 @@ create table t1 (a char(1))
partition by list (ascii(ucase(a)))
(partition p1 values in (2));
ERROR HY000: This partition function is not allowed
+#
+# MDEV-11681: PARTITION BY LIST COLUMNS with default partition:
+# Assertion `part_info->num_list_values' failed in
+# get_part_iter_for_interval_cols_via_map
+#
+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;
+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 ;
+f d
+1 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;
+f
+1
+drop table t1;
+#end of 10.2 tests
diff --git a/mysql-test/r/partition_mgm.result b/mysql-test/r/partition_mgm.result
index 2ff6e3f1923..37733a4e764 100644
--- a/mysql-test/r/partition_mgm.result
+++ b/mysql-test/r/partition_mgm.result
@@ -24,8 +24,8 @@ t1 CREATE TABLE `t1` (
`f_date` date DEFAULT NULL,
`f_varchar` varchar(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY HASH (YEAR(f_date))
-PARTITIONS 2 */
+ PARTITION BY HASH (year(`f_date`))
+PARTITIONS 2
ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
@@ -33,8 +33,8 @@ t1 CREATE TABLE `t1` (
`f_date` date DEFAULT NULL,
`f_varchar` varchar(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY HASH (YEAR(f_date))
-PARTITIONS 1 */
+ PARTITION BY HASH (year(`f_date`))
+PARTITIONS 1
drop table t1;
create table t1 (a int)
partition by list (a)
@@ -58,8 +58,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY HASH (a)
-PARTITIONS 5 */
+ PARTITION BY HASH (`a`)
+PARTITIONS 5
DROP TABLE t1;
CREATE TABLE t1 (a INT)
/*!50100 PARTITION BY HASH (a)
@@ -70,8 +70,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY HASH (a)
-PARTITIONS 5 */
+ PARTITION BY HASH (`a`)
+PARTITIONS 5
DROP TABLE t1;
CREATE TABLE t1 (a INT)
/*!50100 PARTITION BY HASH (a)
@@ -81,8 +81,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY HASH (a)
-PARTITIONS 5 */
+ PARTITION BY HASH (`a`)
+PARTITIONS 5
DROP TABLE t1;
CREATE TABLE t1 (a INT) /*!50100 PARTITION BY HASH (a) PARTITIONS 5 */;
SHOW CREATE TABLE t1;
@@ -90,6 +90,6 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY HASH (a)
-PARTITIONS 5 */
+ PARTITION BY HASH (`a`)
+PARTITIONS 5
DROP TABLE t1;
diff --git a/mysql-test/r/partition_mgm_err.result b/mysql-test/r/partition_mgm_err.result
index cbf45a2b7be..e3c4bbf2af7 100644
--- a/mysql-test/r/partition_mgm_err.result
+++ b/mysql-test/r/partition_mgm_err.result
@@ -145,8 +145,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a)
-PARTITIONS 2 */
+ PARTITION BY KEY (`a`)
+PARTITIONS 2
DROP TABLE t1;
CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
ALTER TABLE t1 ADD PARTITION PARTITIONS 4;
diff --git a/mysql-test/r/partition_myisam.result b/mysql-test/r/partition_myisam.result
index 08a5bf72f64..8f35075261a 100644
--- a/mysql-test/r/partition_myisam.result
+++ b/mysql-test/r/partition_myisam.result
@@ -27,10 +27,10 @@ Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 CHECKSUM=1
-/*!50100 PARTITION BY RANGE (i)
-(PARTITION p3 VALUES LESS THAN (3) ENGINE = MyISAM,
- PARTITION p5 VALUES LESS THAN (5) ENGINE = MyISAM,
- PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+ PARTITION BY RANGE (`i`)
+(PARTITION `p3` VALUES LESS THAN (3) ENGINE = MyISAM,
+ PARTITION `p5` VALUES LESS THAN (5) ENGINE = MyISAM,
+ PARTITION `pMax` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
DROP TABLE t1;
# Same test without partitioning
CREATE TABLE t1 (
@@ -131,7 +131,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`a`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a) */
+ PARTITION BY KEY (`a`)
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1;
a
diff --git a/mysql-test/r/partition_not_windows.result b/mysql-test/r/partition_not_windows.result
index a1da9af675b..03282ac134a 100644
--- a/mysql-test/r/partition_not_windows.result
+++ b/mysql-test/r/partition_not_windows.result
@@ -31,8 +31,8 @@ Table Create Table
t2 CREATE TABLE `t2` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (i)
-(PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) */
+ PARTITION BY RANGE (`i`)
+(PARTITION `p01` VALUES LESS THAN (1000) ENGINE = MyISAM)
DROP TABLE t1, t2;
set @@sql_mode=@org_mode;
CREATE TABLE t1(a INT)
diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result
index fe19473f8e4..0fb24b74218 100644
--- a/mysql-test/r/partition_pruning.result
+++ b/mysql-test/r/partition_pruning.result
@@ -2872,7 +2872,7 @@ explain extended select * from t2 where b = 6;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref b b 5 const 96 100.00
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = 6)
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = 6
explain partitions select * from t2 where b = 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 96
@@ -2880,7 +2880,7 @@ explain extended select * from t2 where b in (1,3,5);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL b NULL NULL NULL 910 51.65 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` in (1,3,5))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (1,3,5)
explain partitions select * from t2 where b in (1,3,5);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
@@ -2888,7 +2888,7 @@ explain extended select * from t2 where b in (2,4,6);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL b NULL NULL NULL 910 31.65 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` in (2,4,6))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (2,4,6)
explain partitions select * from t2 where b in (2,4,6);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
@@ -2896,7 +2896,7 @@ explain extended select * from t2 where b in (7,8,9);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL b NULL NULL NULL 910 19.12 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` in (7,8,9))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (7,8,9)
explain partitions select * from t2 where b in (7,8,9);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
@@ -2904,7 +2904,7 @@ explain extended select * from t2 where b > 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL b NULL NULL NULL 910 29.23 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` > 5)
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5
explain partitions select * from t2 where b > 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
@@ -2912,7 +2912,7 @@ explain extended select * from t2 where b > 5 and b < 8;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL b NULL NULL NULL 910 28.13 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where ((`test`.`t2`.`b` > 5) and (`test`.`t2`.`b` < 8))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 and `test`.`t2`.`b` < 8
explain partitions select * from t2 where b > 5 and b < 8;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
@@ -2920,7 +2920,7 @@ explain extended select * from t2 where b > 5 and b < 7;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range b b 5 NULL 96 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where ((`test`.`t2`.`b` > 5) and (`test`.`t2`.`b` < 7))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 and `test`.`t2`.`b` < 7
explain partitions select * from t2 where b > 5 and b < 7;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1,p2,p3,p4 range b b 5 NULL 96 Using where
@@ -2928,7 +2928,7 @@ explain extended select * from t2 where b > 0 and b < 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL b NULL NULL NULL 910 53.19 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where ((`test`.`t2`.`b` > 0) and (`test`.`t2`.`b` < 5))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 0 and `test`.`t2`.`b` < 5
explain partitions select * from t2 where b > 0 and b < 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where
diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result
index 339f2209cb3..dd9e074db0c 100644
--- a/mysql-test/r/partition_range.result
+++ b/mysql-test/r/partition_range.result
@@ -22,9 +22,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY RANGE (TO_DAYS(a))
-SUBPARTITION BY HASH (to_seconds(a))
-(PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM) */
+ PARTITION BY RANGE (to_days(`a`))
+SUBPARTITION BY HASH (to_seconds(`a`))
+(PARTITION `p0` VALUES LESS THAN (1) ENGINE = MyISAM)
drop table t1;
create table t1 (a int)
partition by range (a)
@@ -38,8 +38,8 @@ 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";
partition_method partition_expression partition_description
-RANGE TO_SECONDS(a) 63340531200
-RANGE TO_SECONDS(a) 63342604800
+RANGE to_seconds(`a`) 63340531200
+RANGE to_seconds(`a`) 63342604800
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';
@@ -62,9 +62,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY RANGE (TO_SECONDS(a))
-(PARTITION p0 VALUES LESS THAN (63340531200) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN (63342604800) ENGINE = MyISAM) */
+ PARTITION BY RANGE (to_seconds(`a`))
+(PARTITION `p0` VALUES LESS THAN (63340531200) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN (63342604800) ENGINE = MyISAM)
drop table t1;
create table t1 (a date)
partition by range(to_seconds(a))
@@ -93,9 +93,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY RANGE (to_seconds(a))
-(PARTITION p0 VALUES LESS THAN (63240134400) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN (63271756800) ENGINE = MyISAM) */
+ PARTITION BY RANGE (to_seconds(`a`))
+(PARTITION `p0` VALUES LESS THAN (63240134400) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN (63271756800) ENGINE = MyISAM)
drop table t1;
create table t1 (a datetime)
partition by range(to_seconds(a))
@@ -123,9 +123,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY RANGE (to_seconds(a))
-(PARTITION p0 VALUES LESS THAN (63240177600) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN (63271800000) ENGINE = MyISAM) */
+ PARTITION BY RANGE (to_seconds(`a`))
+(PARTITION `p0` VALUES LESS THAN (63240177600) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN (63271800000) ENGINE = MyISAM)
drop table t1;
create table t1 (a int, b char(20))
partition by range columns(a,b)
@@ -153,8 +153,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
drop table t1;
create table t1 (a integer)
partition by range (a)
@@ -284,10 +284,10 @@ t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION x1 VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM,
- PARTITION x2 VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM,
- PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `x1` VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM,
+ PARTITION `x2` VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM,
+ PARTITION `x3` VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM)
ALTER TABLE t1
partition by range (a)
partitions 3
@@ -308,10 +308,10 @@ t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION x1 VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM,
- PARTITION x2 VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM,
- PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `x1` VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM,
+ PARTITION `x2` VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM,
+ PARTITION `x3` VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM)
drop table if exists t1;
CREATE TABLE t1 (
a int not null,
@@ -409,14 +409,14 @@ t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a+b)
-(PARTITION x1 VALUES LESS THAN (1)
- (SUBPARTITION x11 ENGINE = MyISAM,
- SUBPARTITION x12 ENGINE = MyISAM),
- PARTITION x2 VALUES LESS THAN (5)
- (SUBPARTITION x21 ENGINE = MyISAM,
- SUBPARTITION x22 ENGINE = MyISAM)) */
+ PARTITION BY RANGE (`a`)
+SUBPARTITION BY HASH (`a` + `b`)
+(PARTITION `x1` VALUES LESS THAN (1)
+ (SUBPARTITION `x11` ENGINE = MyISAM,
+ SUBPARTITION `x12` ENGINE = MyISAM),
+ PARTITION `x2` VALUES LESS THAN (5)
+ (SUBPARTITION `x21` ENGINE = MyISAM,
+ SUBPARTITION `x22` ENGINE = MyISAM))
ALTER TABLE t1 ADD COLUMN d int;
show create table t1;
Table Create Table
@@ -427,14 +427,14 @@ t1 CREATE TABLE `t1` (
`d` int(11) DEFAULT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a+b)
-(PARTITION x1 VALUES LESS THAN (1)
- (SUBPARTITION x11 ENGINE = MyISAM,
- SUBPARTITION x12 ENGINE = MyISAM),
- PARTITION x2 VALUES LESS THAN (5)
- (SUBPARTITION x21 ENGINE = MyISAM,
- SUBPARTITION x22 ENGINE = MyISAM)) */
+ PARTITION BY RANGE (`a`)
+SUBPARTITION BY HASH (`a` + `b`)
+(PARTITION `x1` VALUES LESS THAN (1)
+ (SUBPARTITION `x11` ENGINE = MyISAM,
+ SUBPARTITION `x12` ENGINE = MyISAM),
+ PARTITION `x2` VALUES LESS THAN (5)
+ (SUBPARTITION `x21` ENGINE = MyISAM,
+ SUBPARTITION `x22` ENGINE = MyISAM))
drop table t1;
CREATE TABLE t1 (
a int not null,
@@ -658,9 +658,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (0) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM)
drop table t1;
create table t1 (a bigint unsigned)
partition by range (a)
@@ -671,9 +671,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (2) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM) */
+ PARTITION BY RANGE (`a`)
+(PARTITION `p0` VALUES LESS THAN (2) ENGINE = MyISAM,
+ PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM)
insert into t1 values (0xFFFFFFFFFFFFFFFF);
ERROR HY000: Table has no partition for value 18446744073709551615
drop table t1;
diff --git a/mysql-test/r/partition_symlink.result b/mysql-test/r/partition_symlink.result
index 5809512083d..90048eb3438 100644
--- a/mysql-test/r/partition_symlink.result
+++ b/mysql-test/r/partition_symlink.result
@@ -22,10 +22,10 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST (a)
-(PARTITION p0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM,
- PARTITION p1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM,
- PARTITION p2 VALUES IN (2) ENGINE = MyISAM) */
+ PARTITION BY LIST (`a`)
+(PARTITION `p0` VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM,
+ PARTITION `p2` VALUES IN (2) ENGINE = MyISAM)
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -51,6 +51,7 @@ CREATE DATABASE mysqltest2;
USE mysqltest2;
CREATE TABLE t1 (a INT) ENGINE = MyISAM;
INSERT INTO t1 VALUES (0);
+connect con1,localhost,mysqltest_1,,;
# user mysqltest_1:
USE test;
CREATE TABLE t1 (a INT)
@@ -72,6 +73,7 @@ INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
a
1
+connection default;
# user root:
USE mysqltest2;
FLUSH TABLES;
@@ -100,6 +102,7 @@ PARTITION p1 VALUES IN (1)
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp'
);
+connection con1;
# user mysqltest_1:
USE test;
CREATE TABLE t1 (a INT)
@@ -124,10 +127,12 @@ DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp'
);
Got one of the listed errors
+connection default;
# user root (cleanup):
DROP DATABASE mysqltest2;
USE test;
DROP USER mysqltest_1@localhost;
+disconnect con1;
create table t2 (i int )
ENGINE = MyISAM
partition by range (i)
@@ -157,8 +162,8 @@ Table Create Table
t2 CREATE TABLE `t2` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (i)
-(PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) */
+ PARTITION BY RANGE (`i`)
+(PARTITION `p01` VALUES LESS THAN (1000) ENGINE = MyISAM)
DROP TABLE t1, t2;
set @@sql_mode=@org_mode;
create table t1 (a int)
diff --git a/mysql-test/r/partition_sync.result b/mysql-test/r/partition_sync.result
index 0e8254e984e..18cc506e849 100644
--- a/mysql-test/r/partition_sync.result
+++ b/mysql-test/r/partition_sync.result
@@ -6,22 +6,24 @@ 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);
-# Connection 2
+connect con1,localhost,root;
+connection con1;
BEGIN;
SELECT * FROM t1;
a
0
1
-# Connection 1
+connection default;
ALTER TABLE t1 DROP PARTITION p3;
ERROR HY000: Error in list of partitions to DROP
-# Connection 2
+connection con1;
# This failed with deadlock and should not do so.
SELECT * FROM t1;
a
0
1
-# Connection 1
+connection default;
+disconnect con1;
DROP TABLE t1;
#
# Bug #46654 False deadlock on concurrent DML/DDL
@@ -31,27 +33,31 @@ DROP TABLE IF EXISTS tbl_with_partitions;
CREATE TABLE tbl_with_partitions ( i INT )
PARTITION BY HASH(i);
INSERT INTO tbl_with_partitions VALUES (1);
-# Connection 3
+connect con2,localhost,root;
+connect con3,localhost,root;
+connection con3;
LOCK TABLE tbl_with_partitions READ;
-# Connection 1
# Access table with disabled autocommit
+connection default;
SET AUTOCOMMIT = 0;
SELECT * FROM tbl_with_partitions;
i
1
-# Connection 2
# Alter table, abort after prepare
+connection con2;
set session debug_dbug="+d,abort_copy_table";
ALTER TABLE tbl_with_partitions ADD COLUMN f INT;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-# Connection 1
# Try accessing the table after Alter aborted.
# This used to give ER_LOCK_DEADLOCK.
+connection default;
SELECT * FROM tbl_with_partitions;
i
1
-# Connection 3
+connection con3;
UNLOCK TABLES;
-# Connection 1
# Cleanup
+connection default;
+disconnect con2;
+disconnect con3;
DROP TABLE tbl_with_partitions;
diff --git a/mysql-test/r/partition_utf8.result b/mysql-test/r/partition_utf8.result
index 339871f1f4a..7718e651423 100644
--- a/mysql-test/r/partition_utf8.result
+++ b/mysql-test/r/partition_utf8.result
@@ -7,8 +7,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(2) CHARACTER SET cp1250 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY LIST COLUMNS(a)
-(PARTITION p0 VALUES IN (_cp1250 0x81) ENGINE = MyISAM) */
+ PARTITION BY LIST COLUMNS(`a`)
+(PARTITION `p0` VALUES IN (_cp1250 0x81) ENGINE = MyISAM)
drop table t1;
create table t1 (a varchar(2) character set cp1250)
partition by list columns (a)
@@ -18,8 +18,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(2) CHARACTER SET cp1250 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY LIST COLUMNS(a)
-(PARTITION p0 VALUES IN ('€') ENGINE = MyISAM) */
+ PARTITION BY LIST COLUMNS(`a`)
+(PARTITION `p0` VALUES IN ('€') ENGINE = MyISAM)
drop table t1;
create table t1 (a varchar(1500), b varchar(1570))
partition by list columns(a,b)
@@ -45,9 +45,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY LIST COLUMNS(a)
-(PARTITION p0 VALUES IN ('†') ENGINE = MyISAM,
- PARTITION p1 VALUES IN ('') ENGINE = MyISAM) */
+ PARTITION BY LIST COLUMNS(`a`)
+(PARTITION `p0` VALUES IN ('†') ENGINE = MyISAM,
+ PARTITION `p1` VALUES IN ('') ENGINE = MyISAM)
insert into t1 values ('');
insert into t1 values (_ucs2 0x2020);
drop table t1;
diff --git a/mysql-test/r/plugin_auth.result b/mysql-test/r/plugin_auth.result
index 626722f9dd1..e470cc010c0 100644
--- a/mysql-test/r/plugin_auth.result
+++ b/mysql-test/r/plugin_auth.result
@@ -25,24 +25,32 @@ proxies_priv CREATE TABLE `proxies_priv` (
`User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
`Proxied_host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
`Proxied_user` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
- `With_grant` tinyint(1) NOT NULL DEFAULT '0',
+ `With_grant` tinyint(1) NOT NULL DEFAULT 0,
`Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '',
- `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`),
KEY `Grantor` (`Grantor`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User proxy privileges'
+connect plug_con,localhost,plug,plug_dest;
+connection plug_con;
select USER(),CURRENT_USER();
USER() CURRENT_USER()
plug@localhost plug_dest@%
## test SET PASSWORD
SET PASSWORD = PASSWORD('plug_dest');
+connection default;
+disconnect plug_con;
## test bad credentials
ERROR 28000: Access denied for user 'plug'@'localhost' (using password: YES)
## test bad default plugin : should get CR_AUTH_PLUGIN_CANNOT_LOAD
## test correct default plugin
+connect plug_con_rightp,localhost,plug,plug_dest,,,,,auth_test_plugin;
+connection plug_con_rightp;
select USER(),CURRENT_USER();
USER() CURRENT_USER()
plug@localhost plug_dest@%
+connection default;
+disconnect plug_con_rightp;
## 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';
@@ -51,9 +59,13 @@ DROP USER grant_user;
## 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();
USER() CURRENT_USER()
Ÿ@localhost plug_dest@%
+connection default;
+disconnect non_ascii;
DROP USER `Ÿ`;
## test GRANT ... IDENTIFIED WITH/BY ...
CREATE DATABASE test_grant_db;
@@ -61,24 +73,33 @@ CREATE DATABASE test_grant_db;
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();
USER() CURRENT_USER()
new_grant_user@localhost plug_dest@%
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;
# try re-create existing user via GRANT IDENTIFIED BY
GRANT ALL PRIVILEGES ON test_grant_db.* TO new_grant_user
IDENTIFIED BY 'new_password';
connect(localhost,new_grant_user,plug_dest,test,MYSQL_PORT,MYSQL_SOCK);
+connect plug_con_grant_deny,localhost,new_grant_user,plug_dest;
ERROR 28000: Access denied for user 'new_grant_user'@'localhost' (using password: YES)
+connect plug_con_grant,localhost,new_grant_user,new_password;
+connection plug_con_grant;
select USER(),CURRENT_USER();
USER() CURRENT_USER()
new_grant_user@localhost new_grant_user@%
USE test_grant_db;
CREATE TABLE t1 (a INT);
DROP TABLE t1;
+connection default;
+disconnect plug_con_grant;
DROP USER new_grant_user;
# try re-create existing user via GRANT IDENTIFIED WITH
GRANT ALL PRIVILEGES ON test_grant_db.* TO plug
@@ -111,6 +132,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
# this should fail : no such grant
REVOKE PROXY ON grant_plug_dest FROM grant_plug;
ERROR 42000: There is no such grant defined for user 'grant_plug' on host '%'
+connect grant_plug_dest_con,localhost,grant_plug_dest,grant_plug_dest_passwd;
+connection grant_plug_dest_con;
in grant_plug_dest_con
## testing what an ordinary user can grant
this should fail : no rights to grant all
@@ -134,7 +157,9 @@ ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost'
this should fail : can't create users
GRANT PROXY ON grant_plug_dest TO grant_plug@localhost;
ERROR 42000: You are not allowed to create a user with GRANT
+connection default;
in default connection
+disconnect grant_plug_dest_con;
# test what root can grant
should work : root has PROXY to all users
GRANT PROXY ON ''@'%%' TO grant_plug;
@@ -144,10 +169,14 @@ GRANT PROXY ON ''@'%%' TO proxy_admin IDENTIFIED BY 'test'
WITH GRANT OPTION;
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;
in proxy_admin_con;
should work : proxy_admin has proxy to ''@'%%'
GRANT PROXY ON future_user TO grant_plug;
+connection default;
in default connection
+disconnect proxy_admin_con;
SHOW GRANTS FOR grant_plug;
Grants for grant_plug@%
GRANT ALL PRIVILEGES ON *.* TO 'grant_plug'@'%' IDENTIFIED VIA test_plugin_server USING 'grant_plug_dest'
@@ -191,11 +220,15 @@ ERROR HY000: Variable 'proxy_user' is a read only variable
SELECT @@LOCAL.proxy_user;
@@LOCAL.proxy_user
NULL
+connect plug_con,localhost,plug,plug_dest;
+connection plug_con;
# in connection plug_con
SELECT @@LOCAL.proxy_user;
@@LOCAL.proxy_user
'plug'@'%'
+connection default;
# in connection default
+disconnect plug_con;
## cleanup
DROP USER plug;
DROP USER plug_dest;
@@ -219,11 +252,15 @@ ERROR HY000: Variable 'external_user' is a read only variable
SELECT @@LOCAL.external_user;
@@LOCAL.external_user
NULL
+connect plug_con,localhost,plug,plug_dest;
+connection plug_con;
# in connection plug_con
SELECT @@LOCAL.external_user;
@@LOCAL.external_user
plug_dest
+connection default;
# in connection default
+disconnect plug_con;
## cleanup
DROP USER plug;
DROP USER plug_dest;
@@ -236,9 +273,12 @@ 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;
user() current_user() @@proxy_user
test_login_user@localhost power_user@% ''@'%%'
+connection default;
+disconnect plug_con;
DROP USER power_user;
DROP USER ''@'%%';
DROP DATABASE confidential_db;
@@ -274,10 +314,14 @@ ERROR 28000: Access denied for user 'root'@'localhost'
REVOKE PROXY ON u2@localhost FROM u1@localhost;
ERROR 28000: Access denied for user 'root'@'localhost'
# go try graning proxy on itself, so that it will need the table
+connect proxy_granter_con,localhost,u2,;
+connection proxy_granter_con;
GRANT PROXY ON u2@localhost TO u1@localhost;
ERROR 42S02: Table 'mysql.proxies_priv' doesn't exist
REVOKE PROXY ON u2@localhost FROM u1@localhost;
ERROR 42S02: Table 'mysql.proxies_priv' doesn't exist
+connection default;
+disconnect proxy_granter_con;
# test if REVOKE works without the proxies_priv table
REVOKE ALL PRIVILEGES ON *.* FROM u1@localhost, u2@localhost;
# test if DROP USER work without the proxies_priv table
@@ -310,14 +354,18 @@ CREATE USER uplain@localhost IDENTIFIED WITH 'cleartext_plugin_server'
AS 'cleartext_test';
## test plugin auth
ERROR 28000: Access denied for user 'uplain'@'localhost' (using password: YES)
+connect cleartext_con,localhost,uplain,cleartext_test;
+connection cleartext_con;
select USER(),CURRENT_USER();
USER() CURRENT_USER()
uplain@localhost uplain@localhost
+connection default;
+disconnect cleartext_con;
DROP USER uplain@localhost;
#
# Bug #59038 : mysql.user.authentication_string column
# causes configuration wizard to fail
-INSERT INTO mysql.user(
+INSERT IGNORE INTO mysql.user(
Host,
User,
Password,
@@ -409,6 +457,9 @@ ERROR 1045 (28000): Access denied for user 'unknown'@'localhost' (using password
CREATE USER bug12610784@localhost;
SET PASSWORD FOR bug12610784@localhost = PASSWORD('secret');
ERROR 28000: Access denied for user 'bug12610784'@'localhost' (using password: NO)
+connect b12610784,localhost,bug12610784,secret,test;
+connection default;
+disconnect b12610784;
DROP USER bug12610784@localhost;
#
# Bug #12818542: PAM: ADDING PASSWORD FOR AN ACCOUNT DISABLES PAM
@@ -419,13 +470,21 @@ 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();
USER() CURRENT_USER()
bug12818542@localhost bug12818542_dest@localhost
SET PASSWORD = PASSWORD('bruhaha');
+connection default;
+disconnect bug12818542_con;
+connect bug12818542_con2,localhost,bug12818542,bug12818542_dest;
+connection bug12818542_con2;
SELECT USER(),CURRENT_USER();
USER() CURRENT_USER()
bug12818542@localhost bug12818542_dest@localhost
+connection default;
+disconnect bug12818542_con2;
DROP USER bug12818542@localhost;
DROP USER bug12818542_dest@localhost;
SET GLOBAL SQL_MODE=default;
diff --git a/mysql-test/r/plugin_auth_qa_1.result b/mysql-test/r/plugin_auth_qa_1.result
index 44b5a88de1e..42a7b1491c0 100644
--- a/mysql-test/r/plugin_auth_qa_1.result
+++ b/mysql-test/r/plugin_auth_qa_1.result
@@ -96,14 +96,14 @@ 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);
+connect plug_user,localhost,plug_user,plug_dest;
select USER(),CURRENT_USER();
USER() CURRENT_USER()
plug_user@localhost plug_dest@%
connection default;
disconnect plug_user;
RENAME USER plug_user TO new_user;
-connect(plug_user,localhost,new_user,plug_dest);
+connect plug_user,localhost,new_user,plug_dest;
select USER(),CURRENT_USER();
USER() CURRENT_USER()
new_user@localhost plug_dest@%
@@ -125,7 +125,7 @@ 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);
+connect plug_user,localhost,plug_user,plug_dest;
select USER(),CURRENT_USER();
USER() CURRENT_USER()
plug_user@localhost plug_dest@%
@@ -153,7 +153,6 @@ SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
user plugin authentication_string
new_user new_plugin_server new_dest
plug_dest
-connect(plug_user,localhost,new_user,new_dest);
ERROR HY000: Plugin 'new_plugin_server' is not loaded
UPDATE mysql.user SET plugin='test_plugin_server' WHERE user='new_user';
UPDATE mysql.user SET USER='new_dest' WHERE user='plug_dest';
@@ -163,7 +162,7 @@ SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
user plugin authentication_string
new_dest
new_user test_plugin_server new_dest
-connect(plug_user,localhost,new_user,new_dest);
+connect plug_user,localhost,new_user,new_dest;
select USER(),CURRENT_USER();
USER() CURRENT_USER()
new_user@localhost new_dest@%
@@ -178,7 +177,7 @@ new_dest
new_user test_plugin_server new_dest
plug_dest
GRANT ALL PRIVILEGES ON test.* TO new_user;
-connect(plug_user,localhost,new_dest,new_dest_passwd);
+connect plug_user,localhost,new_dest,new_dest_passwd;
select USER(),CURRENT_USER();
USER() CURRENT_USER()
new_dest@localhost new_dest@%
@@ -192,7 +191,7 @@ SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
user plugin authentication_string
test_plugin_server proxied_user
proxied_user
-connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+connect proxy_con,localhost,proxied_user,proxied_user_passwd;
SELECT USER(),CURRENT_USER();
USER() CURRENT_USER()
proxied_user@localhost proxied_user@%
@@ -202,16 +201,15 @@ SELECT @@proxy_user;
NULL
connection default;
disconnect proxy_con;
-connect(proxy_con,localhost,proxy_user,proxied_user);
ERROR 28000: Access denied for user 'proxy_user'@'localhost' (using password: YES)
GRANT PROXY ON proxied_user TO ''@'%%';
-connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+connect proxy_con,localhost,proxied_user,proxied_user_passwd;
SELECT USER(),CURRENT_USER();
USER() CURRENT_USER()
proxied_user@localhost proxied_user@%
connection default;
disconnect proxy_con;
-connect(proxy_con,localhost,proxy_user,proxied_user);
+connect proxy_con,localhost,proxy_user,proxied_user;
SELECT USER(),CURRENT_USER();
USER() CURRENT_USER()
proxy_user@localhost proxied_user@%
@@ -229,7 +227,7 @@ SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
user plugin authentication_string
test_plugin_server proxied_user
proxied_user
-connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+connect proxy_con,localhost,proxied_user,proxied_user_passwd;
SELECT USER(),CURRENT_USER();
USER() CURRENT_USER()
proxied_user@localhost proxied_user@%
@@ -238,16 +236,15 @@ SELECT @@proxy_user;
NULL
connection default;
disconnect proxy_con;
-connect(proxy_con,localhost,proxy_user,proxied_user);
ERROR 28000: Access denied for user 'proxy_user'@'localhost' (using password: YES)
GRANT PROXY ON proxied_user TO ''@'%%';
-connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+connect proxy_con,localhost,proxied_user,proxied_user_passwd;
SELECT USER(),CURRENT_USER();
USER() CURRENT_USER()
proxied_user@localhost proxied_user@%
connection default;
disconnect proxy_con;
-connect(proxy_con,localhost,proxy_user,proxied_user);
+connect proxy_con,localhost,proxy_user,proxied_user;
SELECT USER(),CURRENT_USER();
USER() CURRENT_USER()
proxy_user@localhost proxied_user@%
@@ -276,11 +273,11 @@ proxied_user_2
proxied_user_3
proxied_user_4
proxied_user_5
-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);
+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();
USER() CURRENT_USER()
diff --git a/mysql-test/r/plugin_not_embedded.result b/mysql-test/r/plugin_not_embedded.result
index 8106abc497f..2edf6c496d3 100644
--- a/mysql-test/r/plugin_not_embedded.result
+++ b/mysql-test/r/plugin_not_embedded.result
@@ -3,11 +3,16 @@
#
CREATE USER bug51770@localhost;
GRANT INSERT ON mysql.plugin TO bug51770@localhost;
+connect con1,localhost,bug51770,,;
INSTALL PLUGIN example SONAME 'ha_example.so';
UNINSTALL PLUGIN example;
ERROR 42000: DELETE command denied to user 'bug51770'@'localhost' for table 'plugin'
+connection default;
GRANT DELETE ON mysql.plugin TO bug51770@localhost;
+connection con1;
UNINSTALL PLUGIN example;
+disconnect con1;
+connection default;
DROP USER bug51770@localhost;
INSTALL PLUGIN example SONAME '../ha_example.so';
ERROR HY000: No paths allowed for shared library
diff --git a/mysql-test/r/plugin_vars.result b/mysql-test/r/plugin_vars.result
index 869e0cf9a2a..0e382427b1d 100644
--- a/mysql-test/r/plugin_vars.result
+++ b/mysql-test/r/plugin_vars.result
@@ -15,8 +15,18 @@ WHILE x DO
SET x= x - 1;
SHOW VARIABLES;
END WHILE|
+connect con1, localhost, root,,;
+connect con2, localhost, root,,;
+connection con1;
CALL p_install(100);
+connection con2;
CALL p_show_vars(100);
+connection default;
+connection con1;
+connection con2;
+connection default;
+disconnect con1;
+disconnect con2;
USE test;
DROP PROCEDURE p_install;
DROP PROCEDURE p_show_vars;
diff --git a/mysql-test/r/pool_of_threads.result b/mysql-test/r/pool_of_threads.result
index ddc451516e2..b25d8d1e50e 100644
--- a/mysql-test/r/pool_of_threads.result
+++ b/mysql-test/r/pool_of_threads.result
@@ -603,7 +603,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
+1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
1 SIMPLE t3 ref period period 4 test.t1.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
id select_type table type possible_keys key key_len ref rows Extra
@@ -1510,7 +1510,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
Warnings:
-Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> ''))
+Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> ''
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
@@ -2157,22 +2157,32 @@ Warnings:
Warning 1052 Column 'kundentyp' in group statement is ambiguous
drop table t1;
SET optimizer_switch=@save_optimizer_switch;
+connection default;
SELECT sleep(50);
+connect con2,localhost,root,,;
SELECT sleep(50);
# -- 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';
Connection on extra port ok
Connection on extra port ok
SELECT sleep(5.5);
+connect extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,;
+connection extracon2;
SELECT 'Connection on extra port 2 ok';
Connection on extra port 2 ok
Connection on extra port 2 ok
# -- Success: more than --extra-max-connections + 1 normal connections not possible
+connection extracon2;
KILL QUERY <default_connection_ID>;
KILL QUERY <con2_connection_ID>;
+connection default;
sleep(50)
1
+connection con2;
sleep(50)
1
+connection extracon;
sleep(5.5)
0
diff --git a/mysql-test/r/processlist.result b/mysql-test/r/processlist.result
index ebec6175a5b..b8e2271530d 100644
--- a/mysql-test/r/processlist.result
+++ b/mysql-test/r/processlist.result
@@ -1,22 +1,30 @@
SET DEBUG_SYNC = 'dispatch_command_before_set_time WAIT_FOR do_set_time';
SELECT 1;
+connect con1,localhost,root,,;
SET DEBUG_SYNC = 'fill_schema_processlist_after_unow SIGNAL do_set_time WAIT_FOR fill_schema_proceed';
SELECT ID, TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE CONCAT(":", ID, ":") = ":TID:";
+connection default;
1
1
SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed';
+connection con1;
ID TIME TIME_MS
TID 0 0.000
set debug_sync='reset';
+connection default;
+connection con1;
SET debug_dbug="+d,sleep_inject_query_done_debug_sync";
select sleep(5);
sleep(5)
0
+connection default;
SET DEBUG_SYNC = 'now WAIT_FOR query_done';
select command, time < 5 from information_schema.processlist where id != connection_id();
command time < 5
Sleep 1
+disconnect con1;
set debug_sync='reset';
+connection default;
#
# 10.1 tests
#
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index e63b820d4dd..6f86b330251 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -768,13 +768,13 @@ deallocate prepare stmt;
drop table t1;
prepare stmt from 'create table t1 (a varchar(10) character set utf8)';
execute stmt;
-insert into t1 (a) values (repeat('a', 20));
+insert ignore into t1 (a) values (repeat('a', 20));
select length(a) from t1;
length(a)
10
drop table t1;
execute stmt;
-insert into t1 (a) values (repeat('a', 20));
+insert ignore into t1 (a) values (repeat('a', 20));
select length(a) from t1;
length(a)
10
@@ -897,10 +897,13 @@ show status like 'prepared_stmt_count';
Variable_name Value
Prepared_stmt_count 0
prepare stmt from "select 1";
+connect con1,localhost,root,,;
+connection con1;
prepare stmt from "select 2";
prepare stmt1 from "select 3";
prepare stmt2 from "select 4";
ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 3)
+connection default;
prepare stmt2 from "select 4";
ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 3)
select @@max_prepared_stmt_count;
@@ -909,6 +912,8 @@ select @@max_prepared_stmt_count;
show status like 'prepared_stmt_count';
Variable_name Value
Prepared_stmt_count 3
+disconnect con1;
+connection default;
deallocate prepare stmt;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
@@ -1733,7 +1738,7 @@ execute stmt using @a;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `?` decimal(2,1) DEFAULT NULL
+ `?` decimal(2,1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
drop table if exists t1;
@@ -1787,7 +1792,7 @@ prepare stmt from "create view v1 (c) as select b+1 from t1";
execute stmt;
show create view v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci
select * from v1;
c
drop view v1;
@@ -1795,7 +1800,7 @@ execute stmt;
deallocate prepare stmt;
show create view v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci
select * from v1;
c
drop view v1;
@@ -1803,7 +1808,7 @@ prepare stmt from "create view v1 (c,d,e,f) as select a,b,a in (select a+2 from
execute stmt;
show create view v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select `t1`.`a` + 2 from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
select * from v1;
c d e f
drop view v1;
@@ -1811,7 +1816,7 @@ execute stmt;
deallocate prepare stmt;
show create view v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select `t1`.`a` + 2 from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
select * from v1;
c d e f
drop view v1;
@@ -1857,7 +1862,7 @@ prepare stmt from "create view v1 (x) as select a from t1 where a > 1";
execute stmt;
show create view v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `x` from `t1` where (`t1`.`a` > 1) latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `x` from `t1` where `t1`.`a` > 1 latin1 latin1_swedish_ci
select * from v1;
x
drop view v1;
@@ -1865,7 +1870,7 @@ execute stmt;
deallocate prepare stmt;
show create view v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `x` from `t1` where (`t1`.`a` > 1) latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `x` from `t1` where `t1`.`a` > 1 latin1 latin1_swedish_ci
select * from v1;
x
drop view v1;
@@ -2399,15 +2404,15 @@ create procedure a() select 42;
create procedure proc_1(a char(2)) show create procedure a;
call proc_1("bb");
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
select 42 latin1 latin1_swedish_ci latin1_swedish_ci
call proc_1("bb");
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
select 42 latin1 latin1_swedish_ci latin1_swedish_ci
call proc_1("bb");
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
select 42 latin1 latin1_swedish_ci latin1_swedish_ci
drop procedure proc_1;
create function func_1() returns int begin show create procedure a; return 1; end|
@@ -2419,15 +2424,15 @@ ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "show create procedure a";
execute abc;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
select 42 latin1 latin1_swedish_ci latin1_swedish_ci
execute abc;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
select 42 latin1 latin1_swedish_ci latin1_swedish_ci
execute abc;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
+a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
select 42 latin1 latin1_swedish_ci latin1_swedish_ci
deallocate prepare abc;
drop procedure a;
@@ -2436,15 +2441,15 @@ create function a() returns int return 42+13;
create procedure proc_1(a char(2)) show create function a;
call proc_1("bb");
Function sql_mode Create Function character_set_client collation_connection Database Collation
-a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci
call proc_1("bb");
Function sql_mode Create Function character_set_client collation_connection Database Collation
-a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci
call proc_1("bb");
Function sql_mode Create Function character_set_client collation_connection Database Collation
-a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci
drop procedure proc_1;
create function func_1() returns int begin show create function a; return 1; end|
@@ -2456,15 +2461,15 @@ ERROR 42000: FUNCTION test.func_1 does not exist
prepare abc from "show create function a";
execute abc;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci
execute abc;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci
execute abc;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
+a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci
deallocate prepare abc;
drop function a;
@@ -2570,7 +2575,7 @@ call proc_1();
Got one of the listed errors
drop procedure proc_1;
create function func_1() returns int begin install plugin my_plug soname '/tmp/plugin'; return 1; end|
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
@@ -2586,7 +2591,7 @@ call proc_1();
ERROR 42000: PLUGIN my_plug does not exist
drop procedure proc_1;
create function func_1() returns int begin uninstall plugin my_plug; return 1; end|
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
@@ -2611,7 +2616,7 @@ call proc_1();
drop database if exists mysqltest_xyz;
drop procedure proc_1;
create function func_1() returns int begin create database mysqltest_xyz; return 1; end|
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
@@ -2674,7 +2679,7 @@ call proc_1();
drop user pstest_xyz@localhost;
drop procedure proc_1;
create function func_1() returns int begin create user pstest_xyz@localhost; return 1; end|
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;
@@ -2713,7 +2718,7 @@ call proc_1();
drop event xyz;
drop procedure proc_1;
create function func_1() returns int begin alter event xyz comment 'xyz'; return 1; end|
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
prepare abc from "alter event xyz comment 'xyz'";
ERROR HY000: This command is not supported in the prepared statement protocol yet
deallocate prepare abc;
@@ -2728,7 +2733,7 @@ call proc_1();
ERROR HY000: Unknown event 'xyz'
drop procedure proc_1;
create function func_1() returns int begin drop event xyz; return 1; end|
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
prepare abc from "drop event xyz";
ERROR HY000: This command is not supported in the prepared statement protocol yet
deallocate prepare abc;
@@ -2904,12 +2909,14 @@ 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 stmt1 FROM "SELECT i FROM t1";
PREPARE stmt2 FROM "INSERT INTO t2 (i) VALUES (3)";
EXECUTE stmt1;
i
1
EXECUTE stmt2;
+connection default;
SELECT * FROM t2;
i
2
@@ -2922,6 +2929,7 @@ 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;
EXECUTE stmt1;
i
1
@@ -2933,6 +2941,8 @@ i j
3 NULL
4 5
3 NULL
+disconnect conn1;
+connection default;
DROP TABLE t1, t2;
drop table if exists t1;
Warnings:
@@ -3378,7 +3388,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` bigint(20) DEFAULT NULL
+ `c1` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = b'10100100101';
@a @a = b'10100100101'
@@ -3396,7 +3406,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = '2007-11-18 15:01:02';
@a @a = '2007-11-18 15:01:02'
@@ -3414,7 +3424,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = '1234-11-12 12:34:59';
@a @a = '1234-11-12 12:34:59'
@@ -3432,7 +3442,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = '123:45:01';
@a @a = '123:45:01'
@@ -3450,7 +3460,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = '1234-11-12';
@a @a = '1234-11-12'
@@ -3468,7 +3478,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` bigint(20) DEFAULT NULL
+ `c1` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = 2010;
@a @a = 2010
@@ -3522,7 +3532,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` decimal(65,30) DEFAULT NULL
+ `c1` decimal(65,38) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = 123.456789;
@a @a = 123.456789
@@ -3540,7 +3550,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('a', 16);
@a @a = REPEAT('a', 16)
@@ -3558,7 +3568,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('b', 16);
@a @a = REPEAT('b', 16)
@@ -3576,7 +3586,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('c', 16);
@a @a = REPEAT('c', 16)
@@ -3594,7 +3604,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('d', 16);
@a @a = REPEAT('d', 16)
@@ -3612,7 +3622,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('e', 16);
@a @a = REPEAT('e', 16)
@@ -3630,7 +3640,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('f', 16);
@a @a = REPEAT('f', 16)
@@ -3648,7 +3658,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('g', 32);
@a @a = REPEAT('g', 32)
@@ -3666,7 +3676,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('h', 16);
@a @a = REPEAT('h', 16)
@@ -3684,7 +3694,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('i', 16);
@a @a = REPEAT('i', 16)
@@ -3702,7 +3712,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('j', 16);
@a @a = REPEAT('j', 16)
@@ -3720,7 +3730,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('k', 16);
@a @a = REPEAT('k', 16)
@@ -3738,7 +3748,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = REPEAT('l', 16);
@a @a = REPEAT('l', 16)
@@ -3756,7 +3766,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = 'aaa';
@a @a = 'aaa'
@@ -3774,7 +3784,7 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
SHOW CREATE TABLE tmp1;
Table Create Table
tmp1 CREATE TEMPORARY TABLE `tmp1` (
- `c1` longblob
+ `c1` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @a, @a = 'aaa';
@a @a = 'aaa'
@@ -3802,11 +3812,16 @@ DROP TABLE t1;
#
# Test that metadata locks taken during prepare are released.
#
+connect con1,localhost,root,,;
+connection default;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT);
+connection con1;
BEGIN;
PREPARE stmt1 FROM "SELECT * FROM t1";
+connection default;
DROP TABLE t1;
+disconnect con1;
#
# Bug#56115: invalid memory reads when PS selecting from
@@ -3924,8 +3939,6 @@ c1 c2 count(c3)
2012-03-01 01:00:00 3 1
2012-03-01 02:00:00 3 1
DEALLOCATE PREPARE s1;
-#
-# End of 5.5 tests.
prepare stmt from "select date('2010-10-10') between '2010-09-09' and ?";
set @a='2010-11-11';
execute stmt using @a;
@@ -4061,9 +4074,9 @@ DROP TABLE t1, t2;
#
CREATE TABLE t1 (a INT);
PREPARE stmt FROM "SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1";
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 + 1)'
+ERROR 22003: BIGINT UNSIGNED value is out of range in '18446744073709551615 + 1'
SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1;
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 + 1)'
+ERROR 22003: BIGINT UNSIGNED value is out of range in '18446744073709551615 + 1'
drop table t1;
# End of 5.3 tests
#
@@ -4131,13 +4144,13 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref idx idx 6 const 1 100.00 Using index condition
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`c` = 'foo')
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`c` = 'foo'
execute stmt1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref idx idx 6 const 1 100.00 Using index condition
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`c` = 'foo')
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`c` = 'foo'
deallocate prepare stmt1;
prepare stmt1 from
"select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'";
@@ -4351,3 +4364,813 @@ LINE2 2
LINE3 3
drop table t1;
# End of 5.5 tests
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-10709 Expressions as parameters to Dynamic SQL
+#
+#
+# Using a simple expressions as an EXECUTE parameter
+#
+PREPARE stmt FROM 'SELECT ? FROM DUAL';
+EXECUTE stmt USING 10;
+?
+10
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM 'SELECT ? FROM DUAL';
+EXECUTE stmt USING TO_BASE64('xxx');
+?
+eHh4
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM 'SELECT ?+? FROM DUAL';
+EXECUTE stmt USING 10, 10 + 10;
+?+?
+30
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM 'SELECT CONCAT(?,?) FROM DUAL';
+EXECUTE stmt USING 'xxx', CONCAT('yyy','zzz');
+CONCAT(?,?)
+xxxyyyzzz
+DEALLOCATE PREPARE stmt;
+#
+# Testing disallowed expressions in USING
+#
+PREPARE stmt FROM 'SELECT ? FROM DUAL';
+EXECUTE stmt USING (SELECT 1);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1)' at line 1
+DEALLOCATE PREPARE stmt;
+CREATE FUNCTION f1() RETURNS VARCHAR(10) RETURN 'test';
+PREPARE stmt FROM 'SELECT ? FROM DUAL';
+EXECUTE stmt USING f1();
+ERROR 42000: EXECUTE..USING does not support subqueries or stored functions
+DEALLOCATE PREPARE stmt;
+DROP FUNCTION f1;
+#
+# Testing erroneous expressions in USING
+#
+PREPARE stmt FROM 'SELECT ?';
+EXECUTE stmt USING _latin1'a'=_latin2'a';
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation '='
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM 'SELECT ?';
+EXECUTE stmt USING ROW(1,2);
+ERROR 21000: Operand should contain 1 column(s)
+DEALLOCATE PREPARE stmt;
+#
+# Creating tables from EXECUTE parameters
+#
+PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? AS c1 FROM DUAL';
+EXECUTE stmt USING 10;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(21) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+EXECUTE stmt USING 10.123;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` decimal(5,3) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+EXECUTE stmt USING 10.123e0;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` double NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+EXECUTE stmt USING CURRENT_DATE;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` date NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+EXECUTE stmt USING CURRENT_TIMESTAMP;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` datetime NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+EXECUTE stmt USING CURRENT_TIMESTAMP(3);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` datetime(3) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+EXECUTE stmt USING CURRENT_TIMESTAMP(6);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` datetime(6) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+EXECUTE stmt USING CURRENT_TIME;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` time NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+EXECUTE stmt USING CURRENT_TIME(3);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` time(3) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+EXECUTE stmt USING CURRENT_TIME(6);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` time(6) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+DEALLOCATE PREPARE stmt;
+#
+# Using a user variable as an EXECUTE..USING out parameter
+#
+CREATE PROCEDURE p1(OUT a INT)
+BEGIN
+SET a:= 10;
+END;
+/
+SET @a=1;
+CALL p1(@a);
+SELECT @a;
+@a
+10
+SET @a=2;
+PREPARE stmt FROM 'CALL p1(?)';
+EXECUTE stmt USING @a;
+SELECT @a;
+@a
+10
+DROP PROCEDURE p1;
+#
+# Using an SP variable as an EXECUTE..USING out parameter
+#
+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;
+/
+SET @a= 1;
+CALL p2(@a);
+SELECT @a;
+@a
+10
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+#
+# Testing re-prepare on a table metadata update between PREPARE and EXECUTE
+#
+CREATE TABLE t1 (a INT);
+CREATE PROCEDURE p1(a INT)
+BEGIN
+INSERT INTO t1 VALUES (a);
+END;
+/
+PREPARE stmt FROM 'CALL p1(?)';
+EXECUTE stmt USING 10;
+SELECT * FROM t1;
+a
+10
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=NEW.a+1;
+EXECUTE stmt USING 20;
+SELECT * FROM t1;
+a
+10
+21
+DEALLOCATE PREPARE stmt;
+DROP PROCEDURE p1;
+DROP TABLE t1;
+#
+# End of MDEV-10709 Expressions as parameters to Dynamic SQL
+#
+#
+# MDEV-10585 EXECUTE IMMEDIATE statement
+#
+EXECUTE IMMEDIATE 'SELECT 1 AS a';
+a
+1
+SET @a=10;
+EXECUTE IMMEDIATE 'SELECT ? AS a' USING @a;
+a
+10
+EXECUTE IMMEDIATE 'SELECT ? AS a' USING 20;
+a
+20
+#
+# Erroneous queries
+#
+EXECUTE IMMEDIATE 'xxx';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'xxx' at line 1
+EXECUTE IMMEDIATE 'SELECT 1' USING @a;
+ERROR HY000: Incorrect arguments to EXECUTE
+EXECUTE IMMEDIATE 'SELECT ?';
+ERROR HY000: Incorrect arguments to EXECUTE
+EXECUTE IMMEDIATE 'EXECUTE IMMEDIATE "SELECT 1"';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+EXECUTE IMMEDIATE 'PREPARE stmt FROM "SELECT 1"';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+EXECUTE IMMEDIATE 'EXECUTE stmt';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+EXECUTE IMMEDIATE 'DEALLOCATE PREPARE stmt';
+ERROR HY000: This command is not supported in the prepared statement protocol yet
+EXECUTE IMMEDIATE 'SELECT ?' USING _latin1'a'=_latin2'a';
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation '='
+EXECUTE IMMEDIATE 'SELECT ?' USING ROW(1,2);
+ERROR 21000: Operand should contain 1 column(s)
+#
+# Testing disallowed expressions in USING
+#
+EXECUTE IMMEDIATE 'SELECT ? FROM DUAL' USING (SELECT 1);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1)' at line 1
+CREATE FUNCTION f1() RETURNS VARCHAR(10) RETURN 'test';
+EXECUTE IMMEDIATE 'SELECT ? FROM DUAL' USING f1();
+ERROR 42000: EXECUTE..USING does not support subqueries or stored functions
+DROP FUNCTION f1;
+#
+# DDL
+#
+EXECUTE IMMEDIATE 'CREATE TABLE t1 (a INT)';
+EXECUTE IMMEDIATE 'SHOW CREATE TABLE t1';
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+EXECUTE IMMEDIATE 'DROP TABLE t1';
+SET @stmt= 'CREATE TABLE t1 (a INT)';
+EXECUTE IMMEDIATE @stmt;
+SET @stmt= 'SHOW CREATE TABLE t1';
+EXECUTE IMMEDIATE @stmt;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SET @stmt= 'DROP TABLE t1';
+EXECUTE IMMEDIATE @stmt;
+#
+# DDL with parameters
+#
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(21) NOT NULL,
+ `b` decimal(3,1) NOT NULL,
+ `c` double NOT NULL,
+ `d` varchar(3) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(21) NOT NULL,
+ `b` decimal(3,1) NOT NULL,
+ `c` double NOT NULL,
+ `d` varchar(3) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `t1` time NOT NULL,
+ `t2` time(3) NOT NULL,
+ `d1` date NOT NULL,
+ `dt1` datetime NOT NULL,
+ `dt2` datetime(3) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+#
+# Using a user variable as an EXECUTE IMMEDIATE..USING out parameter
+#
+CREATE PROCEDURE p1(OUT a INT)
+BEGIN
+SET a:= 10;
+END;
+/
+SET @a=1;
+CALL p1(@a);
+SELECT @a;
+@a
+10
+SET @a=2;
+EXECUTE IMMEDIATE 'CALL p1(?)' USING @a;
+SELECT @a;
+@a
+10
+DROP PROCEDURE p1;
+#
+# Using an SP variable as an EXECUTE IMMEDIATE..USING out parameter
+#
+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;
+/
+SET @a= 1;
+CALL p2(@a);
+SELECT @a;
+@a
+10
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+#
+# Changing user variables
+#
+SET @a=10;
+EXECUTE IMMEDIATE 'SET @a=@a+1';
+SELECT @a;
+@a
+11
+#
+# SET STATEMENT
+#
+SET @@max_sort_length=1024;
+EXECUTE IMMEDIATE 'SET STATEMENT max_sort_length=1025 FOR SELECT @@max_sort_length';
+@@max_sort_length
+1025
+SELECT @@max_sort_length;
+@@max_sort_length
+1024
+SET @@max_sort_length=DEFAULT;
+#
+# Similar to prepared EXECUTE, IMMEDIATE is not allowed in stored functions
+#
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+EXECUTE IMMEDIATE 'DO 1';
+RETURN 1;
+END;
+$$
+ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger
+#
+# Status variables
+#
+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);
+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;
+$$
+# Note, EXECUTE IMMEDIATE does not increment COM_EXECUTE_SQL
+# It increments COM_EXECUTE_IMMEDIATE instead.
+CALL test_status_var('COM_EXECUTE_SQL');
+increment
+0
+CALL test_status_var('COM_EXECUTE_IMMEDIATE');
+increment
+1
+CALL test_status_var('COM_STMT_PREPARE');
+increment
+1
+CALL test_status_var('COM_STMT_EXECUTE');
+increment
+1
+CALL test_status_var('COM_STMT_CLOSE');
+increment
+1
+DROP PROCEDURE test_status_var;
+DROP FUNCTION get_status_var;
+#
+# End of MDEV-10585 EXECUTE IMMEDIATE statement
+#
+#
+# MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions
+#
+#
+# Testing erroneous and diallowed prepare source
+#
+EXECUTE IMMEDIATE CONCAT(_latin1'SELECT 1 AS c FROM ', _latin2 'DUAL');
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat'
+PREPARE stmt FROM CONCAT(_latin1'SELECT 1 AS c FROM ', _latin2 'DUAL');
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat'
+EXECUTE IMMEDIATE (SELECT 'SELECT 1');
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 'SELECT 1')' at line 1
+PREPARE stmt FROM (SELECT 'SELECT 1');
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 'SELECT 1')' at line 1
+EXECUTE IMMEDIATE a;
+ERROR 42S22: Unknown column 'a' in 'field list'
+PREPARE stmt FROM a;
+ERROR 42S22: Unknown column 'a' in 'field list'
+EXECUTE IMMEDIATE NULL;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1
+PREPARE stmt FROM NULL;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1
+EXECUTE IMMEDIATE CONCAT(NULL);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1
+PREPARE stmt FROM CONCAT(NULL);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1
+EXECUTE IMMEDIATE ? USING 'SELECT 1';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? USING 'SELECT 1'' at line 1
+EXECUTE IMMEDIATE 10;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '10' at line 1
+EXECUTE IMMEDIATE TIME'10:20:30';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '10:20:30' at line 1
+EXECUTE IMMEDIATE ROW('SELECT 1','SELECT 2');
+ERROR 21000: Operand should contain 1 column(s)
+EXECUTE IMMEDIATE MAX('SELECT 1 AS c');
+ERROR HY000: Invalid use of group function
+EXECUTE IMMEDIATE DEFAULT(a);
+ERROR 42S22: Unknown column 'a' in 'field list'
+EXECUTE IMMEDIATE VALUES(a);
+ERROR 42S22: Unknown column 'a' in 'field list'
+CREATE FUNCTION f1() RETURNS VARCHAR(64) RETURN 't1';
+EXECUTE IMMEDIATE f1();
+ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions
+PREPARE stmt FROM f1();
+ERROR 42000: PREPARE..FROM does not support subqueries or stored functions
+DROP FUNCTION f1;
+EXECUTE IMMEDIATE non_existent();
+ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions
+#
+# Testing literals in prepare source
+#
+EXECUTE IMMEDIATE N'SELECT 1 AS c';
+c
+1
+EXECUTE IMMEDIATE _latin1'SELECT 1 AS c';
+c
+1
+EXECUTE IMMEDIATE 'SELECT ' '1' ' AS c' ' FROM ' 'DUAL';
+c
+1
+EXECUTE IMMEDIATE 0x53454C4543542031 /*This is 'SELECT 1'*/;
+1
+1
+#
+# Testing user variables in prepare source
+#
+SET @stmt='SELECT 1 AS c FROM DUAL';
+EXECUTE IMMEDIATE @stmt;
+c
+1
+PREPARE stmt FROM @stmt;
+EXECUTE stmt;
+c
+1
+DEALLOCATE PREPARE stmt;
+SET @table_name='DUAL';
+EXECUTE IMMEDIATE CONCAT('SELECT 1 AS a FROM ', @table_name);
+a
+1
+PREPARE stmt FROM CONCAT('SELECT 1 AS a FROM ', @table_name);
+EXECUTE stmt;
+a
+1
+DEALLOCATE PREPARE stmt;
+#
+# Testing SP parameters and variables in prepare source
+#
+CREATE PROCEDURE p1(table_name VARCHAR(64))
+BEGIN
+EXECUTE IMMEDIATE CONCAT('SELECT 1 AS c FROM ', table_name);
+END;
+$$
+CALL p1('DUAL');
+c
+1
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE table_name VARCHAR(64) DEFAULT 'DUAL';
+EXECUTE IMMEDIATE CONCAT('SELECT 1 AS c FROM ', table_name);
+END;
+$$
+CALL p1();
+c
+1
+DROP PROCEDURE p1;
+#
+# Testing complex expressions
+#
+EXECUTE IMMEDIATE CONVERT('SELECT 1 AS c' USING utf8);
+c
+1
+EXECUTE IMMEDIATE CAST('SELECT 1 AS c' AS CHAR);
+c
+1
+EXECUTE IMMEDIATE _latin1'SELECT 1 AS c' COLLATE latin1_bin;
+c
+1
+EXECUTE IMMEDIATE (((('SELECT 1 AS c'))));
+c
+1
+EXECUTE IMMEDIATE CASE WHEN 1>2 THEN 'SELECT 1 AS c' ELSE 'SELECT 2 AS c' END;
+c
+2
+EXECUTE IMMEDIATE TRIM('SELECT 1 AS c');
+c
+1
+EXECUTE IMMEDIATE SUBSTRING('SELECT 1 AS c' FROM 1);
+c
+1
+EXECUTE IMMEDIATE COALESCE(NULL, 'SELECT 1 AS c');
+c
+1
+#
+# Testing SET STATEMENT and system variables
+#
+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;
+a
+1025
+DROP TABLE t1;
+#
+# End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions
+#
+#
+# End of 10.2 tests
+#
+#
+# MDEV-11360 Dynamic SQL: DEFAULT as a bind parameter
+#
+CREATE TABLE t1 (a INT DEFAULT 10, b INT DEFAULT NULL);
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?,?)' USING DEFAULT, DEFAULT;
+SELECT * FROM t1;
+a b
+10 NULL
+UPDATE t1 SET a=20, b=30;
+SELECT * FROM t1;
+a b
+20 30
+EXECUTE IMMEDIATE 'UPDATE t1 SET a=?,b=?' USING DEFAULT, DEFAULT;
+SELECT * FROM t1;
+a b
+10 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a INT DEFAULT 10);
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?+1)' USING DEFAULT;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (CONCAT(?,?))' USING DEFAULT, 'test';
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+DROP TABLE t1;
+CREATE TABLE t1 (a INT DEFAULT 10);
+INSERT INTO t1 VALUES (20);
+EXECUTE IMMEDIATE 'UPDATE t1 SET a=?+1' USING DEFAULT;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'UPDATE t1 SET a=CONCAT(?,?)' USING DEFAULT, 'test';
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+DROP TABLE t1;
+EXECUTE IMMEDIATE 'SELECT CAST(? AS SIGNED)' USING DEFAULT;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT CAST(? AS DOUBLE)' USING DEFAULT;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT CAST(? AS CHAR)' USING DEFAULT;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT CAST(? AS DECIMAL(10,1))' USING DEFAULT;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT CAST(? AS TIME)' USING DEFAULT;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT CAST(? AS DATE)' USING DEFAULT;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT CAST(? AS DATETIME)' USING DEFAULT;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT ?+1' USING DEFAULT;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT CONCAT(?,?)' USING DEFAULT,'test';
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT 1 LIMIT ?' USING DEFAULT;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+CREATE TABLE t1 (a INT DEFAULT 10);
+INSERT INTO t1 VALUES (1),(2),(3);
+EXECUTE IMMEDIATE 'SELECT * FROM t1 LIMIT ?' USING DEFAULT;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+DROP TABLE t1;
+# The output of this query in 'Note' is a syntactically incorrect query.
+# But as it's never logged, it's ok. It should be human readable only.
+EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT ?' USING DEFAULT;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select default AS `?`
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING DEFAULT,DEFAULT;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+DROP TABLE t1;
+#
+# MDEV-11780 Crash with PREPARE + SP out parameter + literal
+#
+CREATE OR REPLACE PROCEDURE p1(OUT a INT)
+BEGIN
+SET a=10;
+END;
+$$
+PREPARE stmt FROM 'CALL p1(?)';
+EXECUTE stmt USING 10;
+ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger
+EXECUTE stmt USING DEFAULT;
+ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger
+EXECUTE stmt USING IGNORE;
+ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger
+DEALLOCATE PREPARE stmt;
+EXECUTE IMMEDIATE 'CALL p1(?)' USING 10;
+ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger
+EXECUTE IMMEDIATE 'CALL p1(?)' USING DEFAULT;
+ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger
+EXECUTE IMMEDIATE 'CALL p1(?)' USING IGNORE;
+ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger
+DROP PROCEDURE p1;
+#
+# MDEV-14434 Wrong result for CHARSET(CONCAT(?,const))
+#
+SET NAMES utf8;
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(5,_latin1'a'))";
+CHARSET(CONCAT(5,_latin1'a'))
+latin1
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5;
+CHARSET(CONCAT(?,_latin1'a'))
+latin1
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5;
+CHARSET(CONCAT(?,_latin1'a'))
+latin1
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5e0;
+CHARSET(CONCAT(?,_latin1'a'))
+latin1
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIME'10:20:30';
+CHARSET(CONCAT(?,_latin1'a'))
+latin1
+EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIMESTAMP'2001-01-01 10:20:30';
+CHARSET(CONCAT(?,_latin1'a'))
+latin1
+EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5;
+COERCIBILITY(?)
+5
+EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5;
+COERCIBILITY(?)
+5
+EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5e0;
+COERCIBILITY(?)
+5
+EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIME'10:20:30';
+COERCIBILITY(?)
+5
+EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30';
+COERCIBILITY(?)
+5
+#
+# MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL
+#
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned DEFAULT NULL,
+ `b` bigint(20) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned DEFAULT NULL,
+ `b` bigint(20) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned DEFAULT NULL,
+ `b` bigint(20) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+DROP PROCEDURE p1;
+#
+# MDEV-14426 Assertion in Diagnostics_area::set_error_status when using a bad datetime with PS and SP
+#
+CREATE PROCEDURE p1(OUT a VARCHAR(20))
+BEGIN
+SET a=10;
+END;
+$$
+BEGIN NOT ATOMIC
+DECLARE a DATETIME;
+CALL p1(a);
+END;
+$$
+ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1
+BEGIN NOT ATOMIC
+DECLARE a DATETIME;
+EXECUTE IMMEDIATE 'CALL p1(?)' USING a;
+END;
+$$
+ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1
+BEGIN NOT ATOMIC
+DECLARE a DATETIME;
+PREPARE stmt FROM 'CALL p1(?)';
+EXECUTE stmt USING a;
+DEALLOCATE PREPARE stmt;
+END;
+$$
+ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1
+DROP PROCEDURE p1;
+#
+# MDEV-14603 signal 11 with short stacktrace
+#
+SET NAMES utf8;
+CREATE TABLE t1(i INT);
+CREATE PROCEDURE p1(tn VARCHAR(32))
+EXECUTE IMMEDIATE CONCAT('ANALYZE TABLE ',tn);
+CALL p1('t1');
+Table Op Msg_type Msg_text
+test.t1 analyze status Table is already up to date
+DROP PROCEDURE p1;
+DROP TABLE t1;
+SET NAMES utf8;
+CREATE PROCEDURE p1()
+EXECUTE IMMEDIATE CONCAT('SELECT ',CONVERT(RAND() USING latin1));
+CALL p1();
+DROP PROCEDURE p1;
+SET NAMES utf8;
+CREATE PROCEDURE p1()
+BEGIN
+PREPARE stmt FROM CONCAT('SELECT ',CONVERT(RAND() USING latin1));
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+END;
+$$
+CALL p1();
+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));
+CALL p1('x');
+DROP PROCEDURE p1;
+SET NAMES utf8;
+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;
+$$
+CALL p1('x');
+DROP PROCEDURE p1;
+create table t1 (b blob default '');
+prepare stmt from "alter table t1 force";
+execute stmt;
+execute stmt;
+execute stmt;
+set names latin1;
+prepare stmt from "alter table t1 modify b text character set utf8 default 'a'";
+execute stmt;
+execute stmt;
+execute stmt;
+drop table t1;
diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result
index f54020c44d4..fef15b89f26 100644
--- a/mysql-test/r/ps_1general.result
+++ b/mysql-test/r/ps_1general.result
@@ -309,7 +309,7 @@ Threads_running #
prepare stmt4 from ' show variables like ''sql_mode'' ';
execute stmt4;
Variable_name Value
-sql_mode NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
prepare stmt4 from ' show engine myisam logs ';
execute stmt4;
Type Name Status
@@ -444,15 +444,15 @@ prepare stmt1 from ' explain select a from t1 order by b ';
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 Y 32928 0 63
-def select_type 253 19 6 N 1 31 8
-def table 253 64 2 Y 0 31 8
-def type 253 10 3 Y 0 31 8
-def possible_keys 253 4_OR_8_K 0 Y 0 31 8
-def key 253 64 0 Y 0 31 8
-def key_len 253 4_OR_8_K 0 Y 0 31 8
-def ref 253 2048 0 Y 0 31 8
+def select_type 253 19 6 N 1 39 8
+def table 253 64 2 Y 0 39 8
+def type 253 10 3 Y 0 39 8
+def possible_keys 253 4_OR_8_K 0 Y 0 39 8
+def key 253 64 0 Y 0 39 8
+def key_len 253 4_OR_8_K 0 Y 0 39 8
+def ref 253 2048 0 Y 0 39 8
def rows 8 10 1 Y 32928 0 63
-def Extra 253 255 14 N 1 31 8
+def Extra 253 255 14 N 1 39 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
SET @arg00=1 ;
@@ -460,15 +460,15 @@ prepare stmt1 from ' explain select a from t1 where a > ? order by b ';
execute stmt1 using @arg00;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 Y 32928 0 63
-def select_type 253 19 6 N 1 31 8
-def table 253 64 2 Y 0 31 8
-def type 253 10 5 Y 0 31 8
-def possible_keys 253 4_OR_8_K 7 Y 0 31 8
-def key 253 64 7 Y 0 31 8
-def key_len 253 4_OR_8_K 1 Y 0 31 8
-def ref 253 2048 0 Y 0 31 8
+def select_type 253 19 6 N 1 39 8
+def table 253 64 2 Y 0 39 8
+def type 253 10 5 Y 0 39 8
+def possible_keys 253 4_OR_8_K 7 Y 0 39 8
+def key 253 64 7 Y 0 39 8
+def key_len 253 4_OR_8_K 1 Y 0 39 8
+def ref 253 2048 0 Y 0 39 8
def rows 8 10 1 Y 32928 0 63
-def Extra 253 255 37 N 1 31 8
+def Extra 253 255 37 N 1 39 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using index condition; Using filesort
drop table if exists t2;
diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result
index 6d7544deb4e..127fb4c7124 100644
--- a/mysql-test/r/ps_2myisam.result
+++ b/mysql-test/r/ps_2myisam.result
@@ -1154,15 +1154,15 @@ prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 Y 32928 0 63
-def select_type 253 19 6 N 1 31 8
-def table 253 64 2 Y 0 31 8
-def type 253 10 3 Y 0 31 8
-def possible_keys 253 4_OR_8_K 0 Y 0 31 8
-def key 253 64 0 Y 0 31 8
-def key_len 253 4_OR_8_K 0 Y 0 31 8
-def ref 253 2048 0 Y 0 31 8
+def select_type 253 19 6 N 1 39 8
+def table 253 64 2 Y 0 39 8
+def type 253 10 3 Y 0 39 8
+def possible_keys 253 4_OR_8_K 0 Y 0 39 8
+def key 253 64 0 Y 0 39 8
+def key_len 253 4_OR_8_K 0 Y 0 39 8
+def ref 253 2048 0 Y 0 39 8
def rows 8 10 1 Y 32928 0 63
-def Extra 253 255 0 N 1 31 8
+def Extra 253 255 0 N 1 39 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
drop table if exists t2 ;
@@ -1303,9 +1303,11 @@ a b
2 two
set @arg00=NULL;
set @arg01=2;
+set sql_mode = '';
execute stmt1 using @arg00, @arg01;
Warnings:
Warning 1048 Column 'a' cannot be null
+set sql_mode = default;
select a,b from t1 order by a;
a b
0 two
@@ -1779,42 +1781,42 @@ t5 CREATE TABLE `t5` (
`const01` int(1) NOT NULL,
`param01` bigint(20) DEFAULT NULL,
`const02` decimal(2,1) NOT NULL,
- `param02` decimal(65,30) DEFAULT NULL,
+ `param02` decimal(65,38) DEFAULT NULL,
`const03` double NOT NULL,
`param03` double DEFAULT NULL,
`const04` varchar(3) NOT NULL,
- `param04` longtext,
- `const05` varbinary(3) NOT NULL,
- `param05` longblob,
+ `param04` longtext DEFAULT NULL,
+ `const05` varbinary(3) DEFAULT NULL,
+ `param05` longblob DEFAULT NULL,
`const06` varchar(10) NOT NULL,
- `param06` longtext,
+ `param06` longtext DEFAULT NULL,
`const07` date DEFAULT NULL,
- `param07` longtext,
+ `param07` longtext DEFAULT NULL,
`const08` varchar(19) NOT NULL,
- `param08` longtext,
+ `param08` longtext DEFAULT NULL,
`const09` datetime DEFAULT NULL,
- `param09` longtext,
+ `param09` longtext DEFAULT NULL,
`const10` bigint(17) DEFAULT NULL,
`param10` bigint(20) DEFAULT NULL,
`const11` int(4) DEFAULT NULL,
`param11` bigint(20) DEFAULT NULL,
`const12` binary(0) DEFAULT NULL,
`param12` bigint(20) DEFAULT NULL,
- `param13` decimal(65,30) DEFAULT NULL,
- `param14` longtext,
- `param15` longblob
+ `param13` decimal(65,38) DEFAULT NULL,
+ `param14` longtext DEFAULT NULL,
+ `param15` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 3 1 1 N 36865 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
def test t5 t5 const02 const02 246 4 3 N 36865 1 63
-def test t5 t5 param02 param02 246 67 32 Y 32768 30 63
+def test t5 t5 param02 param02 246 67 40 Y 32768 38 63
def test t5 t5 const03 const03 5 17 1 N 36865 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
def test t5 t5 const04 const04 253 3 3 N 4097 0 8
def test t5 t5 param04 param04 252 4294967295 3 Y 16 0 8
-def test t5 t5 const05 const05 253 3 3 N 4225 0 63
+def test t5 t5 const05 const05 253 3 3 Y 128 0 63
def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63
def test t5 t5 const06 const06 253 10 10 N 4097 0 8
def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8
@@ -1830,13 +1832,13 @@ def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
-def test t5 t5 param13 param13 246 67 0 Y 32768 30 63
+def test t5 t5 param13 param13 246 67 0 Y 32768 38 63
def test t5 t5 param14 param14 252 4294967295 0 Y 16 0 8
def test t5 t5 param15 param15 252 4294967295 0 Y 144 0 63
const01 8
param01 8
const02 8.0
-param02 8.000000000000000000000000000000
+param02 8.00000000000000000000000000000000000000
const03 8
param03 8
const04 abc
@@ -1928,28 +1930,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 128 31 63
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 128 31 63
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 128 31 63
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 128 31 63
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 128 39 63
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 128 39 63
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 128 39 63
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 128 39 63
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@@ -1975,28 +1977,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 128 31 63
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 128 31 63
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 128 31 63
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 128 31 63
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 128 39 63
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 128 39 63
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 128 39 63
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 128 39 63
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2025,28 +2027,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 128 31 63
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 128 31 63
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 128 31 63
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 128 31 63
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 128 39 63
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 128 39 63
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 128 39 63
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 128 39 63
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2065,28 +2067,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 128 31 63
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 128 31 63
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 128 31 63
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 128 31 63
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 128 39 63
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 128 39 63
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 128 39 63
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 128 39 63
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2113,28 +2115,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 128 31 63
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 128 31 63
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 128 31 63
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 128 31 63
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 128 39 63
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 128 39 63
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 128 39 63
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 128 39 63
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2157,28 +2159,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 128 31 63
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 128 31 63
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 128 31 63
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 128 31 63
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 128 39 63
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 128 39 63
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 128 39 63
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 128 39 63
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2203,28 +2205,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 128 31 63
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 128 31 63
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 128 31 63
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 128 31 63
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 128 39 63
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 128 39 63
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 128 39 63
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 128 39 63
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2241,28 +2243,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 128 31 63
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 128 31 63
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 128 31 63
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 128 31 63
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 128 39 63
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 128 39 63
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 128 39 63
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 128 39 63
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -2570,6 +2572,7 @@ prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
from t9 where c21 = 'O' ";
prepare my_delete from "delete from t9 where c21 = 'O' ";
set @arg00= 9223372036854775807 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2593,6 +2596,7 @@ c10 9.223372036854776e18
c12 9999.9999
execute my_delete ;
set @arg00= '9223372036854775807' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2616,6 +2620,7 @@ c10 9.223372036854776e18
c12 9999.9999
execute my_delete ;
set @arg00= -9223372036854775808 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2639,6 +2644,7 @@ c10 -9.223372036854776e18
c12 -9999.9999
execute my_delete ;
set @arg00= '-9223372036854775808' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2662,6 +2668,7 @@ c10 -9.223372036854776e18
c12 -9999.9999
execute my_delete ;
set @arg00= 1.11111111111111111111e+50 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2687,6 +2694,7 @@ c10 1.111111111111111e50
c12 9999.9999
execute my_delete ;
set @arg00= '1.11111111111111111111e+50' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2712,6 +2720,7 @@ c10 1.111111111111111e50
c12 9999.9999
execute my_delete ;
set @arg00= -1.11111111111111111111e+50 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2737,6 +2746,7 @@ c10 -1.111111111111111e50
c12 -9999.9999
execute my_delete ;
set @arg00= '-1.11111111111111111111e+50' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2763,6 +2773,7 @@ c12 -9999.9999
execute my_delete ;
test_sequence
-- insert into string columns --
+set sql_mode = '';
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
@@ -2921,6 +2932,7 @@ execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
+set sql_mode = default;
set @arg00= 'abc' ;
set @arg00= NULL ;
insert into t9
@@ -3127,6 +3139,7 @@ true
delete from t9 ;
test_sequence
-- insert into date/time columns --
+set sql_mode = '';
set @arg00= '1991-01-01 01:01:01' ;
insert into t9
( c1, c13, c14, c15, c16, c17 )
@@ -3285,6 +3298,7 @@ Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
+set sql_mode = default;
set @arg00= 'abc' ;
set @arg00= NULL ;
insert into t9
diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result
index a22135d30c0..d341323b0b2 100644
--- a/mysql-test/r/ps_3innodb.result
+++ b/mysql-test/r/ps_3innodb.result
@@ -1154,15 +1154,15 @@ prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 Y 32928 0 63
-def select_type 253 19 6 N 1 31 8
-def table 253 64 2 Y 0 31 8
-def type 253 10 3 Y 0 31 8
-def possible_keys 253 4_OR_8_K 0 Y 0 31 8
-def key 253 64 0 Y 0 31 8
-def key_len 253 4_OR_8_K 0 Y 0 31 8
-def ref 253 2048 0 Y 0 31 8
+def select_type 253 19 6 N 1 39 8
+def table 253 64 2 Y 0 39 8
+def type 253 10 3 Y 0 39 8
+def possible_keys 253 4_OR_8_K 0 Y 0 39 8
+def key 253 64 0 Y 0 39 8
+def key_len 253 4_OR_8_K 0 Y 0 39 8
+def ref 253 2048 0 Y 0 39 8
def rows 8 10 1 Y 32928 0 63
-def Extra 253 255 0 N 1 31 8
+def Extra 253 255 0 N 1 39 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
test_sequence
@@ -1286,9 +1286,11 @@ a b
2 two
set @arg00=NULL;
set @arg01=2;
+set sql_mode = '';
execute stmt1 using @arg00, @arg01;
Warnings:
Warning 1048 Column 'a' cannot be null
+set sql_mode = default;
select a,b from t1 order by a;
a b
0 two
@@ -1762,42 +1764,42 @@ t5 CREATE TABLE `t5` (
`const01` int(1) NOT NULL,
`param01` bigint(20) DEFAULT NULL,
`const02` decimal(2,1) NOT NULL,
- `param02` decimal(65,30) DEFAULT NULL,
+ `param02` decimal(65,38) DEFAULT NULL,
`const03` double NOT NULL,
`param03` double DEFAULT NULL,
`const04` varchar(3) NOT NULL,
- `param04` longtext,
- `const05` varbinary(3) NOT NULL,
- `param05` longblob,
+ `param04` longtext DEFAULT NULL,
+ `const05` varbinary(3) DEFAULT NULL,
+ `param05` longblob DEFAULT NULL,
`const06` varchar(10) NOT NULL,
- `param06` longtext,
+ `param06` longtext DEFAULT NULL,
`const07` date DEFAULT NULL,
- `param07` longtext,
+ `param07` longtext DEFAULT NULL,
`const08` varchar(19) NOT NULL,
- `param08` longtext,
+ `param08` longtext DEFAULT NULL,
`const09` datetime DEFAULT NULL,
- `param09` longtext,
+ `param09` longtext DEFAULT NULL,
`const10` bigint(17) DEFAULT NULL,
`param10` bigint(20) DEFAULT NULL,
`const11` int(4) DEFAULT NULL,
`param11` bigint(20) DEFAULT NULL,
`const12` binary(0) DEFAULT NULL,
`param12` bigint(20) DEFAULT NULL,
- `param13` decimal(65,30) DEFAULT NULL,
- `param14` longtext,
- `param15` longblob
+ `param13` decimal(65,38) DEFAULT NULL,
+ `param14` longtext DEFAULT NULL,
+ `param15` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 3 1 1 N 36865 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
def test t5 t5 const02 const02 246 4 3 N 36865 1 63
-def test t5 t5 param02 param02 246 67 32 Y 32768 30 63
+def test t5 t5 param02 param02 246 67 40 Y 32768 38 63
def test t5 t5 const03 const03 5 17 1 N 36865 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
def test t5 t5 const04 const04 253 3 3 N 4097 0 8
def test t5 t5 param04 param04 252 4294967295 3 Y 16 0 8
-def test t5 t5 const05 const05 253 3 3 N 4225 0 63
+def test t5 t5 const05 const05 253 3 3 Y 128 0 63
def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63
def test t5 t5 const06 const06 253 10 10 N 4097 0 8
def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8
@@ -1813,13 +1815,13 @@ def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
-def test t5 t5 param13 param13 246 67 0 Y 32768 30 63
+def test t5 t5 param13 param13 246 67 0 Y 32768 38 63
def test t5 t5 param14 param14 252 4294967295 0 Y 16 0 8
def test t5 t5 param15 param15 252 4294967295 0 Y 144 0 63
const01 8
param01 8
const02 8.0
-param02 8.000000000000000000000000000000
+param02 8.00000000000000000000000000000000000000
const03 8
param03 8
const04 abc
@@ -1911,28 +1913,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 128 31 63
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 128 31 63
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 128 31 63
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 128 31 63
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 128 39 63
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 128 39 63
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 128 39 63
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 128 39 63
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@@ -1958,28 +1960,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 128 31 63
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 128 31 63
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 128 31 63
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 128 31 63
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 128 39 63
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 128 39 63
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 128 39 63
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 128 39 63
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2008,28 +2010,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 128 31 63
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 128 31 63
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 128 31 63
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 128 31 63
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 128 39 63
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 128 39 63
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 128 39 63
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 128 39 63
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2048,28 +2050,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 128 31 63
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 128 31 63
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 128 31 63
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 128 31 63
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 128 39 63
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 128 39 63
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 128 39 63
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 128 39 63
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2096,28 +2098,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 128 31 63
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 128 31 63
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 128 31 63
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 128 31 63
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 128 39 63
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 128 39 63
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 128 39 63
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 128 39 63
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2140,28 +2142,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 128 31 63
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 128 31 63
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 128 31 63
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 128 31 63
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 128 39 63
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 128 39 63
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 128 39 63
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 128 39 63
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2186,28 +2188,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 128 31 63
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 128 31 63
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 128 31 63
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 128 31 63
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 128 39 63
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 128 39 63
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 128 39 63
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 128 39 63
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2224,28 +2226,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 128 31 63
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 128 31 63
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 128 31 63
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 128 31 63
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 128 39 63
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 128 39 63
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 128 39 63
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 128 39 63
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -2553,6 +2555,7 @@ prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
from t9 where c21 = 'O' ";
prepare my_delete from "delete from t9 where c21 = 'O' ";
set @arg00= 9223372036854775807 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2576,6 +2579,7 @@ c10 9.223372036854776e18
c12 9999.9999
execute my_delete ;
set @arg00= '9223372036854775807' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2599,6 +2603,7 @@ c10 9.223372036854776e18
c12 9999.9999
execute my_delete ;
set @arg00= -9223372036854775808 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2622,6 +2627,7 @@ c10 -9.223372036854776e18
c12 -9999.9999
execute my_delete ;
set @arg00= '-9223372036854775808' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2645,6 +2651,7 @@ c10 -9.223372036854776e18
c12 -9999.9999
execute my_delete ;
set @arg00= 1.11111111111111111111e+50 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2670,6 +2677,7 @@ c10 1.111111111111111e50
c12 9999.9999
execute my_delete ;
set @arg00= '1.11111111111111111111e+50' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2695,6 +2703,7 @@ c10 1.111111111111111e50
c12 9999.9999
execute my_delete ;
set @arg00= -1.11111111111111111111e+50 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2720,6 +2729,7 @@ c10 -1.111111111111111e50
c12 -9999.9999
execute my_delete ;
set @arg00= '-1.11111111111111111111e+50' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2746,6 +2756,7 @@ c12 -9999.9999
execute my_delete ;
test_sequence
-- insert into string columns --
+set sql_mode = '';
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
@@ -2904,6 +2915,7 @@ execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
+set sql_mode = default;
set @arg00= 'abc' ;
set @arg00= NULL ;
insert into t9
@@ -3110,6 +3122,7 @@ true
delete from t9 ;
test_sequence
-- insert into date/time columns --
+set sql_mode = '';
set @arg00= '1991-01-01 01:01:01' ;
insert into t9
( c1, c13, c14, c15, c16, c17 )
@@ -3268,6 +3281,7 @@ Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
+set sql_mode = default;
set @arg00= 'abc' ;
set @arg00= NULL ;
insert into t9
diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result
index bbdb3ea7b23..ea3cf21e804 100644
--- a/mysql-test/r/ps_4heap.result
+++ b/mysql-test/r/ps_4heap.result
@@ -1155,15 +1155,15 @@ prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 Y 32928 0 63
-def select_type 253 19 6 N 1 31 8
-def table 253 64 2 Y 0 31 8
-def type 253 10 3 Y 0 31 8
-def possible_keys 253 4_OR_8_K 0 Y 0 31 8
-def key 253 64 0 Y 0 31 8
-def key_len 253 4_OR_8_K 0 Y 0 31 8
-def ref 253 2048 0 Y 0 31 8
+def select_type 253 19 6 N 1 39 8
+def table 253 64 2 Y 0 39 8
+def type 253 10 3 Y 0 39 8
+def possible_keys 253 4_OR_8_K 0 Y 0 39 8
+def key 253 64 0 Y 0 39 8
+def key_len 253 4_OR_8_K 0 Y 0 39 8
+def ref 253 2048 0 Y 0 39 8
def rows 8 10 1 Y 32928 0 63
-def Extra 253 255 0 N 1 31 8
+def Extra 253 255 0 N 1 39 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
test_sequence
@@ -1287,9 +1287,11 @@ a b
2 two
set @arg00=NULL;
set @arg01=2;
+set sql_mode = '';
execute stmt1 using @arg00, @arg01;
Warnings:
Warning 1048 Column 'a' cannot be null
+set sql_mode = default;
select a,b from t1 order by a;
a b
0 two
@@ -1763,42 +1765,42 @@ t5 CREATE TABLE `t5` (
`const01` int(1) NOT NULL,
`param01` bigint(20) DEFAULT NULL,
`const02` decimal(2,1) NOT NULL,
- `param02` decimal(65,30) DEFAULT NULL,
+ `param02` decimal(65,38) DEFAULT NULL,
`const03` double NOT NULL,
`param03` double DEFAULT NULL,
`const04` varchar(3) NOT NULL,
- `param04` longtext,
- `const05` varbinary(3) NOT NULL,
- `param05` longblob,
+ `param04` longtext DEFAULT NULL,
+ `const05` varbinary(3) DEFAULT NULL,
+ `param05` longblob DEFAULT NULL,
`const06` varchar(10) NOT NULL,
- `param06` longtext,
+ `param06` longtext DEFAULT NULL,
`const07` date DEFAULT NULL,
- `param07` longtext,
+ `param07` longtext DEFAULT NULL,
`const08` varchar(19) NOT NULL,
- `param08` longtext,
+ `param08` longtext DEFAULT NULL,
`const09` datetime DEFAULT NULL,
- `param09` longtext,
+ `param09` longtext DEFAULT NULL,
`const10` bigint(17) DEFAULT NULL,
`param10` bigint(20) DEFAULT NULL,
`const11` int(4) DEFAULT NULL,
`param11` bigint(20) DEFAULT NULL,
`const12` binary(0) DEFAULT NULL,
`param12` bigint(20) DEFAULT NULL,
- `param13` decimal(65,30) DEFAULT NULL,
- `param14` longtext,
- `param15` longblob
+ `param13` decimal(65,38) DEFAULT NULL,
+ `param14` longtext DEFAULT NULL,
+ `param15` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 3 1 1 N 36865 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
def test t5 t5 const02 const02 246 4 3 N 36865 1 63
-def test t5 t5 param02 param02 246 67 32 Y 32768 30 63
+def test t5 t5 param02 param02 246 67 40 Y 32768 38 63
def test t5 t5 const03 const03 5 17 1 N 36865 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
def test t5 t5 const04 const04 253 3 3 N 4097 0 8
def test t5 t5 param04 param04 252 4294967295 3 Y 16 0 8
-def test t5 t5 const05 const05 253 3 3 N 4225 0 63
+def test t5 t5 const05 const05 253 3 3 Y 128 0 63
def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63
def test t5 t5 const06 const06 253 10 10 N 4097 0 8
def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8
@@ -1814,13 +1816,13 @@ def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
-def test t5 t5 param13 param13 246 67 0 Y 32768 30 63
+def test t5 t5 param13 param13 246 67 0 Y 32768 38 63
def test t5 t5 param14 param14 252 4294967295 0 Y 16 0 8
def test t5 t5 param15 param15 252 4294967295 0 Y 144 0 63
const01 8
param01 8
const02 8.0
-param02 8.000000000000000000000000000000
+param02 8.00000000000000000000000000000000000000
const03 8
param03 8
const04 abc
@@ -1912,28 +1914,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 0 31 8
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 0 31 8
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 0 31 8
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 0 31 8
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 0 39 8
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 0 39 8
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 0 39 8
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 0 39 8
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@@ -1959,28 +1961,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 0 31 8
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 0 31 8
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 0 31 8
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 0 31 8
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 0 39 8
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 0 39 8
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 0 39 8
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 0 39 8
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2009,28 +2011,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 0 31 8
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 0 31 8
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 0 31 8
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 0 31 8
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 0 39 8
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 0 39 8
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 0 39 8
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 0 39 8
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2049,28 +2051,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 0 31 8
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 0 31 8
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 0 31 8
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 0 31 8
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 0 39 8
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 0 39 8
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 0 39 8
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 0 39 8
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2097,28 +2099,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 0 31 8
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 0 31 8
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 0 31 8
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 0 31 8
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 0 39 8
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 0 39 8
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 0 39 8
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 0 39 8
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2141,28 +2143,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 0 31 8
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 0 31 8
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 0 31 8
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 0 31 8
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 0 39 8
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 0 39 8
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 0 39 8
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 0 39 8
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2187,28 +2189,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 0 31 8
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 0 31 8
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 0 31 8
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 0 31 8
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 0 39 8
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 0 39 8
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 0 39 8
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 0 39 8
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2225,28 +2227,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 0 31 8
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 0 31 8
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 0 31 8
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 0 31 8
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 0 39 8
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 0 39 8
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 0 39 8
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 0 39 8
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -2554,6 +2556,7 @@ prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
from t9 where c21 = 'O' ";
prepare my_delete from "delete from t9 where c21 = 'O' ";
set @arg00= 9223372036854775807 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2577,6 +2580,7 @@ c10 9.223372036854776e18
c12 9999.9999
execute my_delete ;
set @arg00= '9223372036854775807' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2600,6 +2604,7 @@ c10 9.223372036854776e18
c12 9999.9999
execute my_delete ;
set @arg00= -9223372036854775808 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2623,6 +2628,7 @@ c10 -9.223372036854776e18
c12 -9999.9999
execute my_delete ;
set @arg00= '-9223372036854775808' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2646,6 +2652,7 @@ c10 -9.223372036854776e18
c12 -9999.9999
execute my_delete ;
set @arg00= 1.11111111111111111111e+50 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2671,6 +2678,7 @@ c10 1.111111111111111e50
c12 9999.9999
execute my_delete ;
set @arg00= '1.11111111111111111111e+50' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2696,6 +2704,7 @@ c10 1.111111111111111e50
c12 9999.9999
execute my_delete ;
set @arg00= -1.11111111111111111111e+50 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2721,6 +2730,7 @@ c10 -1.111111111111111e50
c12 -9999.9999
execute my_delete ;
set @arg00= '-1.11111111111111111111e+50' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2747,6 +2757,7 @@ c12 -9999.9999
execute my_delete ;
test_sequence
-- insert into string columns --
+set sql_mode = '';
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
@@ -2905,6 +2916,7 @@ execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
+set sql_mode = default;
set @arg00= 'abc' ;
set @arg00= NULL ;
insert into t9
@@ -3111,6 +3123,7 @@ true
delete from t9 ;
test_sequence
-- insert into date/time columns --
+set sql_mode = '';
set @arg00= '1991-01-01 01:01:01' ;
insert into t9
( c1, c13, c14, c15, c16, c17 )
@@ -3269,6 +3282,7 @@ Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
+set sql_mode = default;
set @arg00= 'abc' ;
set @arg00= NULL ;
insert into t9
diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result
index 0262c52d948..4c4aaa325aa 100644
--- a/mysql-test/r/ps_5merge.result
+++ b/mysql-test/r/ps_5merge.result
@@ -1198,15 +1198,15 @@ prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 Y 32928 0 63
-def select_type 253 19 6 N 1 31 8
-def table 253 64 2 Y 0 31 8
-def type 253 10 3 Y 0 31 8
-def possible_keys 253 4_OR_8_K 0 Y 0 31 8
-def key 253 64 0 Y 0 31 8
-def key_len 253 4_OR_8_K 0 Y 0 31 8
-def ref 253 2048 0 Y 0 31 8
+def select_type 253 19 6 N 1 39 8
+def table 253 64 2 Y 0 39 8
+def type 253 10 3 Y 0 39 8
+def possible_keys 253 4_OR_8_K 0 Y 0 39 8
+def key 253 64 0 Y 0 39 8
+def key_len 253 4_OR_8_K 0 Y 0 39 8
+def ref 253 2048 0 Y 0 39 8
def rows 8 10 1 Y 32928 0 63
-def Extra 253 255 0 N 1 31 8
+def Extra 253 255 0 N 1 39 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
test_sequence
@@ -1330,9 +1330,11 @@ a b
2 two
set @arg00=NULL;
set @arg01=2;
+set sql_mode = '';
execute stmt1 using @arg00, @arg01;
Warnings:
Warning 1048 Column 'a' cannot be null
+set sql_mode = default;
select a,b from t1 order by a;
a b
0 two
@@ -1700,42 +1702,42 @@ t5 CREATE TABLE `t5` (
`const01` int(1) NOT NULL,
`param01` bigint(20) DEFAULT NULL,
`const02` decimal(2,1) NOT NULL,
- `param02` decimal(65,30) DEFAULT NULL,
+ `param02` decimal(65,38) DEFAULT NULL,
`const03` double NOT NULL,
`param03` double DEFAULT NULL,
`const04` varchar(3) NOT NULL,
- `param04` longtext,
- `const05` varbinary(3) NOT NULL,
- `param05` longblob,
+ `param04` longtext DEFAULT NULL,
+ `const05` varbinary(3) DEFAULT NULL,
+ `param05` longblob DEFAULT NULL,
`const06` varchar(10) NOT NULL,
- `param06` longtext,
+ `param06` longtext DEFAULT NULL,
`const07` date DEFAULT NULL,
- `param07` longtext,
+ `param07` longtext DEFAULT NULL,
`const08` varchar(19) NOT NULL,
- `param08` longtext,
+ `param08` longtext DEFAULT NULL,
`const09` datetime DEFAULT NULL,
- `param09` longtext,
+ `param09` longtext DEFAULT NULL,
`const10` bigint(17) DEFAULT NULL,
`param10` bigint(20) DEFAULT NULL,
`const11` int(4) DEFAULT NULL,
`param11` bigint(20) DEFAULT NULL,
`const12` binary(0) DEFAULT NULL,
`param12` bigint(20) DEFAULT NULL,
- `param13` decimal(65,30) DEFAULT NULL,
- `param14` longtext,
- `param15` longblob
+ `param13` decimal(65,38) DEFAULT NULL,
+ `param14` longtext DEFAULT NULL,
+ `param15` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 3 1 1 N 36865 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
def test t5 t5 const02 const02 246 4 3 N 36865 1 63
-def test t5 t5 param02 param02 246 67 32 Y 32768 30 63
+def test t5 t5 param02 param02 246 67 40 Y 32768 38 63
def test t5 t5 const03 const03 5 17 1 N 36865 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
def test t5 t5 const04 const04 253 3 3 N 4097 0 8
def test t5 t5 param04 param04 252 4294967295 3 Y 16 0 8
-def test t5 t5 const05 const05 253 3 3 N 4225 0 63
+def test t5 t5 const05 const05 253 3 3 Y 128 0 63
def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63
def test t5 t5 const06 const06 253 10 10 N 4097 0 8
def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8
@@ -1751,13 +1753,13 @@ def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
-def test t5 t5 param13 param13 246 67 0 Y 32768 30 63
+def test t5 t5 param13 param13 246 67 0 Y 32768 38 63
def test t5 t5 param14 param14 252 4294967295 0 Y 16 0 8
def test t5 t5 param15 param15 252 4294967295 0 Y 144 0 63
const01 8
param01 8
const02 8.0
-param02 8.000000000000000000000000000000
+param02 8.00000000000000000000000000000000000000
const03 8
param03 8
const04 abc
@@ -1849,28 +1851,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 128 31 63
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 128 31 63
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 128 31 63
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 128 31 63
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 128 39 63
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 128 39 63
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 128 39 63
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 128 39 63
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@@ -1896,28 +1898,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 128 31 63
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 128 31 63
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 128 31 63
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 128 31 63
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 128 39 63
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 128 39 63
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 128 39 63
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 128 39 63
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -1946,28 +1948,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 128 31 63
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 128 31 63
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 128 31 63
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 128 31 63
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 128 39 63
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 128 39 63
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 128 39 63
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 128 39 63
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -1986,28 +1988,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 128 31 63
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 128 31 63
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 128 31 63
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 128 31 63
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 128 39 63
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 128 39 63
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 128 39 63
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 128 39 63
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2034,28 +2036,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 128 31 63
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 128 31 63
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 128 31 63
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 128 31 63
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 128 39 63
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 128 39 63
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 128 39 63
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 128 39 63
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2078,28 +2080,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 128 31 63
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 128 31 63
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 128 31 63
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 128 31 63
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 128 39 63
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 128 39 63
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 128 39 63
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 128 39 63
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2124,28 +2126,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 128 31 63
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 128 31 63
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 128 31 63
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 128 31 63
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 128 39 63
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 128 39 63
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 128 39 63
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 128 39 63
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2162,28 +2164,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 128 31 63
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 128 31 63
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 128 31 63
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 128 31 63
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 128 39 63
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 128 39 63
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 128 39 63
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 128 39 63
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -2491,6 +2493,7 @@ prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
from t9 where c21 = 'O' ";
prepare my_delete from "delete from t9 where c21 = 'O' ";
set @arg00= 9223372036854775807 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2514,6 +2517,7 @@ c10 9.223372036854776e18
c12 9999.9999
execute my_delete ;
set @arg00= '9223372036854775807' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2537,6 +2541,7 @@ c10 9.223372036854776e18
c12 9999.9999
execute my_delete ;
set @arg00= -9223372036854775808 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2560,6 +2565,7 @@ c10 -9.223372036854776e18
c12 -9999.9999
execute my_delete ;
set @arg00= '-9223372036854775808' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2583,6 +2589,7 @@ c10 -9.223372036854776e18
c12 -9999.9999
execute my_delete ;
set @arg00= 1.11111111111111111111e+50 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2608,6 +2615,7 @@ c10 1.111111111111111e50
c12 9999.9999
execute my_delete ;
set @arg00= '1.11111111111111111111e+50' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2633,6 +2641,7 @@ c10 1.111111111111111e50
c12 9999.9999
execute my_delete ;
set @arg00= -1.11111111111111111111e+50 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2658,6 +2667,7 @@ c10 -1.111111111111111e50
c12 -9999.9999
execute my_delete ;
set @arg00= '-1.11111111111111111111e+50' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -2684,6 +2694,7 @@ c12 -9999.9999
execute my_delete ;
test_sequence
-- insert into string columns --
+set sql_mode = '';
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
@@ -2842,6 +2853,7 @@ execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
+set sql_mode = default;
set @arg00= 'abc' ;
set @arg00= NULL ;
insert into t9
@@ -3048,6 +3060,7 @@ true
delete from t9 ;
test_sequence
-- insert into date/time columns --
+set sql_mode = '';
set @arg00= '1991-01-01 01:01:01' ;
insert into t9
( c1, c13, c14, c15, c16, c17 )
@@ -3206,6 +3219,7 @@ Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
+set sql_mode = default;
set @arg00= 'abc' ;
set @arg00= NULL ;
insert into t9
@@ -4552,15 +4566,15 @@ prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 Y 32928 0 63
-def select_type 253 19 6 N 1 31 8
-def table 253 64 2 Y 0 31 8
-def type 253 10 3 Y 0 31 8
-def possible_keys 253 4_OR_8_K 0 Y 0 31 8
-def key 253 64 0 Y 0 31 8
-def key_len 253 4_OR_8_K 0 Y 0 31 8
-def ref 253 2048 0 Y 0 31 8
+def select_type 253 19 6 N 1 39 8
+def table 253 64 2 Y 0 39 8
+def type 253 10 3 Y 0 39 8
+def possible_keys 253 4_OR_8_K 0 Y 0 39 8
+def key 253 64 0 Y 0 39 8
+def key_len 253 4_OR_8_K 0 Y 0 39 8
+def ref 253 2048 0 Y 0 39 8
def rows 8 10 1 Y 32928 0 63
-def Extra 253 255 0 N 1 31 8
+def Extra 253 255 0 N 1 39 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
test_sequence
@@ -4684,9 +4698,11 @@ a b
2 two
set @arg00=NULL;
set @arg01=2;
+set sql_mode = '';
execute stmt1 using @arg00, @arg01;
Warnings:
Warning 1048 Column 'a' cannot be null
+set sql_mode = default;
select a,b from t1 order by a;
a b
0 two
@@ -5054,42 +5070,42 @@ t5 CREATE TABLE `t5` (
`const01` int(1) NOT NULL,
`param01` bigint(20) DEFAULT NULL,
`const02` decimal(2,1) NOT NULL,
- `param02` decimal(65,30) DEFAULT NULL,
+ `param02` decimal(65,38) DEFAULT NULL,
`const03` double NOT NULL,
`param03` double DEFAULT NULL,
`const04` varchar(3) NOT NULL,
- `param04` longtext,
- `const05` varbinary(3) NOT NULL,
- `param05` longblob,
+ `param04` longtext DEFAULT NULL,
+ `const05` varbinary(3) DEFAULT NULL,
+ `param05` longblob DEFAULT NULL,
`const06` varchar(10) NOT NULL,
- `param06` longtext,
+ `param06` longtext DEFAULT NULL,
`const07` date DEFAULT NULL,
- `param07` longtext,
+ `param07` longtext DEFAULT NULL,
`const08` varchar(19) NOT NULL,
- `param08` longtext,
+ `param08` longtext DEFAULT NULL,
`const09` datetime DEFAULT NULL,
- `param09` longtext,
+ `param09` longtext DEFAULT NULL,
`const10` bigint(17) DEFAULT NULL,
`param10` bigint(20) DEFAULT NULL,
`const11` int(4) DEFAULT NULL,
`param11` bigint(20) DEFAULT NULL,
`const12` binary(0) DEFAULT NULL,
`param12` bigint(20) DEFAULT NULL,
- `param13` decimal(65,30) DEFAULT NULL,
- `param14` longtext,
- `param15` longblob
+ `param13` decimal(65,38) DEFAULT NULL,
+ `param14` longtext DEFAULT NULL,
+ `param15` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 3 1 1 N 36865 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
def test t5 t5 const02 const02 246 4 3 N 36865 1 63
-def test t5 t5 param02 param02 246 67 32 Y 32768 30 63
+def test t5 t5 param02 param02 246 67 40 Y 32768 38 63
def test t5 t5 const03 const03 5 17 1 N 36865 31 63
def test t5 t5 param03 param03 5 23 1 Y 32768 31 63
def test t5 t5 const04 const04 253 3 3 N 4097 0 8
def test t5 t5 param04 param04 252 4294967295 3 Y 16 0 8
-def test t5 t5 const05 const05 253 3 3 N 4225 0 63
+def test t5 t5 const05 const05 253 3 3 Y 128 0 63
def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63
def test t5 t5 const06 const06 253 10 10 N 4097 0 8
def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8
@@ -5105,13 +5121,13 @@ def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
-def test t5 t5 param13 param13 246 67 0 Y 32768 30 63
+def test t5 t5 param13 param13 246 67 0 Y 32768 38 63
def test t5 t5 param14 param14 252 4294967295 0 Y 16 0 8
def test t5 t5 param15 param15 252 4294967295 0 Y 144 0 63
const01 8
param01 8
const02 8.0
-param02 8.000000000000000000000000000000
+param02 8.00000000000000000000000000000000000000
const03 8
param03 8
const04 abc
@@ -5203,28 +5219,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 128 31 63
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 128 31 63
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 128 31 63
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 128 31 63
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 128 39 63
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 128 39 63
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 128 39 63
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 128 39 63
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@@ -5250,28 +5266,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 128 31 63
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 128 31 63
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 128 31 63
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 128 31 63
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 128 39 63
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 128 39 63
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 128 39 63
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 128 39 63
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -5300,28 +5316,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 128 31 63
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 128 31 63
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 128 31 63
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 128 31 63
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 128 39 63
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 128 39 63
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 128 39 63
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 128 39 63
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -5340,28 +5356,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 128 31 63
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 128 31 63
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 128 31 63
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 128 31 63
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 128 39 63
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 128 39 63
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 128 39 63
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 128 39 63
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -5388,28 +5404,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 128 31 63
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 128 31 63
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 128 31 63
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 128 31 63
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 128 39 63
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 128 39 63
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 128 39 63
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 128 39 63
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -5432,28 +5448,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 128 31 63
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 128 31 63
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 128 31 63
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 128 31 63
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 128 39 63
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 128 39 63
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 128 39 63
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 128 39 63
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -5478,28 +5494,28 @@ def @arg07 5 23 1 Y 32896 31 63
def @arg08 5 23 1 Y 32896 31 63
def @arg09 5 23 1 Y 32896 31 63
def @arg10 5 23 1 Y 32896 31 63
-def @arg11 246 83 6 Y 32896 30 63
-def @arg12 246 83 6 Y 32896 30 63
-def @arg13 250 16777215 10 Y 0 31 8
-def @arg14 250 16777215 19 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 8 Y 0 31 8
+def @arg11 246 83 6 Y 32896 38 63
+def @arg12 246 83 6 Y 32896 38 63
+def @arg13 250 16777215 10 Y 0 39 8
+def @arg14 250 16777215 19 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 8 Y 0 39 8
def @arg17 8 20 4 Y 32928 0 63
def @arg18 8 20 1 Y 32896 0 63
def @arg19 8 20 1 Y 32896 0 63
-def @arg20 250 16777215 1 Y 0 31 8
-def @arg21 250 16777215 10 Y 0 31 8
-def @arg22 250 16777215 30 Y 0 31 8
-def @arg23 250 16777215 8 Y 128 31 63
-def @arg24 250 16777215 8 Y 0 31 8
-def @arg25 250 16777215 4 Y 128 31 63
-def @arg26 250 16777215 4 Y 0 31 8
-def @arg27 250 16777215 10 Y 128 31 63
-def @arg28 250 16777215 10 Y 0 31 8
-def @arg29 250 16777215 8 Y 128 31 63
-def @arg30 250 16777215 8 Y 0 31 8
-def @arg31 250 16777215 3 Y 0 31 8
-def @arg32 250 16777215 6 Y 0 31 8
+def @arg20 250 16777215 1 Y 0 39 8
+def @arg21 250 16777215 10 Y 0 39 8
+def @arg22 250 16777215 30 Y 0 39 8
+def @arg23 250 16777215 8 Y 128 39 63
+def @arg24 250 16777215 8 Y 0 39 8
+def @arg25 250 16777215 4 Y 128 39 63
+def @arg26 250 16777215 4 Y 0 39 8
+def @arg27 250 16777215 10 Y 128 39 63
+def @arg28 250 16777215 10 Y 0 39 8
+def @arg29 250 16777215 8 Y 128 39 63
+def @arg30 250 16777215 8 Y 0 39 8
+def @arg31 250 16777215 3 Y 0 39 8
+def @arg32 250 16777215 6 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -5516,28 +5532,28 @@ def @arg07 5 23 0 Y 32896 31 63
def @arg08 5 23 0 Y 32896 31 63
def @arg09 5 23 0 Y 32896 31 63
def @arg10 5 23 0 Y 32896 31 63
-def @arg11 246 83 0 Y 32896 30 63
-def @arg12 246 83 0 Y 32896 30 63
-def @arg13 250 16777215 0 Y 0 31 8
-def @arg14 250 16777215 0 Y 0 31 8
-def @arg15 250 16777215 19 Y 0 31 8
-def @arg16 250 16777215 0 Y 0 31 8
+def @arg11 246 83 0 Y 32896 38 63
+def @arg12 246 83 0 Y 32896 38 63
+def @arg13 250 16777215 0 Y 0 39 8
+def @arg14 250 16777215 0 Y 0 39 8
+def @arg15 250 16777215 19 Y 0 39 8
+def @arg16 250 16777215 0 Y 0 39 8
def @arg17 8 20 0 Y 32928 0 63
def @arg18 8 20 0 Y 32896 0 63
def @arg19 8 20 0 Y 32896 0 63
-def @arg20 250 16777215 0 Y 0 31 8
-def @arg21 250 16777215 0 Y 0 31 8
-def @arg22 250 16777215 0 Y 0 31 8
-def @arg23 250 16777215 0 Y 128 31 63
-def @arg24 250 16777215 0 Y 0 31 8
-def @arg25 250 16777215 0 Y 128 31 63
-def @arg26 250 16777215 0 Y 0 31 8
-def @arg27 250 16777215 0 Y 128 31 63
-def @arg28 250 16777215 0 Y 0 31 8
-def @arg29 250 16777215 0 Y 128 31 63
-def @arg30 250 16777215 0 Y 0 31 8
-def @arg31 250 16777215 0 Y 0 31 8
-def @arg32 250 16777215 0 Y 0 31 8
+def @arg20 250 16777215 0 Y 0 39 8
+def @arg21 250 16777215 0 Y 0 39 8
+def @arg22 250 16777215 0 Y 0 39 8
+def @arg23 250 16777215 0 Y 128 39 63
+def @arg24 250 16777215 0 Y 0 39 8
+def @arg25 250 16777215 0 Y 128 39 63
+def @arg26 250 16777215 0 Y 0 39 8
+def @arg27 250 16777215 0 Y 128 39 63
+def @arg28 250 16777215 0 Y 0 39 8
+def @arg29 250 16777215 0 Y 128 39 63
+def @arg30 250 16777215 0 Y 0 39 8
+def @arg31 250 16777215 0 Y 0 39 8
+def @arg32 250 16777215 0 Y 0 39 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -5845,6 +5861,7 @@ prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
from t9 where c21 = 'O' ";
prepare my_delete from "delete from t9 where c21 = 'O' ";
set @arg00= 9223372036854775807 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -5868,6 +5885,7 @@ c10 9.223372036854776e18
c12 9999.9999
execute my_delete ;
set @arg00= '9223372036854775807' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -5891,6 +5909,7 @@ c10 9.223372036854776e18
c12 9999.9999
execute my_delete ;
set @arg00= -9223372036854775808 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -5914,6 +5933,7 @@ c10 -9.223372036854776e18
c12 -9999.9999
execute my_delete ;
set @arg00= '-9223372036854775808' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -5937,6 +5957,7 @@ c10 -9.223372036854776e18
c12 -9999.9999
execute my_delete ;
set @arg00= 1.11111111111111111111e+50 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -5962,6 +5983,7 @@ c10 1.111111111111111e50
c12 9999.9999
execute my_delete ;
set @arg00= '1.11111111111111111111e+50' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -5987,6 +6009,7 @@ c10 1.111111111111111e50
c12 9999.9999
execute my_delete ;
set @arg00= -1.11111111111111111111e+50 ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -6012,6 +6035,7 @@ c10 -1.111111111111111e50
c12 -9999.9999
execute my_delete ;
set @arg00= '-1.11111111111111111111e+50' ;
+set statement sql_mode = '' for
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
@@ -6038,6 +6062,7 @@ c12 -9999.9999
execute my_delete ;
test_sequence
-- insert into string columns --
+set sql_mode = '';
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
@@ -6196,6 +6221,7 @@ execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
+set sql_mode = default;
set @arg00= 'abc' ;
set @arg00= NULL ;
insert into t9
@@ -6402,6 +6428,7 @@ true
delete from t9 ;
test_sequence
-- insert into date/time columns --
+set sql_mode = '';
set @arg00= '1991-01-01 01:01:01' ;
insert into t9
( c1, c13, c14, c15, c16, c17 )
@@ -6560,6 +6587,7 @@ Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Note 1265 Data truncated for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
+set sql_mode = default;
set @arg00= 'abc' ;
set @arg00= NULL ;
insert into t9
diff --git a/mysql-test/r/ps_ddl.result b/mysql-test/r/ps_ddl.result
index fc1832260c5..e69c6e06193 100644
--- a/mysql-test/r/ps_ddl.result
+++ b/mysql-test/r/ps_ddl.result
@@ -1310,7 +1310,7 @@ create algorithm=temptable view v1 as select a*a as a2 from t1;
# statement code, and should not raise ER_PS_INVALIDATED errors
show create view v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`a` * `t1`.`a`) AS `a2` from `t1` latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` * `t1`.`a` AS `a2` from `t1` latin1 latin1_swedish_ci
prepare stmt from "select * from v1";
insert into t1 values (1), (2), (3);
execute stmt;
@@ -1820,6 +1820,8 @@ 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;
prepare stmt_sf from 'select f_12093();';
prepare stmt_sp from 'call p_12093(f_12093())';
execute stmt_sf;
@@ -1827,7 +1829,9 @@ f_12093()
0
execute stmt_sp;
a
+connection con1;
drop function f_12093_unrelated;
+connection default;
# XXX: used to be a bug
execute stmt_sf;
f_12093()
@@ -1842,6 +1846,7 @@ f_12093()
# XXX: used to be a bug
execute stmt_sp;
a
+connection default;
prepare stmt_sf from 'select f_12093();';
prepare stmt_sp from 'call p_12093(f_12093())';
execute stmt_sf;
@@ -1849,7 +1854,9 @@ f_12093()
0
execute stmt_sp;
a
+connection con1;
drop procedure p_12093_unrelated;
+connection default;
# XXX: used to be a bug
execute stmt_sf;
f_12093()
@@ -1864,6 +1871,7 @@ f_12093()
# XXX: used to be a bug
execute stmt_sp;
a
+connection default;
prepare stmt_sf from 'select f_12093();';
prepare stmt_sp from 'call p_12093(f_12093())';
execute stmt_sf;
@@ -1871,7 +1879,9 @@ f_12093()
0
execute stmt_sp;
a
+connection con1;
drop view v_12093_unrelated;
+connection default;
# XXX: used to be a bug
execute stmt_sf;
f_12093()
@@ -1886,9 +1896,11 @@ f_12093()
# XXX: used to be a bug
execute stmt_sp;
a
+connection default;
call p_verify_reprepare_count(6);
SUCCESS
+disconnect con1;
drop table t_12093;
drop function f_12093;
drop procedure p_12093;
diff --git a/mysql-test/r/ps_grant.result b/mysql-test/r/ps_grant.result
index 388f6aa7c91..0e296cdc699 100644
--- a/mysql-test/r/ps_grant.result
+++ b/mysql-test/r/ps_grant.result
@@ -13,6 +13,8 @@ show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+connect con3,localhost,second_user,looser,mysqltest;
+connection con3;
select current_user();
current_user()
second_user@localhost
@@ -27,6 +29,7 @@ my_col
1
select a as my_col from t1;
ERROR 42000: SELECT command denied to user 'second_user'@'localhost' for table 't1'
+connection default;
grant select on mysqltest.t1 to second_user@localhost
identified by 'looser' ;
show grants for second_user@localhost ;
@@ -40,6 +43,7 @@ Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
+connection con3;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
@@ -55,17 +59,21 @@ my_col
execute s_t9 ;
ERROR 42S02: Table 'mysqltest.t9' doesn't exist
deallocate prepare s_t9;
+connection default;
revoke all privileges on mysqltest.t1 from second_user@localhost;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+connection con3;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
execute s_t1 ;
ERROR 42000: SELECT command denied to user 'second_user'@'localhost' for table 't1'
+connection default;
+disconnect con3;
revoke all privileges, grant option from second_user@localhost ;
show grants for second_user@localhost ;
Grants for second_user@localhost
diff --git a/mysql-test/r/ps_qc_innodb.result b/mysql-test/r/ps_qc_innodb.result
index 775055e858f..29c364348dc 100644
--- a/mysql-test/r/ps_qc_innodb.result
+++ b/mysql-test/r/ps_qc_innodb.result
@@ -3,13 +3,16 @@
#
SET @qcs.save= @@global.query_cache_size, @qct.save= @@global.query_cache_type;
SET GLOBAL query_cache_size= 512*1024*1024, query_cache_type= ON;
+connect con1,localhost,root,,test;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (b INT) ENGINE=InnoDB;
CREATE VIEW v AS select a from t1 join t2;
PREPARE stmt1 FROM "SELECT * FROM t1 WHERE a in (SELECT a FROM v)";
+connect con2,localhost,root,,test;
PREPARE stmt2 FROM "SELECT * FROM t1 WHERE a in (SELECT a FROM v)";
EXECUTE stmt2;
a
+connection con1;
EXECUTE stmt1;
a
INSERT INTO t2 VALUES (0);
@@ -18,6 +21,9 @@ a
START TRANSACTION;
EXECUTE stmt1;
a
+disconnect con1;
+disconnect con2;
+connection default;
DROP VIEW v;
DROP TABLE t1, t2;
SET GLOBAL query_cache_size= @qcs.save, query_cache_type= @qct.save;
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index d34c96cd568..ee734845a9e 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -2136,6 +2136,57 @@ Qcache_hits 1
use test;
drop database `foo.bar`;
End of 10.0 tests
+#
+# MDEV-10766 Queries which start with WITH clause do not get
+# inserted into query cache
+#
+flush status;
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 0
+create table t1 (i int);
+with cte as (select * from t1) select * from cte;
+i
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+with cte as (select * from t1) select * from cte;
+i
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_inserts";
+Variable_name Value
+Qcache_inserts 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 1
+drop table t1;
+#
+# MDEV-15328: MariaDB 10.2.13 Crashes upon CALL PROCEDURE PARAM
+# LAST_INSERT_ID ()
+# (part 2, part 1 is in sp.test)
+#
+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";
+Variable_name Value
+Qcache_queries_in_cache 0
+SELECT foo( LAST_INSERT_ID() ) from t1;
+foo( LAST_INSERT_ID() )
+1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+DROP FUNCTION foo;
+drop table t1;
restore defaults
SET GLOBAL query_cache_type= default;
SET GLOBAL query_cache_size= default;
diff --git a/mysql-test/r/query_cache_28249.result b/mysql-test/r/query_cache_28249.result
index 72d713e8e70..ba694179ceb 100644
--- a/mysql-test/r/query_cache_28249.result
+++ b/mysql-test/r/query_cache_28249.result
@@ -3,8 +3,10 @@ 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;
# Bug#28249 Query Cache returns wrong result with concurrent insert/ certain lock
-# Establish connections user1,user2,user3 (user=root)
-# Switch to connection user1
+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;
@@ -14,13 +16,13 @@ DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
-# Switch to connection user2
+connection user2;
LOCK TABLE t2 WRITE;
-# Switch to connection user1
+connection user1;
# "send" the next select, "reap" the result later.
# The select will be blocked by the write lock on the t1.
SELECT *, (SELECT COUNT(*) FROM t2) FROM t1;
-# Switch to connection user3
+connection user3;
# Poll till the select of connection user1 is blocked by the write lock on t1.
SELECT user,command,state,info FROM information_schema.processlist
WHERE state = 'Waiting for table metadata lock'
@@ -28,18 +30,18 @@ WHERE state = 'Waiting for table metadata lock'
user command state info
root Query Waiting for table metadata lock SELECT *, (SELECT COUNT(*) FROM t2) FROM t1
INSERT INTO t1 VALUES (4);
-# Switch to connection user2
+connection user2;
UNLOCK TABLES;
-# Switch to connection user1
+connection user1;
# Collecting ("reap") the result from the previously blocked select.
# The printing of the result (varies between 3 and 4 rows) set has to be suppressed.
-# Switch to connection user3
+connection user3;
# The next select enforces that effects of "concurrent_inserts" like the
# record with a = 4 is missing in result sets can no more happen.
SELECT 1 FROM t1 WHERE a = 4;
1
1
-# Switch to connection user1
+connection user1;
# The next result set must contain 4 rows.
SELECT *, (SELECT COUNT(*) FROM t2) FROM t1;
a (SELECT COUNT(*) FROM t2)
@@ -55,7 +57,10 @@ a (SELECT COUNT(*) FROM t2)
3 0
4 0
DROP TABLE t1,t2;
-# Switch to connection default + close connections user1,user2,user3
+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;
diff --git a/mysql-test/r/query_cache_debug.result b/mysql-test/r/query_cache_debug.result
index b3070761d9c..2a54f073974 100644
--- a/mysql-test/r/query_cache_debug.result
+++ b/mysql-test/r/query_cache_debug.result
@@ -5,24 +5,34 @@ set global query_cache_size= 1024*768;
drop table if exists t1;
create table t1 (a varchar(100));
insert into t1 values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
+connect bug30887con1, localhost, root, ,test;
+connect bug30887con2, localhost, root, ,test;
+connection bug30887con1;
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";
select SQL_CACHE * from t1;;
+connection default;
set debug_sync="now WAIT_FOR parked";
-On a second connection; clear the query cache.
+connection bug30887con2;
+clear the query cache.
show status like 'Qcache_queries_in_cache';
Variable_name Value
Qcache_queries_in_cache 1
set global query_cache_size= 0;
+connection default;
Signal the debug hook to release the lock.
set debug_sync="now SIGNAL go";
Show query cache status.
show status like 'Qcache_queries_in_cache';
Variable_name Value
Qcache_queries_in_cache 0
+connection bug30887con1;
a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+disconnect bug30887con1;
+disconnect bug30887con2;
+connection default;
set debug_sync= 'RESET';
set global query_cache_size= 0;
use test;
@@ -36,24 +46,26 @@ 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;
-# Switch to connection con1
+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";
# Send concurrent insert, will wait in the query cache table invalidate
INSERT INTO t1 VALUES (4);
-# Switch to connection default
+connection default;
# Wait for concurrent insert to reach the debug point
SET DEBUG_SYNC = "now WAIT_FOR parked";
-# Switch to connection con2
+connection con2;
# Send SELECT that shouldn't be cached
SELECT * FROM t1;
a
1
2
3
-# Switch to connection default
+connection default;
# Notify the concurrent insert to proceed
SET DEBUG_SYNC = "now SIGNAL go";
-# Switch to connection con1
+connection con1;
# Gather insert result
SHOW STATUS LIKE "Qcache_queries_in_cache";
Variable_name Value
@@ -68,7 +80,9 @@ a
SHOW STATUS LIKE "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
-# Disconnect
+disconnect con1;
+disconnect con2;
+connection default;
# Restore defaults
SET DEBUG_SYNC= 'RESET';
RESET QUERY CACHE;
@@ -93,7 +107,10 @@ INSERT INTO t2 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
INSERT INTO t3 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
INSERT INTO t4 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
INSERT INTO t5 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
-=================================== Connection thd1
+connect thd2, localhost, root, ,test;
+connect thd3, localhost, root, ,test;
+connect thd1, localhost, root, ,test;
+connection thd1;
**
** Load Query Cache with a result set and one table.
**
@@ -116,27 +133,27 @@ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
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";
DELETE FROM t1 WHERE a like '%a%';;
-=================================== Connection default
+connection default;
** Assert that the expect process status is obtained.
SET DEBUG_SYNC="now WAIT_FOR parked1_1";
**
-=================================== Connection thd2
+connection thd2;
** On THD2: Insert a result into the cache. This attempt will be blocked
** because of a debug hook placed just before the mutex lock after which
** the first part of the result set is written.
SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked2 WAIT_FOR go2 EXECUTE 1";
SELECT SQL_CACHE * FROM t2 UNION SELECT * FROM t3;
-=================================== Connection default
+connection default;
** Assert that the SELECT-stmt thread reaches the sync point.
SET DEBUG_SYNC="now WAIT_FOR parked2";
**
**
-=================================== Connection thd3
+connection thd3;
** On THD3: Insert another result into the cache and block on the same
** debug hook.
SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked3 WAIT_FOR go3 EXECUTE 1";
SELECT SQL_CACHE * FROM t4 UNION SELECT * FROM t5;
-=================================== Connection default
+connection default;
** Assert that the SELECT-stmt thread reaches the sync point.
SET DEBUG_SYNC="now WAIT_FOR parked3";
**
@@ -166,23 +183,28 @@ SET DEBUG_SYNC="now SIGNAL go1_2";
**
*************************************************************************
** No tables should be locked
-=================================== Connection thd2
+connection thd2;
a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
DELETE FROM t1;
DELETE FROM t2;
DELETE FROM t3;
-=================================== Connection thd3
+connection thd3;
a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
DELETE FROM t4;
DELETE FROM t5;
-=================================== Connection thd1
+connection thd1;
** Done.
+connection default;
+disconnect thd1;
+disconnect thd2;
+disconnect thd3;
SET DEBUG_SYNC= 'RESET';
SET GLOBAL query_cache_size= 0;
+connection default;
# Restore defaults
RESET QUERY CACHE;
FLUSH STATUS;
@@ -199,22 +221,27 @@ 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;
-# Switch to connection con1
+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";
# Send INSERT, will wait in the query cache table invalidation
INSERT INTO t1 VALUES (4);;
-# Switch to connection default
+connection default;
# Wait for insert to reach the debug point
SET DEBUG_SYNC = "now WAIT_FOR parked";
-# Switch to connection con2
+connection con2;
# Send a query that should wait on the query cache lock
RESET QUERY CACHE;
-# Switch to connection default
+connection default;
# Wait for the state to be reflected in the processlist
# Signal that the query cache can be unlocked
SET DEBUG_SYNC="now SIGNAL go";
-# Reap con1 and disconnect
-# Reap con2 and disconnect
+connection con1;
+disconnect con1;
+connection con2;
+disconnect con2;
+connection default;
# Restore defaults
SET DEBUG_SYNC= 'RESET';
RESET QUERY CACHE;
@@ -236,12 +263,22 @@ INSERT IGNORE INTO t1 VALUES
(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";
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;
SET GLOBAL query_cache_type= 0;
+connection default;
set debug_sync="now SIGNAL go";
+connection con1;
id
+connection con2;
+disconnect con1;
+disconnect con2;
+connection default;
set debug_sync= 'RESET';
DROP TABLE t1;
SEt GLOBAL query_cache_size= DEFAULT;
diff --git a/mysql-test/r/query_cache_innodb.result b/mysql-test/r/query_cache_innodb.result
new file mode 100644
index 00000000000..643a065612f
--- /dev/null
+++ b/mysql-test/r/query_cache_innodb.result
@@ -0,0 +1,90 @@
+#
+# MDEV-12485: foreign key on delete cascade stale entries with
+# query cache enabled
+#
+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;
+t2id id
+1 1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+delete from t1;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from t2;
+t2id id
+optimize table t2;
+Table Op Msg_type Msg_text
+test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t2 optimize status OK
+select * from t2;
+t2id id
+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$Ñ—`;
+t2id id
+1 1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+delete from `t1$Ñ—`;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from `t2$Ñ—`;
+t2id id
+optimize table `t2$Ñ—`;
+Table Op Msg_type Msg_text
+testdatabase$Ñ—.t2$Ñ— optimize note Table does not support optimize, doing recreate + analyze instead
+testdatabase$Ñ—.t2$Ñ— optimize status OK
+select * from `t2$Ñ—`;
+t2id id
+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`;
+t2id id
+1 1
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+delete from `#mysql50#t-1`;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select * from `#mysql50#t-2`;
+t2id id
+optimize table `#mysql50#t-2`;
+Table Op Msg_type Msg_text
+#mysql50#-.#mysql50#t-2 optimize note Table does not support optimize, doing recreate + analyze instead
+#mysql50#-.#mysql50#t-2 optimize status OK
+select * from `#mysql50#t-2`;
+t2id id
+use test;
+drop database `#mysql50#-`;
+SET NAMES default;
+FOUND 12 /\[ERROR\] Invalid \(old\?\) table or database name/ in mysqld.1.err
+set global query_cache_type=DEFAULT;
+set global query_cache_size=DEFAULT;
+End of 10.2 tests
diff --git a/mysql-test/r/query_cache_notembedded.result b/mysql-test/r/query_cache_notembedded.result
index 400ac2b2718..bfb8f4d1ff7 100644
--- a/mysql-test/r/query_cache_notembedded.result
+++ b/mysql-test/r/query_cache_notembedded.result
@@ -84,21 +84,31 @@ show status like "Qcache_free_blocks";
Variable_name Value
Qcache_free_blocks 1
drop table t1, t2, t3, t11, t21;
+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;
a
+connection root2;
SELECT * FROM t1;
a
1
2
3
+connection root;
SELECT * FROM t1;
a
UNLOCK TABLES;
drop table t1;
+connection default;
+disconnect root;
+disconnect root2;
flush query cache;
reset query cache;
flush status;
@@ -319,6 +329,7 @@ drop procedure f2;
drop procedure f3;
drop procedure f4;
drop table t1;
+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;
@@ -333,15 +344,21 @@ insert into t1 values(3);
set i_var = sleep(3);
return 0;
end;|
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
select f1();
+connection con2;
select sleep(4);
sleep(4)
0
select * from t1;
id
3
+connection con1;
f1()
0
+connection con2;
select * from t1;
id
3
@@ -351,6 +368,9 @@ id
3
drop table t1;
drop function f1;
+disconnect con1;
+disconnect con2;
+connection default;
set GLOBAL query_cache_size=0;
SET @@global.log_bin_trust_function_creators = @old_log_bin_trust_function_creators;
DROP DATABASE IF EXISTS bug30269;
@@ -363,6 +383,8 @@ 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';
Variable_name Value
@@ -380,8 +402,10 @@ id
show status like 'Qcache_queries_in_cache';
Variable_name Value
Qcache_queries_in_cache 1
+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;
diff --git a/mysql-test/r/query_cache_ps_no_prot.result b/mysql-test/r/query_cache_ps_no_prot.result
index 5076003a7fb..ef1f92b597d 100644
--- a/mysql-test/r/query_cache_ps_no_prot.result
+++ b/mysql-test/r/query_cache_ps_no_prot.result
@@ -1,7 +1,7 @@
set GLOBAL query_cache_type=ON;
set LOCAL query_cache_type=ON;
----- establish connection con1 (root) ----
----- switch to connection default ----
+connect con1,localhost,root,,test,$MASTER_MYPORT,;
+connection default;
set @initial_query_cache_size = @@global.query_cache_size;
set @@global.query_cache_size=102400;
flush status;
@@ -49,7 +49,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 5
----- switch to connection con1 ----
+connection con1;
prepare stmt3 from "select * from t1 where c1=10";
execute stmt3;
c1
@@ -69,7 +69,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 8
----- switch to connection default ----
+connection default;
prepare stmt10 from "SELECT * FROM t1 WHERE c1 = 100";
show status like 'Qcache_hits';
Variable_name Value
@@ -92,18 +92,18 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 10
----- switch to connection con1 ----
+connection con1;
SELECT * FROM t1 WHERE c1 = 100;
c1
100
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 11
----- switch to connection default ----
+connection default;
prepare stmt11 from "SELECT * FROM t1 WHERE c1 = 1";
----- switch to connection con1 ----
+connection con1;
prepare stmt12 from "SELECT * FROM t1 WHERE c1 = 1";
----- switch to connection default ----
+connection default;
SELECT * FROM t1 WHERE c1 = 1;
c1
1
@@ -122,14 +122,14 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 13
----- switch to connection con1 ----
+connection con1;
execute stmt12;
c1
1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 14
----- switch to connection default ----
+connection default;
prepare stmt1 from "select * from t1 where c1=?";
show status like 'Qcache_hits';
Variable_name Value
@@ -147,7 +147,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 15
----- switch to connection con1 ----
+connection con1;
set @a=1;
prepare stmt4 from "select * from t1 where c1=?";
execute stmt4 using @a;
@@ -169,7 +169,7 @@ execute stmt4 using @a;
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 16
----- switch to connection default ----
+connection default;
prepare stmt1 from "select * from t1 where c1=10";
set global query_cache_size=0;
show status like 'Qcache_hits';
@@ -193,7 +193,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 16
----- switch to connection con1 ----
+connection con1;
execute stmt3;
c1
10
@@ -212,7 +212,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 16
----- switch to connection default ----
+connection default;
set global query_cache_size=102400;
execute stmt1;
c1
@@ -232,7 +232,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 18
----- switch to connection con1 ----
+connection con1;
execute stmt3;
c1
10
@@ -251,7 +251,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 21
----- switch to connection default ----
+connection default;
set global query_cache_size=0;
show status like 'Qcache_hits';
Variable_name Value
@@ -274,7 +274,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 21
----- switch to connection con1 ----
+connection con1;
execute stmt3;
c1
10
@@ -293,12 +293,12 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 21
----- switch to connection default ----
+connection default;
set global query_cache_size=0;
prepare stmt1 from "select * from t1 where c1=10";
----- switch to connection con1 ----
+connection con1;
prepare stmt3 from "select * from t1 where c1=10";
----- switch to connection default ----
+connection default;
set global query_cache_size=102400;
show status like 'Qcache_hits';
Variable_name Value
@@ -321,7 +321,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 21
----- switch to connection con1 ----
+connection con1;
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 21
@@ -343,7 +343,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 21
----- switch to connection default ----
+connection default;
set global query_cache_size=0;
prepare stmt1 from "select * from t1 where c1=?";
set global query_cache_size=102400;
@@ -372,7 +372,7 @@ show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 21
drop table t1;
----- disconnect connection con1 ----
+disconnect con1;
########################################################################
#
# BUG#25843: Changing default database between PREPARE and EXECUTE of
diff --git a/mysql-test/r/query_cache_ps_ps_prot.result b/mysql-test/r/query_cache_ps_ps_prot.result
index 4105bc40f94..e3f2da1dbbe 100644
--- a/mysql-test/r/query_cache_ps_ps_prot.result
+++ b/mysql-test/r/query_cache_ps_ps_prot.result
@@ -1,7 +1,7 @@
set GLOBAL query_cache_type=ON;
set LOCAL query_cache_type=ON;
----- establish connection con1 (root) ----
----- switch to connection default ----
+connect con1,localhost,root,,test,$MASTER_MYPORT,;
+connection default;
set @initial_query_cache_size = @@global.query_cache_size;
set @@global.query_cache_size=102400;
flush status;
@@ -49,7 +49,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 5
----- switch to connection con1 ----
+connection con1;
prepare stmt3 from "select * from t1 where c1=10";
execute stmt3;
c1
@@ -69,7 +69,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 8
----- switch to connection default ----
+connection default;
prepare stmt10 from "SELECT * FROM t1 WHERE c1 = 100";
show status like 'Qcache_hits';
Variable_name Value
@@ -92,18 +92,18 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 9
----- switch to connection con1 ----
+connection con1;
SELECT * FROM t1 WHERE c1 = 100;
c1
100
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 10
----- switch to connection default ----
+connection default;
prepare stmt11 from "SELECT * FROM t1 WHERE c1 = 1";
----- switch to connection con1 ----
+connection con1;
prepare stmt12 from "SELECT * FROM t1 WHERE c1 = 1";
----- switch to connection default ----
+connection default;
SELECT * FROM t1 WHERE c1 = 1;
c1
1
@@ -122,14 +122,14 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 11
----- switch to connection con1 ----
+connection con1;
execute stmt12;
c1
1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 12
----- switch to connection default ----
+connection default;
prepare stmt1 from "select * from t1 where c1=?";
show status like 'Qcache_hits';
Variable_name Value
@@ -147,7 +147,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 13
----- switch to connection con1 ----
+connection con1;
set @a=1;
prepare stmt4 from "select * from t1 where c1=?";
execute stmt4 using @a;
@@ -169,7 +169,7 @@ execute stmt4 using @a;
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 14
----- switch to connection default ----
+connection default;
prepare stmt1 from "select * from t1 where c1=10";
set global query_cache_size=0;
show status like 'Qcache_hits';
@@ -193,7 +193,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 14
----- switch to connection con1 ----
+connection con1;
execute stmt3;
c1
10
@@ -212,7 +212,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 14
----- switch to connection default ----
+connection default;
set global query_cache_size=102400;
execute stmt1;
c1
@@ -232,7 +232,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 16
----- switch to connection con1 ----
+connection con1;
execute stmt3;
c1
10
@@ -251,7 +251,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 19
----- switch to connection default ----
+connection default;
set global query_cache_size=0;
show status like 'Qcache_hits';
Variable_name Value
@@ -274,7 +274,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 19
----- switch to connection con1 ----
+connection con1;
execute stmt3;
c1
10
@@ -293,12 +293,12 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 19
----- switch to connection default ----
+connection default;
set global query_cache_size=0;
prepare stmt1 from "select * from t1 where c1=10";
----- switch to connection con1 ----
+connection con1;
prepare stmt3 from "select * from t1 where c1=10";
----- switch to connection default ----
+connection default;
set global query_cache_size=102400;
show status like 'Qcache_hits';
Variable_name Value
@@ -321,7 +321,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 19
----- switch to connection con1 ----
+connection con1;
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 19
@@ -343,7 +343,7 @@ c1
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 19
----- switch to connection default ----
+connection default;
set global query_cache_size=0;
prepare stmt1 from "select * from t1 where c1=?";
set global query_cache_size=102400;
@@ -372,7 +372,7 @@ show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 19
drop table t1;
----- disconnect connection con1 ----
+disconnect con1;
########################################################################
#
# BUG#25843: Changing default database between PREPARE and EXECUTE of
diff --git a/mysql-test/r/quick_select_4161.result b/mysql-test/r/quick_select_4161.result
index 18ac4362a84..30ae0a09edc 100644
--- a/mysql-test/r/quick_select_4161.result
+++ b/mysql-test/r/quick_select_4161.result
@@ -22,11 +22,16 @@ INSERT INTO t1 VALUES ('1999-07-10',100100,24), ('1999-07-11',100100,25),
('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;
set debug_sync='inside_make_join_statistics signal killme wait_for done';
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';
kill %connection%;
set debug_sync='now signal done';
+connection killee;
Got one of the listed errors
+connection default;
+disconnect killee;
drop table t1;
set debug_sync='reset';
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 5adb8225b38..3a71d08eb38 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -1595,8 +1595,6 @@ NULL
Warnings:
Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
-Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
-Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20';
str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20'
1
@@ -2258,26 +2256,26 @@ explain extended select * from t2 where (b > 25 and b < 15) or a<44;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44)
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`a` < 44
# 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);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44)
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`a` < 44
# Here, conditions b will not be removed, because "c<44" is not sargable
# 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);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44) or ((`test`.`t2`.`b` > 25) and (`test`.`t2`.`b` < 15)))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` < 44 or `test`.`t2`.`b` > 25 and `test`.`t2`.`b` < 15
# 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;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` < 44
# 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);
id select_type table type possible_keys key key_len ref rows filtered Extra
@@ -2332,3 +2330,677 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# MDEV-10454: range access keys extracted
+# from <row> IN (<row value list>)
+#
+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');
+# range access to t1 by 2-component keys for index idx
+explain select * from t1 where (a,b) IN ((2, 3),(3,3),(8,8),(7,7));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx idx 10 NULL 7 Using where
+explain format=json select * from t1 where (a,b) IN ((2, 3),(3,3),(8,8),(7,7));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "10",
+ "used_key_parts": ["a", "b"],
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "(t1.a,t1.b) in (<cache>((2,3)),<cache>((3,3)),<cache>((8,8)),<cache>((7,7)))"
+ }
+ }
+}
+select * from t1 where (a,b) IN ((2, 3),(3,3),(8,8),(7,7));
+a b c
+2 3 yy
+2 3 ww
+2 3 ya
+2 3 wa
+3 3 zzzz
+3 3 zyxw
+3 3 zzza
+3 3 zyxa
+7 7 xxxyy
+7 7 xxxya
+prepare stmt from "select * from t1 where (a,b) IN ((2, 3),(3,3),(8,8),(7,7))";
+execute stmt;
+a b c
+2 3 yy
+2 3 ww
+2 3 ya
+2 3 wa
+3 3 zzzz
+3 3 zyxw
+3 3 zzza
+3 3 zyxa
+7 7 xxxyy
+7 7 xxxya
+execute stmt;
+a b c
+2 3 yy
+2 3 ww
+2 3 ya
+2 3 wa
+3 3 zzzz
+3 3 zyxw
+3 3 zzza
+3 3 zyxa
+7 7 xxxyy
+7 7 xxxya
+deallocate prepare stmt;
+# range access to t1 by 1-component keys for index idx
+explain select * from t1 where (a,b+a) IN ((4,9),(8,8),(7,7));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx idx 5 NULL 5 Using where
+explain format=json select * from t1 where (a,b+a) IN ((4,9),(8,8),(7,7));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a,t1.b + t1.a) in (<cache>((4,9)),<cache>((8,8)),<cache>((7,7)))"
+ }
+ }
+}
+select * from t1 where (a,b+a) IN ((4,9),(8,8),(7,7));
+a b c
+4 5 ww
+4 5 wa
+# range access to t1 by 1-component keys for index idx
+explain select * from t1 where (a,b) IN ((4,a-1),(8,a+8),(7,a+7));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx idx 5 NULL 5 Using where
+explain format=json select * from t1 where (a,b) IN ((4,a-1),(8,a+8),(7,a+7));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a,t1.b) in ((4,t1.a - 1),(8,t1.a + 8),(7,t1.a + 7))"
+ }
+ }
+}
+select * from t1 where (a,b) IN ((4,a-1),(8,a+8),(7,a+7));
+a b c
+4 3 zyx
+4 3 zya
+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');
+# join order: (t2,t1) with ref access of t1
+# range access to t1 by keys for index idx1
+explain select * from t1,t2
+where a = d and (a,e) in ((3,3),(7,7),(2,2));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range idx1,idx2 idx1 5 NULL 3 Using index condition; Using where
+1 SIMPLE t1 ref idx idx 5 test.t2.d 8
+explain format=json select * from t1,t2
+where a = d and (a,e) in ((3,3),(7,7),(2,2));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["idx1", "idx2"],
+ "key": "idx1",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "rows": 3,
+ "filtered": 100,
+ "index_condition": "t2.d is not null",
+ "attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((2,2)))"
+ },
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.d"],
+ "rows": 8,
+ "filtered": 100
+ }
+ }
+}
+select * from t1,t2
+where a = d and (a,e) in ((3,3),(7,7),(2,2));
+a b c d e f
+2 1 w 2 2 da
+2 1 wb 2 2 da
+2 2 yyy 2 2 da
+2 2 wxz 2 2 da
+2 2 yya 2 2 da
+2 2 wxa 2 2 da
+2 3 yy 2 2 da
+2 3 ww 2 2 da
+2 3 ya 2 2 da
+2 3 wa 2 2 da
+3 2 uuuw 3 3 i
+3 2 uuua 3 3 i
+3 3 zzzz 3 3 i
+3 3 zyxw 3 3 i
+3 3 zzza 3 3 i
+3 3 zyxa 3 3 i
+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');
+# join order: (t1,t2) with ref access of t2
+# range access to t1 by 1-component keys for index idx
+explain select * from t1,t2
+where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx idx 5 NULL 6 Using index condition
+1 SIMPLE t2 ref idx1,idx2 idx1 5 test.t1.a 12 Using where
+explain format=json select * from t1,t2
+where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 6,
+ "filtered": 100,
+ "index_condition": "t1.a is not null"
+ },
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx1", "idx2"],
+ "key": "idx1",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "(t1.a,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1"
+ }
+ }
+}
+select * from t1,t2
+where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1;
+a b c d e f
+3 2 uuuw 3 3 i
+3 2 uuuw 3 3 i
+3 2 uuua 3 3 i
+3 2 uuua 3 3 i
+3 3 zzzz 3 3 i
+3 3 zzzz 3 3 i
+3 3 zyxw 3 3 i
+3 3 zyxw 3 3 i
+3 3 zzza 3 3 i
+3 3 zzza 3 3 i
+3 3 zyxa 3 3 i
+3 3 zyxa 3 3 i
+7 7 xxxyy 7 7 h
+7 7 xxxya 7 7 h
+7 8 xxxxx 7 7 h
+7 8 xxxxa 7 7 h
+prepare stmt from "select * from t1,t2
+where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1";
+execute stmt;
+a b c d e f
+3 2 uuuw 3 3 i
+3 2 uuuw 3 3 i
+3 2 uuua 3 3 i
+3 2 uuua 3 3 i
+3 3 zzzz 3 3 i
+3 3 zzzz 3 3 i
+3 3 zyxw 3 3 i
+3 3 zyxw 3 3 i
+3 3 zzza 3 3 i
+3 3 zzza 3 3 i
+3 3 zyxa 3 3 i
+3 3 zyxa 3 3 i
+7 7 xxxyy 7 7 h
+7 7 xxxya 7 7 h
+7 8 xxxxx 7 7 h
+7 8 xxxxa 7 7 h
+execute stmt;
+a b c d e f
+3 2 uuuw 3 3 i
+3 2 uuuw 3 3 i
+3 2 uuua 3 3 i
+3 2 uuua 3 3 i
+3 3 zzzz 3 3 i
+3 3 zzzz 3 3 i
+3 3 zyxw 3 3 i
+3 3 zyxw 3 3 i
+3 3 zzza 3 3 i
+3 3 zzza 3 3 i
+3 3 zyxa 3 3 i
+3 3 zyxa 3 3 i
+7 7 xxxyy 7 7 h
+7 7 xxxya 7 7 h
+7 8 xxxxx 7 7 h
+7 8 xxxxa 7 7 h
+deallocate prepare stmt;
+insert into t1 select * from t1;
+# join order: (t2,t1) with ref access of t1
+# range access to t2 by keys for index idx2
+explain select * from t1,t2
+where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range idx1,idx2 idx2 5 NULL 6 Using where
+1 SIMPLE t1 ref idx idx 5 test.t2.d 11
+explain format=json select * from t1,t2
+where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["idx1", "idx2"],
+ "key": "idx2",
+ "key_length": "5",
+ "used_key_parts": ["e"],
+ "rows": 6,
+ "filtered": 100,
+ "attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1 and t2.d is not null"
+ },
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.d"],
+ "rows": 11,
+ "filtered": 100
+ }
+ }
+}
+select * from t1,t2
+where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1;
+a b c d e f
+7 7 xxxyy 7 7 h
+7 7 xxxya 7 7 h
+7 7 xxxyy 7 7 h
+7 7 xxxya 7 7 h
+7 8 xxxxx 7 7 h
+7 8 xxxxa 7 7 h
+7 8 xxxxx 7 7 h
+7 8 xxxxa 7 7 h
+alter table t2 drop index idx1, drop index idx2, add index idx3(d,e);
+# join order: (t2,t1) with ref access of t1
+# range access to t2 by 2-component keys for index idx3
+explain select * from t1,t2
+where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range idx3 idx3 10 NULL 5 Using index condition; Using where
+1 SIMPLE t1 ref idx idx 5 test.t2.d 11
+explain format=json select * from t1,t2
+where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "10",
+ "used_key_parts": ["d", "e"],
+ "rows": 5,
+ "filtered": 100,
+ "index_condition": "t2.d is not null",
+ "attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1"
+ },
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.d"],
+ "rows": 11,
+ "filtered": 100
+ }
+ }
+}
+select * from t1,t2
+where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1;
+a b c d e f
+7 7 xxxyy 7 7 h
+7 7 xxxya 7 7 h
+7 7 xxxyy 7 7 h
+7 7 xxxya 7 7 h
+7 8 xxxxx 7 7 h
+7 8 xxxxa 7 7 h
+7 8 xxxxx 7 7 h
+7 8 xxxxa 7 7 h
+# join order: (t1,t2) with ref access of t2
+# range access to t1 by 1-component keys for index idx
+explain select * from t1,t2
+where a = d and (a,e) in ((4,d+1),(7,d+1),(8,d+1)) and length(f) = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx idx 5 NULL 15 Using index condition
+1 SIMPLE t2 ref idx3 idx3 5 test.t1.a 3 Using where
+explain format=json select * from t1,t2
+where a = d and (a,e) in ((4,d+1),(7,d+1),(8,d+1)) and length(f) = 1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 15,
+ "filtered": 100,
+ "index_condition": "t1.a is not null"
+ },
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "(t1.a,t2.e) in ((4,t1.a + 1),(7,t1.a + 1),(8,t1.a + 1)) and length(t2.f) = 1"
+ }
+ }
+}
+select * from t1,t2
+where a = d and (a,e) in ((4,d+1),(7,d+1),(8,d+1)) and length(f) = 1;
+a b c d e f
+4 3 zyx 4 5 a
+4 3 zya 4 5 a
+4 3 zyx 4 5 a
+4 3 zya 4 5 a
+4 5 ww 4 5 a
+4 5 wa 4 5 a
+4 5 ww 4 5 a
+4 5 wa 4 5 a
+7 7 xxxyy 7 8 b
+7 7 xxxya 7 8 b
+7 7 xxxyy 7 8 b
+7 7 xxxya 7 8 b
+7 8 xxxxx 7 8 b
+7 8 xxxxa 7 8 b
+7 8 xxxxx 7 8 b
+7 8 xxxxa 7 8 b
+# join order: (t1,t2) with ref access of t2
+# no range access
+explain select * from t1,t2
+where a = d and (a,e) in ((e,d+1),(7,7),(8,8)) and length(f) = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL idx NULL NULL NULL 144 Using where
+1 SIMPLE t2 ref idx3 idx3 5 test.t1.a 3 Using where
+explain format=json select * from t1,t2
+where a = d and (a,e) in ((e,d+1),(7,7),(8,8)) and length(f) = 1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "possible_keys": ["idx"],
+ "rows": 144,
+ "filtered": 100,
+ "attached_condition": "t1.a is not null"
+ },
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "(t1.a,t2.e) in ((t2.e,t1.a + 1),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1"
+ }
+ }
+}
+select * from t1,t2
+where a = d and (a,e) in ((e,d+1),(7,7),(8,8)) and length(f) = 1;
+a b c d e f
+7 8 xxxxx 7 7 h
+7 7 xxxyy 7 7 h
+7 8 xxxxa 7 7 h
+7 7 xxxya 7 7 h
+7 8 xxxxx 7 7 h
+7 7 xxxyy 7 7 h
+7 8 xxxxa 7 7 h
+7 7 xxxya 7 7 h
+# join order: (t1,t2) with ref access of t2
+# range access to t1 by 1-component keys for index idx
+explain 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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx idx 5 NULL 13 Using index condition; Using where
+1 SIMPLE t2 ref idx3 idx3 5 test.t1.a 3 Using where
+explain format=json 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;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 13,
+ "filtered": 100,
+ "index_condition": "t1.a is not null",
+ "attached_condition": "(t1.a,2) in (<cache>((2,2)),<cache>((7,7)),<cache>((8,8))) and length(t1.c) = 1"
+ },
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "length(t2.f) = 1"
+ }
+ }
+}
+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;
+a b c d e f
+2 1 w 2 1 e
+2 1 w 2 2 k
+2 1 w 2 3 g
+2 1 w 2 1 e
+2 1 w 2 2 k
+2 1 w 2 3 g
+prepare stmt from "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";
+execute stmt;
+a b c d e f
+2 1 w 2 1 e
+2 1 w 2 2 k
+2 1 w 2 3 g
+2 1 w 2 1 e
+2 1 w 2 2 k
+2 1 w 2 3 g
+execute stmt;
+a b c d e f
+2 1 w 2 1 e
+2 1 w 2 2 k
+2 1 w 2 3 g
+2 1 w 2 1 e
+2 1 w 2 2 k
+2 1 w 2 3 g
+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);
+# join order: (t3,t1,t2) with const t3 and ref access of t2
+# range access to t1 by 1-component keys for index idx
+explain 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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1
+1 SIMPLE t1 range idx idx 5 NULL 13 Using index condition; Using where
+1 SIMPLE t2 ref idx3 idx3 5 test.t1.a 3 Using where
+explain format=json 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;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t3",
+ "access_type": "const",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["id"],
+ "ref": ["const"],
+ "rows": 1,
+ "filtered": 100
+ },
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 13,
+ "filtered": 100,
+ "index_condition": "t1.a is not null",
+ "attached_condition": "(t1.a,1 + 1) in (<cache>((2,2)),<cache>((7,7)),<cache>((8,8))) and length(t1.c) = 1"
+ },
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "length(t2.f) = 1"
+ }
+ }
+}
+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;
+a b c d e f id v
+2 1 w 2 1 e 1 1
+2 1 w 2 2 k 1 1
+2 1 w 2 3 g 1 1
+2 1 w 2 1 e 1 1
+2 1 w 2 2 k 1 1
+2 1 w 2 3 g 1 1
+# IN predicate is always FALSE
+explain 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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+prepare stmt from "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";
+execute stmt;
+a b c d e f id v
+execute stmt;
+a b c d e f id v
+deallocate prepare stmt;
+set optimizer_switch=@save_optimizer_switch;
+drop table t1,t2,t3;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/range_interrupted-13751.result b/mysql-test/r/range_interrupted-13751.result
new file mode 100644
index 00000000000..f4f995721ad
--- /dev/null
+++ b/mysql-test/r/range_interrupted-13751.result
@@ -0,0 +1,16 @@
+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";
+SELECT 1 FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.c = alias2.c OR alias1.i <= 1
+;
+ERROR 70100: Query execution was interrupted
+set debug_dbug=@old_dbug;
+DROP TABLE t1;
diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result
index 4ef7c0b658c..799a299e33f 100644
--- a/mysql-test/r/range_mrr_icp.result
+++ b/mysql-test/r/range_mrr_icp.result
@@ -1597,8 +1597,6 @@ NULL
Warnings:
Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
-Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
-Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20';
str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20'
1
@@ -2260,26 +2258,26 @@ explain extended select * from t2 where (b > 25 and b < 15) or a<44;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition; Rowid-ordered scan
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44)
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`a` < 44
# 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);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition; Rowid-ordered scan
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44)
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`a` < 44
# Here, conditions b will not be removed, because "c<44" is not sargable
# 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);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44) or ((`test`.`t2`.`b` > 25) and (`test`.`t2`.`b` < 15)))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` < 44 or `test`.`t2`.`b` > 25 and `test`.`t2`.`b` < 15
# 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;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` < 44
# 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);
id select_type table type possible_keys key key_len ref rows filtered Extra
@@ -2334,4 +2332,688 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# MDEV-10454: range access keys extracted
+# from <row> IN (<row value list>)
+#
+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');
+# range access to t1 by 2-component keys for index idx
+explain select * from t1 where (a,b) IN ((2, 3),(3,3),(8,8),(7,7));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx idx 10 NULL 7 Using where; Rowid-ordered scan
+explain format=json select * from t1 where (a,b) IN ((2, 3),(3,3),(8,8),(7,7));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "10",
+ "used_key_parts": ["a", "b"],
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "(t1.a,t1.b) in (<cache>((2,3)),<cache>((3,3)),<cache>((8,8)),<cache>((7,7)))",
+ "mrr_type": "Rowid-ordered scan"
+ }
+ }
+}
+select * from t1 where (a,b) IN ((2, 3),(3,3),(8,8),(7,7));
+a b c
+3 3 zzzz
+2 3 yy
+2 3 ww
+7 7 xxxyy
+3 3 zyxw
+3 3 zzza
+2 3 ya
+2 3 wa
+7 7 xxxya
+3 3 zyxa
+prepare stmt from "select * from t1 where (a,b) IN ((2, 3),(3,3),(8,8),(7,7))";
+execute stmt;
+a b c
+3 3 zzzz
+2 3 yy
+2 3 ww
+7 7 xxxyy
+3 3 zyxw
+3 3 zzza
+2 3 ya
+2 3 wa
+7 7 xxxya
+3 3 zyxa
+execute stmt;
+a b c
+3 3 zzzz
+2 3 yy
+2 3 ww
+7 7 xxxyy
+3 3 zyxw
+3 3 zzza
+2 3 ya
+2 3 wa
+7 7 xxxya
+3 3 zyxa
+deallocate prepare stmt;
+# range access to t1 by 1-component keys for index idx
+explain select * from t1 where (a,b+a) IN ((4,9),(8,8),(7,7));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx idx 5 NULL 5 Using where; Rowid-ordered scan
+explain format=json select * from t1 where (a,b+a) IN ((4,9),(8,8),(7,7));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a,t1.b + t1.a) in (<cache>((4,9)),<cache>((8,8)),<cache>((7,7)))",
+ "mrr_type": "Rowid-ordered scan"
+ }
+ }
+}
+select * from t1 where (a,b+a) IN ((4,9),(8,8),(7,7));
+a b c
+4 5 ww
+4 5 wa
+# range access to t1 by 1-component keys for index idx
+explain select * from t1 where (a,b) IN ((4,a-1),(8,a+8),(7,a+7));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx idx 5 NULL 5 Using where; Rowid-ordered scan
+explain format=json select * from t1 where (a,b) IN ((4,a-1),(8,a+8),(7,a+7));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a,t1.b) in ((4,t1.a - 1),(8,t1.a + 8),(7,t1.a + 7))",
+ "mrr_type": "Rowid-ordered scan"
+ }
+ }
+}
+select * from t1 where (a,b) IN ((4,a-1),(8,a+8),(7,a+7));
+a b c
+4 3 zyx
+4 3 zya
+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');
+# join order: (t2,t1) with ref access of t1
+# range access to t1 by keys for index idx1
+explain select * from t1,t2
+where a = d and (a,e) in ((3,3),(7,7),(2,2));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range idx1,idx2 idx1 5 NULL 3 Using index condition; Using where; Rowid-ordered scan
+1 SIMPLE t1 ref idx idx 5 test.t2.d 8
+explain format=json select * from t1,t2
+where a = d and (a,e) in ((3,3),(7,7),(2,2));
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["idx1", "idx2"],
+ "key": "idx1",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "rows": 3,
+ "filtered": 100,
+ "index_condition": "t2.d is not null",
+ "attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((2,2)))",
+ "mrr_type": "Rowid-ordered scan"
+ },
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.d"],
+ "rows": 8,
+ "filtered": 100
+ }
+ }
+}
+select * from t1,t2
+where a = d and (a,e) in ((3,3),(7,7),(2,2));
+a b c d e f
+3 2 uuuw 3 3 i
+3 2 uuua 3 3 i
+3 3 zzzz 3 3 i
+3 3 zyxw 3 3 i
+3 3 zzza 3 3 i
+3 3 zyxa 3 3 i
+2 1 w 2 2 da
+2 1 wb 2 2 da
+2 2 yyy 2 2 da
+2 2 wxz 2 2 da
+2 2 yya 2 2 da
+2 2 wxa 2 2 da
+2 3 yy 2 2 da
+2 3 ww 2 2 da
+2 3 ya 2 2 da
+2 3 wa 2 2 da
+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');
+# join order: (t1,t2) with ref access of t2
+# range access to t1 by 1-component keys for index idx
+explain select * from t1,t2
+where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx idx 5 NULL 6 Using index condition; Rowid-ordered scan
+1 SIMPLE t2 ref idx1,idx2 idx1 5 test.t1.a 12 Using where
+explain format=json select * from t1,t2
+where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 6,
+ "filtered": 100,
+ "index_condition": "t1.a is not null",
+ "mrr_type": "Rowid-ordered scan"
+ },
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx1", "idx2"],
+ "key": "idx1",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "(t1.a,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1"
+ }
+ }
+}
+select * from t1,t2
+where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1;
+a b c d e f
+3 3 zzzz 3 3 i
+3 3 zzzz 3 3 i
+7 8 xxxxx 7 7 h
+7 7 xxxyy 7 7 h
+3 3 zyxw 3 3 i
+3 3 zyxw 3 3 i
+3 2 uuuw 3 3 i
+3 2 uuuw 3 3 i
+3 3 zzza 3 3 i
+3 3 zzza 3 3 i
+7 8 xxxxa 7 7 h
+7 7 xxxya 7 7 h
+3 3 zyxa 3 3 i
+3 3 zyxa 3 3 i
+3 2 uuua 3 3 i
+3 2 uuua 3 3 i
+prepare stmt from "select * from t1,t2
+where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1";
+execute stmt;
+a b c d e f
+3 3 zzzz 3 3 i
+3 3 zzzz 3 3 i
+7 8 xxxxx 7 7 h
+7 7 xxxyy 7 7 h
+3 3 zyxw 3 3 i
+3 3 zyxw 3 3 i
+3 2 uuuw 3 3 i
+3 2 uuuw 3 3 i
+3 3 zzza 3 3 i
+3 3 zzza 3 3 i
+7 8 xxxxa 7 7 h
+7 7 xxxya 7 7 h
+3 3 zyxa 3 3 i
+3 3 zyxa 3 3 i
+3 2 uuua 3 3 i
+3 2 uuua 3 3 i
+execute stmt;
+a b c d e f
+3 3 zzzz 3 3 i
+3 3 zzzz 3 3 i
+7 8 xxxxx 7 7 h
+7 7 xxxyy 7 7 h
+3 3 zyxw 3 3 i
+3 3 zyxw 3 3 i
+3 2 uuuw 3 3 i
+3 2 uuuw 3 3 i
+3 3 zzza 3 3 i
+3 3 zzza 3 3 i
+7 8 xxxxa 7 7 h
+7 7 xxxya 7 7 h
+3 3 zyxa 3 3 i
+3 3 zyxa 3 3 i
+3 2 uuua 3 3 i
+3 2 uuua 3 3 i
+deallocate prepare stmt;
+insert into t1 select * from t1;
+# join order: (t2,t1) with ref access of t1
+# range access to t2 by keys for index idx2
+explain select * from t1,t2
+where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range idx1,idx2 idx2 5 NULL 6 Using where; Rowid-ordered scan
+1 SIMPLE t1 ref idx idx 5 test.t2.d 11
+explain format=json select * from t1,t2
+where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["idx1", "idx2"],
+ "key": "idx2",
+ "key_length": "5",
+ "used_key_parts": ["e"],
+ "rows": 6,
+ "filtered": 100,
+ "attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1 and t2.d is not null",
+ "mrr_type": "Rowid-ordered scan"
+ },
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.d"],
+ "rows": 11,
+ "filtered": 100
+ }
+ }
+}
+select * from t1,t2
+where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1;
+a b c d e f
+7 7 xxxyy 7 7 h
+7 7 xxxya 7 7 h
+7 7 xxxyy 7 7 h
+7 7 xxxya 7 7 h
+7 8 xxxxx 7 7 h
+7 8 xxxxa 7 7 h
+7 8 xxxxx 7 7 h
+7 8 xxxxa 7 7 h
+alter table t2 drop index idx1, drop index idx2, add index idx3(d,e);
+# join order: (t2,t1) with ref access of t1
+# range access to t2 by 2-component keys for index idx3
+explain select * from t1,t2
+where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range idx3 idx3 10 NULL 5 Using index condition; Using where; Rowid-ordered scan
+1 SIMPLE t1 ref idx idx 5 test.t2.d 11
+explain format=json select * from t1,t2
+where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "10",
+ "used_key_parts": ["d", "e"],
+ "rows": 5,
+ "filtered": 100,
+ "index_condition": "t2.d is not null",
+ "attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1",
+ "mrr_type": "Rowid-ordered scan"
+ },
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.d"],
+ "rows": 11,
+ "filtered": 100
+ }
+ }
+}
+select * from t1,t2
+where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1;
+a b c d e f
+7 7 xxxyy 7 7 h
+7 7 xxxya 7 7 h
+7 7 xxxyy 7 7 h
+7 7 xxxya 7 7 h
+7 8 xxxxx 7 7 h
+7 8 xxxxa 7 7 h
+7 8 xxxxx 7 7 h
+7 8 xxxxa 7 7 h
+# join order: (t1,t2) with ref access of t2
+# range access to t1 by 1-component keys for index idx
+explain select * from t1,t2
+where a = d and (a,e) in ((4,d+1),(7,d+1),(8,d+1)) and length(f) = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx idx 5 NULL 15 Using index condition; Rowid-ordered scan
+1 SIMPLE t2 ref idx3 idx3 5 test.t1.a 3 Using where
+explain format=json select * from t1,t2
+where a = d and (a,e) in ((4,d+1),(7,d+1),(8,d+1)) and length(f) = 1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 15,
+ "filtered": 100,
+ "index_condition": "t1.a is not null",
+ "mrr_type": "Rowid-ordered scan"
+ },
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "(t1.a,t2.e) in ((4,t1.a + 1),(7,t1.a + 1),(8,t1.a + 1)) and length(t2.f) = 1"
+ }
+ }
+}
+select * from t1,t2
+where a = d and (a,e) in ((4,d+1),(7,d+1),(8,d+1)) and length(f) = 1;
+a b c d e f
+4 5 ww 4 5 a
+7 8 xxxxx 7 8 b
+4 3 zyx 4 5 a
+7 7 xxxyy 7 8 b
+4 5 wa 4 5 a
+7 8 xxxxa 7 8 b
+4 3 zya 4 5 a
+7 7 xxxya 7 8 b
+4 5 ww 4 5 a
+7 8 xxxxx 7 8 b
+4 3 zyx 4 5 a
+7 7 xxxyy 7 8 b
+4 5 wa 4 5 a
+7 8 xxxxa 7 8 b
+4 3 zya 4 5 a
+7 7 xxxya 7 8 b
+# join order: (t1,t2) with ref access of t2
+# no range access
+explain select * from t1,t2
+where a = d and (a,e) in ((e,d+1),(7,7),(8,8)) and length(f) = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL idx NULL NULL NULL 144 Using where
+1 SIMPLE t2 ref idx3 idx3 5 test.t1.a 3 Using where
+explain format=json select * from t1,t2
+where a = d and (a,e) in ((e,d+1),(7,7),(8,8)) and length(f) = 1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "possible_keys": ["idx"],
+ "rows": 144,
+ "filtered": 100,
+ "attached_condition": "t1.a is not null"
+ },
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "(t1.a,t2.e) in ((t2.e,t1.a + 1),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1"
+ }
+ }
+}
+select * from t1,t2
+where a = d and (a,e) in ((e,d+1),(7,7),(8,8)) and length(f) = 1;
+a b c d e f
+7 8 xxxxx 7 7 h
+7 7 xxxyy 7 7 h
+7 8 xxxxa 7 7 h
+7 7 xxxya 7 7 h
+7 8 xxxxx 7 7 h
+7 7 xxxyy 7 7 h
+7 8 xxxxa 7 7 h
+7 7 xxxya 7 7 h
+# join order: (t1,t2) with ref access of t2
+# range access to t1 by 1-component keys for index idx
+explain 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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx idx 5 NULL 13 Using index condition; Using where; Rowid-ordered scan
+1 SIMPLE t2 ref idx3 idx3 5 test.t1.a 3 Using where
+explain format=json 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;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 13,
+ "filtered": 100,
+ "index_condition": "t1.a is not null",
+ "attached_condition": "(t1.a,2) in (<cache>((2,2)),<cache>((7,7)),<cache>((8,8))) and length(t1.c) = 1",
+ "mrr_type": "Rowid-ordered scan"
+ },
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "length(t2.f) = 1"
+ }
+ }
+}
+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;
+a b c d e f
+2 1 w 2 1 e
+2 1 w 2 2 k
+2 1 w 2 3 g
+2 1 w 2 1 e
+2 1 w 2 2 k
+2 1 w 2 3 g
+prepare stmt from "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";
+execute stmt;
+a b c d e f
+2 1 w 2 1 e
+2 1 w 2 2 k
+2 1 w 2 3 g
+2 1 w 2 1 e
+2 1 w 2 2 k
+2 1 w 2 3 g
+execute stmt;
+a b c d e f
+2 1 w 2 1 e
+2 1 w 2 2 k
+2 1 w 2 3 g
+2 1 w 2 1 e
+2 1 w 2 2 k
+2 1 w 2 3 g
+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);
+# join order: (t3,t1,t2) with const t3 and ref access of t2
+# range access to t1 by 1-component keys for index idx
+explain 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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1
+1 SIMPLE t1 range idx idx 5 NULL 13 Using index condition; Using where; Rowid-ordered scan
+1 SIMPLE t2 ref idx3 idx3 5 test.t1.a 3 Using where
+explain format=json 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;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t3",
+ "access_type": "const",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["id"],
+ "ref": ["const"],
+ "rows": 1,
+ "filtered": 100
+ },
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 13,
+ "filtered": 100,
+ "index_condition": "t1.a is not null",
+ "attached_condition": "(t1.a,1 + 1) in (<cache>((2,2)),<cache>((7,7)),<cache>((8,8))) and length(t1.c) = 1",
+ "mrr_type": "Rowid-ordered scan"
+ },
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "length(t2.f) = 1"
+ }
+ }
+}
+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;
+a b c d e f id v
+2 1 w 2 1 e 1 1
+2 1 w 2 2 k 1 1
+2 1 w 2 3 g 1 1
+2 1 w 2 1 e 1 1
+2 1 w 2 2 k 1 1
+2 1 w 2 3 g 1 1
+# IN predicate is always FALSE
+explain 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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+prepare stmt from "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";
+execute stmt;
+a b c d e f id v
+execute stmt;
+a b c d e f id v
+deallocate prepare stmt;
+set optimizer_switch=@save_optimizer_switch;
+drop table t1,t2,t3;
+#
+# End of 10.2 tests
+#
set optimizer_switch=@mrr_icp_extra_tmp;
diff --git a/mysql-test/r/range_vs_index_merge_innodb.result b/mysql-test/r/range_vs_index_merge_innodb.result
index a6ec200538d..ce90f522d6e 100644
--- a/mysql-test/r/range_vs_index_merge_innodb.result
+++ b/mysql-test/r/range_vs_index_merge_innodb.result
@@ -57,7 +57,7 @@ WHERE Population < 200000 AND Name LIKE 'P%' AND
(Population > 300000 OR Name LIKE 'T%') AND
(Population < 100000 OR Name LIKE 'Pa%');
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Population,Name Name 35 NULL 235 Using index condition; Using where
+1 SIMPLE City range Population,Name Name 35 NULL 236 Using index condition; Using where
EXPLAIN
SELECT * FROM City
WHERE Population > 100000 AND Name LIKE 'Aba%' OR
@@ -65,34 +65,34 @@ Country IN ('CAN', 'ARG') AND ID BETWEEN 120 AND 130 OR
Country <= 'ALB' AND Name LIKE 'L%' OR
ID BETWEEN 3807 AND 3810;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 35,3,4 NULL 33 Using sort_union(Name,Country,PRIMARY); Using where
+1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 35,3,4 NULL 32 Using sort_union(Name,Country,PRIMARY); Using where
EXPLAIN
SELECT * FROM City
WHERE (Population > 101000 AND Population < 115000);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Population Population 4 NULL 458 Using index condition
+1 SIMPLE City range Population Population 4 NULL 459 Using index condition
EXPLAIN
SELECT * FROM City
WHERE (Population > 101000 AND Population < 102000);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Population Population 4 NULL 38 Using index condition
+1 SIMPLE City range Population Population 4 NULL 39 Using index condition
EXPLAIN
SELECT * FROM City
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge Country,Name Name,Country 35,3 NULL 213 Using sort_union(Name,Country); Using where
+1 SIMPLE City index_merge Country,Name Name,Country 35,3 NULL 215 Using sort_union(Name,Country); Using where
EXPLAIN
SELECT * FROM City
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
AND (Population > 101000 AND Population < 115000);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge Population,Country,Name Name,Country 35,3 NULL 213 Using sort_union(Name,Country); Using where
+1 SIMPLE City index_merge Population,Country,Name Name,Country 35,3 NULL 215 Using sort_union(Name,Country); Using where
EXPLAIN
SELECT * FROM City
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
AND (Population > 101000 AND Population < 102000);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Population,Country,Name Population 4 NULL 38 Using index condition; Using where
+1 SIMPLE City range Population,Country,Name Population 4 NULL 39 Using index condition; Using where
SELECT * FROM City USE INDEX ()
WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
AND (Population > 101000 AND Population < 115000);
@@ -176,11 +176,11 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN
SELECT * FROM City WHERE (Name < 'Bb');
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Name Name 35 NULL 373 Using index condition
+1 SIMPLE City range Name Name 35 NULL 374 Using index condition
EXPLAIN
SELECT * FROM City WHERE (Country > 'A' AND Country < 'B');
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Country Country 3 NULL 106 Using index condition
+1 SIMPLE City range Country Country 3 NULL 107 Using index condition
EXPLAIN
SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'Pb');
id select_type table type possible_keys key key_len ref rows Extra
@@ -188,15 +188,15 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN
SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'S');
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Name Name 35 NULL 384 Using index condition
+1 SIMPLE City range Name Name 35 NULL 385 Using index condition
EXPLAIN
SELECT * FROM City WHERE (Population > 101000 AND Population < 110000);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Population Population 4 NULL 327 Using index condition
+1 SIMPLE City range Population Population 4 NULL 328 Using index condition
EXPLAIN
SELECT * FROM City WHERE (Population > 103000 AND Population < 104000);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Population Population 4 NULL 36 Using index condition
+1 SIMPLE City range Population Population 4 NULL 37 Using index condition
EXPLAIN
SELECT * FROM City
WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
@@ -208,19 +208,19 @@ SELECT * FROM City
WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
(Name BETWEEN 'P' AND 'S' AND (Population > 103000 AND Population < 104000));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge Population,Country,Name Name,Population 35,4 NULL 59 Using sort_union(Name,Population); Using where
+1 SIMPLE City index_merge Population,Country,Name Name,Population 35,4 NULL 60 Using sort_union(Name,Population); Using where
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));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge Population,Country,Name Country,Name 3,35 NULL 177 Using sort_union(Country,Name); Using where
+1 SIMPLE City index_merge Population,Country,Name Country,Name 3,35 NULL 178 Using sort_union(Country,Name); Using where
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));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge Population,Country,Name Country,Population 3,4 NULL 142 Using sort_union(Country,Population); Using where
+1 SIMPLE City index_merge Population,Country,Name Country,Population 3,4 NULL 144 Using sort_union(Country,Population); Using where
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));
@@ -336,15 +336,15 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN
SELECT * FROM City WHERE (ID < 600) OR (ID BETWEEN 900 AND 1500);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range PRIMARY PRIMARY 4 NULL 1198 Using where
+1 SIMPLE City range PRIMARY PRIMARY 4 NULL 1200 Using where
EXPLAIN
SELECT * FROM City WHERE Country > 'A' AND Country < 'ARG';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Country Country 3 NULL 19 Using index condition
+1 SIMPLE City range Country Country 3 NULL 20 Using index condition
EXPLAIN
SELECT * FROM City WHERE Name LIKE 'H%' OR Name LIKE 'P%' ;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Name Name 35 NULL 394 Using index condition; Using where
+1 SIMPLE City range Name Name 35 NULL 395 Using index condition; Using where
EXPLAIN
SELECT * FROM City WHERE Name LIKE 'Ha%' OR Name LIKE 'Pa%' ;
id select_type table type possible_keys key key_len ref rows Extra
@@ -362,14 +362,14 @@ 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)));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 39,3,4 NULL 680 Using sort_union(Name,Country,PRIMARY); Using where
+1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 39,3,4 NULL 683 Using sort_union(Name,Country,PRIMARY); Using where
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)));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Population,PRIMARY 39,4,4 NULL 305 Using sort_union(Name,Population,PRIMARY); Using where
+1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Population,PRIMARY 39,4,4 NULL 307 Using sort_union(Name,Population,PRIMARY); Using where
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
@@ -577,11 +577,11 @@ ID Name Country Population
EXPLAIN
SELECT * FROM City WHERE Population > 101000 AND Population < 102000;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Population Population 4 NULL 38 Using index condition
+1 SIMPLE City range Population Population 4 NULL 39 Using index condition
EXPLAIN
SELECT * FROM City WHERE Population > 101000 AND Population < 110000;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Population Population 4 NULL 327 Using index condition
+1 SIMPLE City range Population Population 4 NULL 328 Using index condition
EXPLAIN
SELECT * FROM City WHERE Country < 'C';
id select_type table type possible_keys key key_len ref rows Extra
@@ -593,7 +593,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN
SELECT * FROM City WHERE Name BETWEEN 'P' AND 'S';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Name Name 35 NULL 384 Using index condition
+1 SIMPLE City range Name Name 35 NULL 385 Using index condition
EXPLAIN
SELECT * FROM City WHERE Name BETWEEN 'P' AND 'Pb';
id select_type table type possible_keys key key_len ref rows Extra
@@ -601,7 +601,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN
SELECT * FROM City WHERE ID BETWEEN 3400 AND 3800;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range PRIMARY PRIMARY 4 NULL 400 Using where
+1 SIMPLE City range PRIMARY PRIMARY 4 NULL 401 Using where
EXPLAIN
SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800;
id select_type table type possible_keys key key_len ref rows Extra
@@ -609,7 +609,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN
SELECT * FROM City WHERE Name LIKE 'P%';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Name Name 35 NULL 235 Using index condition
+1 SIMPLE City range Name Name 35 NULL 236 Using index condition
EXPLAIN
SELECT * FROM City
WHERE ((Population > 101000 AND Population < 102000) AND
@@ -617,7 +617,7 @@ WHERE ((Population > 101000 AND Population < 102000) AND
((ID BETWEEN 3400 AND 3800) AND
(Country < 'AGO' OR Name LIKE 'Pa%'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge PRIMARY,Population,Country,Name Population,PRIMARY 4,4 NULL 438 Using sort_union(Population,PRIMARY); Using where
+1 SIMPLE City index_merge PRIMARY,Population,Country,Name Population,PRIMARY 4,4 NULL 440 Using sort_union(Population,PRIMARY); Using where
EXPLAIN
SELECT * FROM City
WHERE ((Population > 101000 AND Population < 110000) AND
@@ -684,11 +684,11 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN
SELECT * FROM City WHERE Name LIKE 'P%';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Name Name 35 NULL 235 Using index condition
+1 SIMPLE City range Name Name 35 NULL 236 Using index condition
EXPLAIN
SELECT * FROM City WHERE (Population > 101000 AND Population < 103000);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Population Population 4 NULL 80 Using index condition
+1 SIMPLE City range Population Population 4 NULL 81 Using index condition
EXPLAIN
SELECT * FROM City WHERE Country='USA';
id select_type table type possible_keys key key_len ref rows Extra
@@ -702,7 +702,7 @@ SELECT * FROM City
WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%')
AND Country='USA';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge Population,Country,Name,CountryPopulation CountryPopulation,Name 7,35 NULL 17 Using sort_union(CountryPopulation,Name); Using where
+1 SIMPLE City index_merge Population,Country,Name,CountryPopulation CountryPopulation,Name 7,35 NULL 18 Using sort_union(CountryPopulation,Name); Using where
EXPLAIN
SELECT * FROM City
WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'P%')
@@ -777,7 +777,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN
SELECT * FROM City WHERE ID BETWEEN 3500 AND 3800;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range PRIMARY PRIMARY 4 NULL 300 Using where
+1 SIMPLE City range PRIMARY PRIMARY 4 NULL 301 Using where
EXPLAIN
SELECT * FROM City WHERE ID BETWEEN 4000 AND 4300;
id select_type table type possible_keys key key_len ref rows Extra
@@ -789,11 +789,11 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN
SELECT * FROM City WHERE (Population > 101000 AND Population < 102000);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Population Population 4 NULL 38 Using index condition
+1 SIMPLE City range Population Population 4 NULL 39 Using index condition
EXPLAIN
SELECT * FROM City WHERE (Population > 101000 AND Population < 103000);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City range Population Population 4 NULL 80 Using index condition
+1 SIMPLE City range Population Population 4 NULL 81 Using index condition
EXPLAIN
SELECT * FROM City WHERE Name LIKE 'Pa%';
id select_type table type possible_keys key key_len ref rows Extra
@@ -806,7 +806,7 @@ 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);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryPopulation,PRIMARY 7,4 NULL 13 Using sort_union(CountryPopulation,PRIMARY); Using where
+1 SIMPLE City index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryPopulation,PRIMARY 7,4 NULL 14 Using sort_union(CountryPopulation,PRIMARY); Using where
EXPLAIN
SELECT * FROM City
WHERE ((Population > 101000 AND Population < 103000) OR
@@ -869,7 +869,7 @@ 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';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryPopulation,CountryName,PRIMARY 7,38,4 NULL 35 Using sort_union(CountryPopulation,CountryName,PRIMARY); Using where
+1 SIMPLE City index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryPopulation,CountryName,PRIMARY 7,38,4 NULL 36 Using sort_union(CountryPopulation,CountryName,PRIMARY); Using where
SELECT * FROM City USE INDEX ()
WHERE ((Population > 101000 and Population < 102000) OR
ID BETWEEN 3790 AND 3800) AND Country='USA'
@@ -1448,7 +1448,7 @@ explain
select * from t1
where (home_state = 'ia' or work_state='ia') and account_id = 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge account_id,user_home_state_indx,user_work_state_indx user_home_state_indx,user_work_state_indx 3,3 NULL 10 Using union(user_home_state_indx,user_work_state_indx); Using where
+1 SIMPLE t1 index_merge account_id,user_home_state_indx,user_work_state_indx user_home_state_indx,user_work_state_indx 3,3 NULL 12 Using union(user_home_state_indx,user_work_state_indx); Using where
drop table t1;
CREATE TABLE t1 (
c1 int(11) NOT NULL auto_increment,
@@ -1796,7 +1796,7 @@ 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';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range state,capital state 71 NULL 10 Using index condition; Using where
+1 SIMPLE t1 range state,capital state 71 NULL 12 Using index condition; Using where
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';
diff --git a/mysql-test/r/read_only.result b/mysql-test/r/read_only.result
index 0640360f4f5..2029413c0f0 100644
--- a/mysql-test/r/read_only.result
+++ b/mysql-test/r/read_only.result
@@ -2,7 +2,7 @@ set @start_read_only= @@global.read_only;
DROP TABLE IF EXISTS t1,t2,t3;
create user test@localhost;
grant CREATE, SELECT, DROP on *.* to test@localhost;
-connect (con1,localhost,test,,test);
+connect con1,localhost,test,,test;
connection default;
set global read_only=0;
connection con1;
@@ -114,7 +114,7 @@ set global read_only=0;
flush tables with read lock;
set global read_only=1;
unlock tables;
-connect (root2,localhost,root,,test);
+connect root2,localhost,root,,test;
connection default;
set global read_only=0;
flush tables with read lock;
@@ -125,6 +125,7 @@ select @@global.read_only;
@@global.read_only
1
unlock tables;
+disconnect root2;
drop temporary table ttt;
ERROR 42S02: Unknown table 'test.ttt'
drop temporary table if exists ttt;
@@ -132,6 +133,7 @@ Warnings:
Note 1051 Unknown table 'test.ttt'
connection default;
set global read_only=0;
+disconnect con1;
drop table t1,t2;
drop user test@localhost;
#
@@ -150,7 +152,7 @@ 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,);
+connect con_bug27440,127.0.0.1,mysqltest_u1,,test,$MASTER_MYPORT,;
connection con_bug27440;
create database mysqltest_db2;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
@@ -176,6 +178,8 @@ DROP TABLE IF EXISTS t1;
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;
# All allowed with super privilege
START TRANSACTION;
@@ -186,6 +190,7 @@ START TRANSACTION READ WRITE;
COMMIT;
# We allow implicit RW transaction without super privilege
# for compatibility reasons
+connection con1;
START TRANSACTION;
# Check that table updates are still disallowed.
INSERT INTO t1 VALUES (3);
@@ -201,6 +206,8 @@ COMMIT;
START TRANSACTION READ WRITE;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
COMMIT;
+disconnect con1;
+connection default;
DROP USER user1;
SET GLOBAL read_only= 0;
DROP TABLE t1;
diff --git a/mysql-test/r/read_only_innodb.result b/mysql-test/r/read_only_innodb.result
index 58e473ff695..b6e294b633c 100644
--- a/mysql-test/r/read_only_innodb.result
+++ b/mysql-test/r/read_only_innodb.result
@@ -1,11 +1,16 @@
DROP TABLE IF EXISTS table_11733 ;
create user test@localhost;
grant CREATE, SELECT, DROP on *.* to test@localhost;
+connect con1,localhost,test,,test;
+connection default;
set global read_only=0;
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;
@@global.read_only
1
@@ -14,14 +19,19 @@ a
11733
COMMIT;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
+connection default;
set global read_only=0;
drop table table_11733 ;
drop user test@localhost;
+disconnect con1;
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;
a
0
@@ -32,8 +42,10 @@ a
0
1
COMMIT;
+connection default;
SET GLOBAL read_only=0;
FLUSH TABLES WITH READ LOCK;
+connection con1;
SELECT * FROM t1;
a
0
@@ -44,6 +56,7 @@ a
0
1
COMMIT;
+connection default;
UNLOCK TABLES;
connection con1;
lock table t1 read;
@@ -56,6 +69,7 @@ SET GLOBAL read_only=0;
UNLOCK TABLES;
DROP TABLE t1;
DROP USER test@localhost;
+disconnect con1;
echo End of 5.1 tests
#
# Bug#33669: Transactional temporary tables do not work under --read-only
@@ -71,7 +85,7 @@ 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;
-# Connection con1 (user bug33669):
+connect con1,localhost,bug33669,,db1;
# Create, insert and drop temporary table:
@@ -233,6 +247,8 @@ DROP TABLE temp1;
# Disconnect and cleanup
+disconnect con1;
+connection default;
SET GLOBAL READ_ONLY = OFF;
DROP USER bug33669@localhost;
DROP DATABASE db1;
diff --git a/mysql-test/r/rename.result b/mysql-test/r/rename.result
index 74370ba74dd..2b8c925b309 100644
--- a/mysql-test/r/rename.result
+++ b/mysql-test/r/rename.result
@@ -40,20 +40,31 @@ select * from t3;
drop table if exists t1,t2,t3,t4;
Warnings:
Note 1051 Unknown table 'test.t4'
+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;
RENAME TABLE t1 TO t2, t3 to t4;
+connection con2;
show tables;
Tables_in_test
t1
t3
UNLOCK TABLES;
+connection con1;
+connection con2;
show tables;
Tables_in_test
t2
t4
drop table t2, t4;
+disconnect con2;
+disconnect con1;
+connection default;
End of 4.1 tests
#
# Bug#14959: "ALTER TABLE isn't able to rename a view"
diff --git a/mysql-test/r/reopen_temp_table.result b/mysql-test/r/reopen_temp_table.result
new file mode 100644
index 00000000000..217aa3c8bad
--- /dev/null
+++ b/mysql-test/r/reopen_temp_table.result
@@ -0,0 +1,192 @@
+#
+# MDEV-5535: Cannot reopen temporary table
+#
+DROP DATABASE IF EXISTS temp_db;
+CREATE DATABASE temp_db;
+USE temp_db;
+#
+# Reopen temporary table
+#
+CREATE TEMPORARY TABLE t1(i int)ENGINE=INNODB;
+INSERT INTO t1 VALUES(1), (2);
+SELECT * FROM t1 a, t1 b;
+i i
+1 1
+2 1
+1 2
+2 2
+DROP TABLE t1;
+#
+# CREATE & Stored routines
+#
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+DROP TEMPORARY TABLE t1;
+RETURN 1;
+END|
+CREATE TEMPORARY TABLE t1 AS SELECT f1();
+ERROR 42S02: Unknown table 'temp_db.t1'
+DROP FUNCTION f1;
+CREATE FUNCTION f2() RETURNS INT
+BEGIN
+CREATE TEMPORARY TABLE t2(i INT);
+INSERT INTO t2 VALUES(1), (2);
+RETURN 1;
+END|
+CREATE TEMPORARY TABLE t2 AS SELECT f2();
+ERROR 42S01: Table 't2' already exists
+SELECT * FROM t2;
+i
+1
+2
+DROP TABLE t2;
+DROP FUNCTION f2;
+CREATE TEMPORARY TABLE t3 AS SELECT 1 AS a;
+CREATE PROCEDURE p1()
+BEGIN
+DROP TEMPORARY TABLE t3;
+end|
+CREATE FUNCTION f3() RETURNS INT
+BEGIN
+CALL p1();
+RETURN 1;
+END|
+PREPARE STMT FROM "SELECT f3() AS my_Column, a FROM t3";
+EXECUTE STMT;
+ERROR HY000: Can't reopen table: 't3'
+DROP TABLE t3;
+DROP FUNCTION f3;
+DROP PROCEDURE p1;
+CREATE TEMPORARY TABLE t4 (i INT);
+INSERT INTO t4 VALUES(1), (2);
+CREATE FUNCTION f4() RETURNS INT
+BEGIN
+DROP TEMPORARY TABLE t4;
+RETURN 1;
+END|
+SELECT f4() FROM t4;
+ERROR HY000: Can't reopen table: 't4'
+SELECT * FROM t4;
+i
+1
+2
+DROP TABLE t4;
+DROP FUNCTION f4;
+CREATE TEMPORARY TABLE t5 AS SELECT 1 AS a;
+CREATE PROCEDURE p2()
+BEGIN
+DROP TEMPORARY TABLE t5;
+END|
+CREATE FUNCTION f5() RETURNS INT
+BEGIN
+CALL p2();
+RETURN 1;
+END|
+SELECT f5() AS my_column, a FROM t5;
+ERROR HY000: Can't reopen table: 't5'
+DROP TABLE t5;
+DROP FUNCTION f5;
+DROP PROCEDURE p2;
+#
+# CTAS
+#
+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;
+a b
+1 1
+2 1
+1 2
+2 2
+DROP TABLE t1;
+SELECT * FROM t1;
+i
+1
+2
+DROP TABLE t1;
+#
+# HANDLER
+#
+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;
+a
+1
+2
+3
+4
+5
+LOCK TABLE t1 READ;
+HANDLER t3 OPEN;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+UNLOCK TABLES;
+HANDLER t3 OPEN;
+ERROR 42000: Not unique table/alias: 't3'
+HANDLER t3 READ NEXT;
+a
+1
+HANDLER t3 OPEN AS t3_1;
+HANDLER t3_1 READ NEXT;
+a
+1
+HANDLER t3_1 READ NEXT;
+a
+2
+HANDLER t3 CLOSE;
+HANDLER t3_1 CLOSE;
+DROP TEMPORARY TABLE t3;
+DROP TABLE t1, t2;
+#
+# INSERT-SELECT
+#
+CREATE TEMPORARY TABLE t4 (a INT) ENGINE=MYISAM;
+INSERT INTO t4 VALUES(1), (2);
+INSERT INTO t4 SELECT * FROM t4;
+SELECT COUNT(*) FROM t4;
+COUNT(*)
+4
+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;
+COUNT(*)=6
+1
+SELECT COUNT(*)=4 FROM t6;
+COUNT(*)=4
+1
+DROP TABLE t5, t6;
+#
+# MDEV-10216: Assertion `strcmp(share->unique_file_name,filename) ||
+# share->last_version' failed in myisam/mi_open.c:67: test_if_reopen
+#
+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;
+i i
+1 1
+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;
+i i
+1 1
+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;
+f1 f2
+NULL NULL
+DROP TABLE t;
+# Cleanup
+DROP DATABASE temp_db;
diff --git a/mysql-test/r/replace.result b/mysql-test/r/replace.result
index 59b8565f671..9590a97e10a 100644
--- a/mysql-test/r/replace.result
+++ b/mysql-test/r/replace.result
@@ -27,6 +27,6 @@ drop table t1;
CREATE TABLE t1 (f1 INT);
CREATE VIEW v1 AS SELECT f1 FROM t1 WHERE f1 = 0 WITH CHECK OPTION;
REPLACE INTO v1 (f1) VALUES (1);
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
DROP TABLE t1;
DROP VIEW v1;
diff --git a/mysql-test/r/round.result b/mysql-test/r/round.result
index 49a00885f34..a3e9f18843d 100644
--- a/mysql-test/r/round.result
+++ b/mysql-test/r/round.result
@@ -3,7 +3,7 @@ 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 INTO t1 VALUES ('127.5');
+INSERT IGNORE INTO t1 VALUES ('127.5');
Warnings:
Warning 1264 Out of range value for column 'sint8' at row 1
INSERT INTO t1 VALUES ('-0.1');
@@ -11,7 +11,7 @@ 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 INTO t1 VALUES ('-128.5');
+INSERT IGNORE INTO t1 VALUES ('-128.5');
Warnings:
Warning 1264 Out of range value for column 'sint8' at row 1
SELECT * FROM t1;
@@ -33,11 +33,11 @@ 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 INTO t1 VALUES ('-0.5');
+INSERT IGNORE INTO t1 VALUES ('-0.5');
Warnings:
Warning 1264 Out of range value for column 'uint8' at row 1
INSERT INTO t1 VALUES ('255.4');
-INSERT INTO t1 VALUES ('255.5');
+INSERT IGNORE INTO t1 VALUES ('255.5');
Warnings:
Warning 1264 Out of range value for column 'uint8' at row 1
SELECT * FROM t1;
@@ -55,7 +55,7 @@ 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 INTO t1 VALUES ('32767.5');
+INSERT IGNORE INTO t1 VALUES ('32767.5');
Warnings:
Warning 1264 Out of range value for column 'sint16' at row 1
INSERT INTO t1 VALUES ('-0.1');
@@ -63,7 +63,7 @@ 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 INTO t1 VALUES ('-32768.5');
+INSERT IGNORE INTO t1 VALUES ('-32768.5');
Warnings:
Warning 1264 Out of range value for column 'sint16' at row 1
SELECT * FROM t1;
@@ -85,11 +85,11 @@ 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 INTO t1 VALUES ('-0.5');
+INSERT IGNORE INTO t1 VALUES ('-0.5');
Warnings:
Warning 1264 Out of range value for column 'uint16' at row 1
INSERT INTO t1 VALUES ('65535.4');
-INSERT INTO t1 VALUES ('65535.5');
+INSERT IGNORE INTO t1 VALUES ('65535.5');
Warnings:
Warning 1264 Out of range value for column 'uint16' at row 1
SELECT * FROM t1;
@@ -107,7 +107,7 @@ 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 INTO t1 VALUES ('8388607.5');
+INSERT IGNORE INTO t1 VALUES ('8388607.5');
Warnings:
Warning 1264 Out of range value for column 'sint24' at row 1
INSERT INTO t1 VALUES ('-0.1');
@@ -115,7 +115,7 @@ 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 INTO t1 VALUES ('-8388608.5');
+INSERT IGNORE INTO t1 VALUES ('-8388608.5');
Warnings:
Warning 1264 Out of range value for column 'sint24' at row 1
SELECT * FROM t1;
@@ -137,11 +137,11 @@ 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 INTO t1 VALUES ('-0.5');
+INSERT IGNORE INTO t1 VALUES ('-0.5');
Warnings:
Warning 1264 Out of range value for column 'uint24' at row 1
INSERT INTO t1 VALUES ('16777215.4');
-INSERT INTO t1 VALUES ('16777215.5');
+INSERT IGNORE INTO t1 VALUES ('16777215.5');
Warnings:
Warning 1264 Out of range value for column 'uint24' at row 1
SELECT * FROM t1;
@@ -159,7 +159,7 @@ 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 INTO t1 VALUES ('9223372036854775807.5');
+INSERT IGNORE INTO t1 VALUES ('9223372036854775807.5');
Warnings:
Warning 1264 Out of range value for column 'sint64' at row 1
INSERT INTO t1 VALUES ('-0.1');
@@ -167,7 +167,7 @@ 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 INTO t1 VALUES ('-9223372036854775808.5');
+INSERT IGNORE INTO t1 VALUES ('-9223372036854775808.5');
Warnings:
Warning 1264 Out of range value for column 'sint64' at row 1
SELECT * FROM t1;
@@ -189,11 +189,11 @@ 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 INTO t1 VALUES ('-0.5');
+INSERT IGNORE INTO t1 VALUES ('-0.5');
Warnings:
Warning 1264 Out of range value for column 'uint64' at row 1
INSERT INTO t1 VALUES ('18446744073709551615.4');
-INSERT INTO t1 VALUES ('18446744073709551615.5');
+INSERT IGNORE INTO t1 VALUES ('18446744073709551615.5');
Warnings:
Warning 1264 Out of range value for column 'uint64' at row 1
INSERT INTO t1 VALUES ('1844674407370955161.0');
diff --git a/mysql-test/r/row-checksum-old.result b/mysql-test/r/row-checksum-old.result
index ef523463860..87cd1cc89ed 100644
--- a/mysql-test/r/row-checksum-old.result
+++ b/mysql-test/r/row-checksum-old.result
@@ -71,17 +71,15 @@ checksum table t1 extended;
Table Checksum
test.t1 4108368782
drop table if exists t1;
-create table t1 (a int null, v varchar(100)) engine=innodb checksum=0 row_format=fixed;
-Warnings:
-Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+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;
Table Checksum
-test.t1 4108368782
+test.t1 452555338
checksum table t1 quick;
Table Checksum
test.t1 NULL
checksum table t1 extended;
Table Checksum
-test.t1 4108368782
+test.t1 452555338
drop table t1;
diff --git a/mysql-test/r/row-checksum.result b/mysql-test/r/row-checksum.result
index fb8a1260a1d..f2e687f8b6e 100644
--- a/mysql-test/r/row-checksum.result
+++ b/mysql-test/r/row-checksum.result
@@ -71,17 +71,15 @@ checksum table t1 extended;
Table Checksum
test.t1 3885665021
drop table if exists t1;
-create table t1 (a int null, v varchar(100)) engine=innodb checksum=0 row_format=fixed;
-Warnings:
-Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+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;
Table Checksum
-test.t1 3885665021
+test.t1 229851577
checksum table t1 quick;
Table Checksum
test.t1 NULL
checksum table t1 extended;
Table Checksum
-test.t1 3885665021
+test.t1 229851577
drop table t1;
diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result
index 9a19c3b0604..7483f37970f 100644
--- a/mysql-test/r/row.result
+++ b/mysql-test/r/row.result
@@ -49,7 +49,7 @@ explain extended select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,N
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select ((1,2,(3,4)) in ((3,2,(3,4)),(1,2,(3,NULL)))) AS `row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))`
+Note 1003 select (1,2,(3,4)) in ((3,2,(3,4)),(1,2,(3,NULL))) AS `row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))`
select row(1,2,row(3,null)) IN (row(3,2,row(3,4)), row(1,2,row(4,5)));
row(1,2,row(3,null)) IN (row(3,2,row(3,4)), row(1,2,row(4,5)))
0
@@ -354,12 +354,12 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a 1 Using index
SELECT * FROM t1,t2 WHERE t1.a=1 and t1.b=t2.b;
a b a b c
-1 1 1 1 2
-1 1 3 1 3
-1 2 1 2 2
1 1 1 1 1
+1 1 1 1 2
1 1 3 1 1
+1 1 3 1 3
1 2 1 2 1
+1 2 1 2 2
SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,2);
a b a b c
1 2 1 1 1
@@ -373,7 +373,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 100.00 Using index
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = (`test`.`t2`.`b` + 1)))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b` + 1
SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b+1);
a b a b c
1 2 1 1 1
@@ -385,13 +385,13 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 8 NULL 6 100.00 Using index
1 SIMPLE t2 index NULL PRIMARY 12 NULL 7 100.00 Using where; Using index; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where (((`test`.`t1`.`a` - 1) = (`test`.`t2`.`a` - 1)) and (`test`.`t1`.`b` = (`test`.`t2`.`b` + 1)))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` - 1 = `test`.`t2`.`a` - 1 and `test`.`t1`.`b` = `test`.`t2`.`b` + 1
SELECT * FROM t1,t2 WHERE (t1.a-1,t1.b)=(t2.a-1,t2.b+1);
a b a b c
-1 2 1 1 2
-3 2 3 1 3
1 2 1 1 1
+1 2 1 1 2
3 2 3 1 1
+3 2 3 1 3
EXPLAIN SELECT * FROM t2 WHERE a=3 AND b=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref PRIMARY PRIMARY 8 const,const 1 Using index
@@ -411,7 +411,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 100.00 Using index
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`c` = 1))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t2`.`b` = 2 and `test`.`t2`.`c` = 1
SELECT * FROM t1,t2 WHERE (t2.a,(t2.b,t2.c))=(t1.a,(2,1));
a b a b c
1 1 1 2 1
@@ -421,7 +421,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 100.00 Using index
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`c` = 1))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t2`.`b` = 2 and `test`.`t2`.`c` = 1
SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1);
a b a b c
1 1 1 2 1
@@ -507,12 +507,12 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND b=10 AND a>=10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 10) and (`test`.`t1`.`b` = 10))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 10 and `test`.`t1`.`b` = 10
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,b)=(10,10) AND a>=10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 10) and (`test`.`t1`.`b` = 10))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 10 and `test`.`t1`.`b` = 10
DROP TABLE t1;
#
# MDEV-9369 IN operator with ( num, NULL ) gives inconsistent result
diff --git a/mysql-test/r/rpl_mysqldump_slave.result b/mysql-test/r/rpl_mysqldump_slave.result
index 9d2fe860f47..903b671178f 100644
--- a/mysql-test/r/rpl_mysqldump_slave.result
+++ b/mysql-test/r/rpl_mysqldump_slave.result
@@ -3,7 +3,10 @@ include/master-slave.inc
#
# New --dump-slave, --apply-slave-statements functionality
#
+connection slave;
+connection master;
use test;
+connection slave;
-- SET GLOBAL gtid_slave_pos='';
CHANGE MASTER '' TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START;
STOP ALL SLAVES;
@@ -23,9 +26,12 @@ start slave;
Warnings:
Note 1254 Slave is already running
*** Test mysqldump --dump-slave GTID functionality.
+connection master;
SET gtid_seq_no = 1000;
CREATE TABLE t1 (a INT PRIMARY KEY);
DROP TABLE t1;
+connection slave;
+connection slave;
CREATE TABLE t2 (a INT PRIMARY KEY);
DROP TABLE t2;
diff --git a/mysql-test/r/schema.result b/mysql-test/r/schema.result
index bb6dbd65f84..6d8271a49f3 100644
--- a/mysql-test/r/schema.result
+++ b/mysql-test/r/schema.result
@@ -16,80 +16,90 @@ drop schema foo;
# Bug #48940 MDL deadlocks against mysql_rm_db
#
DROP SCHEMA IF EXISTS schema1;
-# Connection default
+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 2
+connection con2;
DROP SCHEMA schema1;
-# Connection default
+connection default;
ALTER SCHEMA schema1 DEFAULT CHARACTER SET utf8;
Got one of the listed errors
SET autocommit= TRUE;
-# Connection 2
-# Connection default
+connection con2;
+connection default;
+disconnect con2;
#
# Bug #49988 MDL deadlocks with mysql_create_db, reload_acl_and_cache
#
DROP SCHEMA IF EXISTS schema1;
-# Connection default
+connect con2, localhost, root;
+connection default;
CREATE SCHEMA schema1;
CREATE TABLE schema1.t1 (id INT);
LOCK TABLE schema1.t1 WRITE;
-# Connection con2
+connection con2;
DROP SCHEMA schema1;
-# Connection default
+connection default;
# CREATE SCHEMA used to give a deadlock.
# Now we prohibit CREATE SCHEMA in LOCK TABLES mode.
CREATE SCHEMA IF NOT EXISTS schema1;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
# UNLOCK TABLES so DROP SCHEMA can continue.
UNLOCK TABLES;
-# Connection con2
-# Connection default
+connection con2;
+connection default;
+disconnect con2;
#
# Bug#54360 Deadlock DROP/ALTER/CREATE DATABASE with open HANDLER
#
CREATE DATABASE db1;
CREATE TABLE db1.t1 (a INT);
INSERT INTO db1.t1 VALUES (1), (2);
-# Connection con1
+connect con1, localhost, root;
HANDLER db1.t1 OPEN;
-# Connection default
+connection default;
# Sending:
DROP DATABASE db1;
-# Connection con2
-# Connection con1
+connect con2, localhost, root;
+connection con1;
CREATE DATABASE db2;
ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
DROP DATABASE db2;
HANDLER t1 CLOSE;
-# Connection default
+connection default;
# Reaping: DROP DATABASE db1
+disconnect con1;
+disconnect con2;
#
# Tests for increased CREATE/ALTER/DROP DATABASE concurrency with
# database name locks.
#
DROP DATABASE IF EXISTS db1;
DROP DATABASE IF EXISTS db2;
-# Connection default
+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 2
+connection con2;
# DROP DATABASE should block due to the active transaction
# Sending:
DROP DATABASE db1;
-# Connection 3
+connection con3;
# 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
+connection default;
# End the transaction so DROP DATABASE db1 can continue
COMMIT;
-# Connection 2
+connection con2;
# Reaping: DROP DATABASE db1
-# Connection default;
+connection default;
+disconnect con2;
+disconnect con3;
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 787e321dd57..010f37757e0 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -606,7 +606,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
+1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
1 SIMPLE t3 ref period period 4 test.t1.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
id select_type table type possible_keys key key_len ref rows Extra
@@ -1510,7 +1510,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
Warnings:
-Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> ''))
+Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> ''
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
@@ -2817,7 +2817,7 @@ i='1e+01' i=1e+01 i in (1e+01,1e+01) i in ('1e+01','1e+01')
1 1 1 1
DROP TABLE t1;
create table t1(a bigint unsigned, b bigint);
-insert into t1 values (0xfffffffffffffffff, 0xfffffffffffffffff),
+insert ignore into t1 values (0xfffffffffffffffff, 0xfffffffffffffffff),
(0x10000000000000000, 0x10000000000000000),
(0x8fffffffffffffff, 0x8fffffffffffffff);
Warnings:
@@ -3404,7 +3404,7 @@ f1 f2 f2
NULL a NULL
drop table t1,t2;
select * from (select * left join t on f1=f2) tt;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'on f1=f2) tt' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'left join t on f1=f2) tt' at line 1
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
@@ -4395,12 +4395,12 @@ EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2
DROP TABLE t1;
#
# Bug#47019: Assertion failed: 0, file .\rt_mbr.c, line 138 when
@@ -4448,7 +4448,7 @@ DROP TABLE t1;
# memory
#
CREATE TABLE t1(a INT NOT NULL, b YEAR);
-INSERT INTO t1 VALUES ();
+INSERT IGNORE INTO t1 VALUES ();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
CREATE TABLE t2(c INT);
@@ -4549,7 +4549,7 @@ DROP TABLE t1;
SET @old_sort_buffer_size= @@session.sort_buffer_size;
SET @@sort_buffer_size= 40000;
CREATE TABLE t1(a CHAR(0) NOT NULL);
-INSERT INTO t1 VALUES (0), (0), (0);
+INSERT IGNORE INTO t1 VALUES (0), (0), (0);
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;
@@ -4559,7 +4559,7 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT a FROM t1 ORDER BY a;
DROP TABLE t1;
CREATE TABLE t1(a CHAR(0) NOT NULL, b CHAR(0) NOT NULL, c int);
-INSERT INTO t1 VALUES (0, 0, 0), (0, 0, 2), (0, 0, 1);
+INSERT IGNORE INTO t1 VALUES (0, 0, 0), (0, 0, 2), (0, 0, 1);
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;
@@ -4767,7 +4767,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1 + 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = <cache>((1 + 1)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = <cache>(1 + 1)
SELECT * FROM t1 HAVING a = 1 + 1;
a
2
@@ -4775,7 +4775,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 HAVING a = 1 + 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having (`test`.`t1`.`a` = <cache>((1 + 1)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having `test`.`t1`.`a` = <cache>(1 + 1)
SELECT * FROM t1, t2 WHERE a = b + (1 + 1);
a b
4 2
@@ -4784,7 +4784,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,2 AS `b` from `test`.`t1` where (`test`.`t1`.`a` = <cache>((2 + (1 + 1))))
+Note 1003 select `test`.`t1`.`a` AS `a`,2 AS `b` from `test`.`t1` where `test`.`t1`.`a` = <cache>(2 + (1 + 1))
SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
b a
2 3
@@ -4798,7 +4798,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00'
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > <cache>(unix_timestamp('2009-03-10 00:00:00')))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > <cache>(unix_timestamp('2009-03-10 00:00:00'))
CREATE FUNCTION f1() RETURNS INT DETERMINISTIC
BEGIN
SET @cnt := @cnt + 1;
@@ -4815,7 +4815,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = f1();
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = <cache>(`f1`()))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = <cache>(`f1`())
DROP TABLE t1, t2;
DROP FUNCTION f1;
# End of bug#33546
@@ -4870,7 +4870,7 @@ CREATE TABLE t1(a ENUM('') NOT NULL);
INSERT INTO t1 VALUES (), (), ();
EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
1
1
@@ -5383,7 +5383,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system idx NULL NULL NULL 1 100.00
1 SIMPLE t2 ref idx idx 5 const 1 100.00 Using index
Warnings:
-Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`c` = 8)
+Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` = 8
SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
WHERE 1 IS NULL OR b < 33 AND b = c;
a b c
@@ -5413,7 +5413,7 @@ SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1
SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1);
a b
5 11
@@ -5422,7 +5422,7 @@ SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1
SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5);
a b
5 11
@@ -5431,7 +5431,7 @@ SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1
SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1);
a b
5 11
@@ -5448,7 +5448,7 @@ SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = 5) and (`test`.`t1`.`a` = 5))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 5 and `test`.`t1`.`a` = 5
SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1);
a b
DROP TABLE t1;
@@ -5466,7 +5466,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,'k' AS `c`,'k' AS `d` from `test`.`t1` where ((`test`.`t1`.`b` = 'k') and (`test`.`t1`.`a` = 136))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,'k' AS `c`,'k' AS `d` from `test`.`t1` where `test`.`t1`.`b` = 'k' and `test`.`t1`.`a` = 136
SELECT * FROM t1, t2 WHERE c=b AND (1=2 OR ((b='h' OR a=136) AND d=b));
a b c d
DROP TABLE t1,t2;
@@ -5507,7 +5507,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system PRIMARY NULL NULL NULL 1 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,1 AS `pk2`,1 AS `a2` from `test`.`t1` where ((`test`.`t1`.`a1` = 1) and (`test`.`t1`.`b1` = 6))
+Note 1003 select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,1 AS `pk2`,1 AS `a2` from `test`.`t1` where `test`.`t1`.`a1` = 1 and `test`.`t1`.`b1` = 6
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 );
diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result
index 7b38515cf70..8462e19fda8 100644
--- a/mysql-test/r/select_found.result
+++ b/mysql-test/r/select_found.result
@@ -83,20 +83,20 @@ UNIQUE KEY e_n (email,name)
);
EXPLAIN SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 system PRIMARY,kid NULL NULL NULL 0 const row not found
-1 SIMPLE t2 index NULL e_n 104 NULL 10
+1 SIMPLE t1 system PRIMARY,kid NULL NULL NULL 0 const row not found; Using temporary
+1 SIMPLE t2 ALL NULL NULL NULL NULL 200
SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
email
email1
+email2
+email3
+email4
+email5
+email6
+email7
+email8
+email9
email10
-email100
-email101
-email102
-email103
-email104
-email105
-email106
-email107
SELECT FOUND_ROWS();
FOUND_ROWS()
200
diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result
index 10d8a05ad40..6eb0520b0ff 100644
--- a/mysql-test/r/select_jcl6.result
+++ b/mysql-test/r/select_jcl6.result
@@ -1521,7 +1521,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
Warnings:
-Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> ''))
+Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> ''
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
@@ -2828,7 +2828,7 @@ i='1e+01' i=1e+01 i in (1e+01,1e+01) i in ('1e+01','1e+01')
1 1 1 1
DROP TABLE t1;
create table t1(a bigint unsigned, b bigint);
-insert into t1 values (0xfffffffffffffffff, 0xfffffffffffffffff),
+insert ignore into t1 values (0xfffffffffffffffff, 0xfffffffffffffffff),
(0x10000000000000000, 0x10000000000000000),
(0x8fffffffffffffff, 0x8fffffffffffffff);
Warnings:
@@ -3415,7 +3415,7 @@ f1 f2 f2
NULL a NULL
drop table t1,t2;
select * from (select * left join t on f1=f2) tt;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'on f1=f2) tt' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'left join t on f1=f2) tt' at line 1
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
@@ -4406,12 +4406,12 @@ EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where; Rowid-ordered scan
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where; Rowid-ordered scan
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2
DROP TABLE t1;
#
# Bug#47019: Assertion failed: 0, file .\rt_mbr.c, line 138 when
@@ -4459,7 +4459,7 @@ DROP TABLE t1;
# memory
#
CREATE TABLE t1(a INT NOT NULL, b YEAR);
-INSERT INTO t1 VALUES ();
+INSERT IGNORE INTO t1 VALUES ();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
CREATE TABLE t2(c INT);
@@ -4560,7 +4560,7 @@ DROP TABLE t1;
SET @old_sort_buffer_size= @@session.sort_buffer_size;
SET @@sort_buffer_size= 40000;
CREATE TABLE t1(a CHAR(0) NOT NULL);
-INSERT INTO t1 VALUES (0), (0), (0);
+INSERT IGNORE INTO t1 VALUES (0), (0), (0);
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;
@@ -4570,7 +4570,7 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT a FROM t1 ORDER BY a;
DROP TABLE t1;
CREATE TABLE t1(a CHAR(0) NOT NULL, b CHAR(0) NOT NULL, c int);
-INSERT INTO t1 VALUES (0, 0, 0), (0, 0, 2), (0, 0, 1);
+INSERT IGNORE INTO t1 VALUES (0, 0, 0), (0, 0, 2), (0, 0, 1);
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;
@@ -4778,7 +4778,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1 + 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = <cache>((1 + 1)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = <cache>(1 + 1)
SELECT * FROM t1 HAVING a = 1 + 1;
a
2
@@ -4786,7 +4786,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 HAVING a = 1 + 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having (`test`.`t1`.`a` = <cache>((1 + 1)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having `test`.`t1`.`a` = <cache>(1 + 1)
SELECT * FROM t1, t2 WHERE a = b + (1 + 1);
a b
4 2
@@ -4795,7 +4795,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,2 AS `b` from `test`.`t1` where (`test`.`t1`.`a` = <cache>((2 + (1 + 1))))
+Note 1003 select `test`.`t1`.`a` AS `a`,2 AS `b` from `test`.`t1` where `test`.`t1`.`a` = <cache>(2 + (1 + 1))
SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
b a
2 3
@@ -4809,7 +4809,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00'
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > <cache>(unix_timestamp('2009-03-10 00:00:00')))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > <cache>(unix_timestamp('2009-03-10 00:00:00'))
CREATE FUNCTION f1() RETURNS INT DETERMINISTIC
BEGIN
SET @cnt := @cnt + 1;
@@ -4826,7 +4826,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = f1();
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = <cache>(`f1`()))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = <cache>(`f1`())
DROP TABLE t1, t2;
DROP FUNCTION f1;
# End of bug#33546
@@ -4881,7 +4881,7 @@ CREATE TABLE t1(a ENUM('') NOT NULL);
INSERT INTO t1 VALUES (), (), ();
EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
1
1
@@ -5394,7 +5394,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system idx NULL NULL NULL 1 100.00
1 SIMPLE t2 ref idx idx 5 const 1 100.00 Using index
Warnings:
-Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`c` = 8)
+Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` = 8
SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
WHERE 1 IS NULL OR b < 33 AND b = c;
a b c
@@ -5424,7 +5424,7 @@ SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1
SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1);
a b
5 11
@@ -5433,7 +5433,7 @@ SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1
SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5);
a b
5 11
@@ -5442,7 +5442,7 @@ SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1
SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1);
a b
5 11
@@ -5459,7 +5459,7 @@ SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = 5) and (`test`.`t1`.`a` = 5))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 5 and `test`.`t1`.`a` = 5
SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1);
a b
DROP TABLE t1;
@@ -5477,7 +5477,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,'k' AS `c`,'k' AS `d` from `test`.`t1` where ((`test`.`t1`.`b` = 'k') and (`test`.`t1`.`a` = 136))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,'k' AS `c`,'k' AS `d` from `test`.`t1` where `test`.`t1`.`b` = 'k' and `test`.`t1`.`a` = 136
SELECT * FROM t1, t2 WHERE c=b AND (1=2 OR ((b='h' OR a=136) AND d=b));
a b c d
DROP TABLE t1,t2;
@@ -5518,7 +5518,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system PRIMARY NULL NULL NULL 1 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,1 AS `pk2`,1 AS `a2` from `test`.`t1` where ((`test`.`t1`.`a1` = 1) and (`test`.`t1`.`b1` = 6))
+Note 1003 select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,1 AS `pk2`,1 AS `a2` from `test`.`t1` where `test`.`t1`.`a1` = 1 and `test`.`t1`.`b1` = 6
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 );
diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result
index 787e321dd57..010f37757e0 100644
--- a/mysql-test/r/select_pkeycache.result
+++ b/mysql-test/r/select_pkeycache.result
@@ -606,7 +606,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
+1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
1 SIMPLE t3 ref period period 4 test.t1.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
id select_type table type possible_keys key key_len ref rows Extra
@@ -1510,7 +1510,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
Warnings:
-Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> ''))
+Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> ''
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
@@ -2817,7 +2817,7 @@ i='1e+01' i=1e+01 i in (1e+01,1e+01) i in ('1e+01','1e+01')
1 1 1 1
DROP TABLE t1;
create table t1(a bigint unsigned, b bigint);
-insert into t1 values (0xfffffffffffffffff, 0xfffffffffffffffff),
+insert ignore into t1 values (0xfffffffffffffffff, 0xfffffffffffffffff),
(0x10000000000000000, 0x10000000000000000),
(0x8fffffffffffffff, 0x8fffffffffffffff);
Warnings:
@@ -3404,7 +3404,7 @@ f1 f2 f2
NULL a NULL
drop table t1,t2;
select * from (select * left join t on f1=f2) tt;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'on f1=f2) tt' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'left join t on f1=f2) tt' at line 1
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
@@ -4395,12 +4395,12 @@ EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2
DROP TABLE t1;
#
# Bug#47019: Assertion failed: 0, file .\rt_mbr.c, line 138 when
@@ -4448,7 +4448,7 @@ DROP TABLE t1;
# memory
#
CREATE TABLE t1(a INT NOT NULL, b YEAR);
-INSERT INTO t1 VALUES ();
+INSERT IGNORE INTO t1 VALUES ();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
CREATE TABLE t2(c INT);
@@ -4549,7 +4549,7 @@ DROP TABLE t1;
SET @old_sort_buffer_size= @@session.sort_buffer_size;
SET @@sort_buffer_size= 40000;
CREATE TABLE t1(a CHAR(0) NOT NULL);
-INSERT INTO t1 VALUES (0), (0), (0);
+INSERT IGNORE INTO t1 VALUES (0), (0), (0);
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;
@@ -4559,7 +4559,7 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT a FROM t1 ORDER BY a;
DROP TABLE t1;
CREATE TABLE t1(a CHAR(0) NOT NULL, b CHAR(0) NOT NULL, c int);
-INSERT INTO t1 VALUES (0, 0, 0), (0, 0, 2), (0, 0, 1);
+INSERT IGNORE INTO t1 VALUES (0, 0, 0), (0, 0, 2), (0, 0, 1);
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;
@@ -4767,7 +4767,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1 + 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = <cache>((1 + 1)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = <cache>(1 + 1)
SELECT * FROM t1 HAVING a = 1 + 1;
a
2
@@ -4775,7 +4775,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 HAVING a = 1 + 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having (`test`.`t1`.`a` = <cache>((1 + 1)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having `test`.`t1`.`a` = <cache>(1 + 1)
SELECT * FROM t1, t2 WHERE a = b + (1 + 1);
a b
4 2
@@ -4784,7 +4784,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,2 AS `b` from `test`.`t1` where (`test`.`t1`.`a` = <cache>((2 + (1 + 1))))
+Note 1003 select `test`.`t1`.`a` AS `a`,2 AS `b` from `test`.`t1` where `test`.`t1`.`a` = <cache>(2 + (1 + 1))
SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
b a
2 3
@@ -4798,7 +4798,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00'
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > <cache>(unix_timestamp('2009-03-10 00:00:00')))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > <cache>(unix_timestamp('2009-03-10 00:00:00'))
CREATE FUNCTION f1() RETURNS INT DETERMINISTIC
BEGIN
SET @cnt := @cnt + 1;
@@ -4815,7 +4815,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = f1();
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = <cache>(`f1`()))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = <cache>(`f1`())
DROP TABLE t1, t2;
DROP FUNCTION f1;
# End of bug#33546
@@ -4870,7 +4870,7 @@ CREATE TABLE t1(a ENUM('') NOT NULL);
INSERT INTO t1 VALUES (), (), ();
EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
1
1
@@ -5383,7 +5383,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system idx NULL NULL NULL 1 100.00
1 SIMPLE t2 ref idx idx 5 const 1 100.00 Using index
Warnings:
-Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`c` = 8)
+Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` = 8
SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
WHERE 1 IS NULL OR b < 33 AND b = c;
a b c
@@ -5413,7 +5413,7 @@ SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1
SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1);
a b
5 11
@@ -5422,7 +5422,7 @@ SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1
SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5);
a b
5 11
@@ -5431,7 +5431,7 @@ SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 5) and (`test`.`t1`.`b` <> 1))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1
SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1);
a b
5 11
@@ -5448,7 +5448,7 @@ SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = 5) and (`test`.`t1`.`a` = 5))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 5 and `test`.`t1`.`a` = 5
SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1);
a b
DROP TABLE t1;
@@ -5466,7 +5466,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,'k' AS `c`,'k' AS `d` from `test`.`t1` where ((`test`.`t1`.`b` = 'k') and (`test`.`t1`.`a` = 136))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,'k' AS `c`,'k' AS `d` from `test`.`t1` where `test`.`t1`.`b` = 'k' and `test`.`t1`.`a` = 136
SELECT * FROM t1, t2 WHERE c=b AND (1=2 OR ((b='h' OR a=136) AND d=b));
a b c d
DROP TABLE t1,t2;
@@ -5507,7 +5507,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system PRIMARY NULL NULL NULL 1 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,1 AS `pk2`,1 AS `a2` from `test`.`t1` where ((`test`.`t1`.`a1` = 1) and (`test`.`t1`.`b1` = 6))
+Note 1003 select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,1 AS `pk2`,1 AS `a2` from `test`.`t1` where `test`.`t1`.`a1` = 1 and `test`.`t1`.`b1` = 6
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 );
diff --git a/mysql-test/r/selectivity.result b/mysql-test/r/selectivity.result
index 01847006928..64199f983ee 100644
--- a/mysql-test/r/selectivity.result
+++ b/mysql-test/r/selectivity.result
@@ -27,13 +27,13 @@ select * from t1 where a is null;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 40.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where isnull(`test`.`t1`.`a`)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null
explain extended
select * from t1 where a is not null;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 60.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` is not null)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not null
drop table t1;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP DATABASE IF EXISTS dbt3_s001;
@@ -80,7 +80,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.part.p_partkey' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`part`.`p_size` = 9) and (`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`region`.`r_regionkey` = `dbt3_s001`.`nation`.`n_regionkey`) and (`dbt3_s001`.`region`.`r_name` = 'ASIA') and (`dbt3_s001`.`part`.`p_type` like '%TIN') and (`dbt3_s001`.`partsupp`.`ps_supplycost` = <expr_cache><`dbt3_s001`.`part`.`p_partkey`>((select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where ((`dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey`) and (`dbt3_s001`.`region`.`r_name` = 'ASIA') and (`dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)))))) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey`
+Note 1003 select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`part`.`p_size` = 9 and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`region`.`r_regionkey` = `dbt3_s001`.`nation`.`n_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_type` like '%TIN' and `dbt3_s001`.`partsupp`.`ps_supplycost` = <expr_cache><`dbt3_s001`.`part`.`p_partkey`>((select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey`
set optimizer_use_condition_selectivity=4;
explain extended
select
@@ -121,7 +121,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.part.p_partkey' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`dbt3_s001`.`part`.`p_size` = 9) and (`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey`) and (`dbt3_s001`.`region`.`r_name` = 'ASIA') and (`dbt3_s001`.`part`.`p_type` like '%TIN') and (`dbt3_s001`.`partsupp`.`ps_supplycost` = <expr_cache><`dbt3_s001`.`part`.`p_partkey`>((select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where ((`dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey`) and (`dbt3_s001`.`region`.`r_name` = 'ASIA') and (`dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)))))) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey`
+Note 1003 select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey` and `dbt3_s001`.`part`.`p_size` = 9 and `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_type` like '%TIN' and `dbt3_s001`.`partsupp`.`ps_supplycost` = <expr_cache><`dbt3_s001`.`part`.`p_partkey`>((select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey`
=== Q15 ===
create view revenue0 (supplier_no, total_revenue) as
select l_suppkey, sum(l_extendedprice * (1 - l_discount))
@@ -145,7 +145,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 268 100.00
4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 268 100.00 Using where; Using temporary; Using filesort
Warnings:
-Note 1003 select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where ((`revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`revenue0`.`total_revenue` = (select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`))) order by `dbt3_s001`.`supplier`.`s_suppkey`
+Note 1003 select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey`
select s_suppkey, s_name, s_address, s_phone, total_revenue
from supplier, revenue0
where s_suppkey = supplier_no
@@ -166,7 +166,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 268 100.00
4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 268 100.00 Using where; Using temporary; Using filesort
Warnings:
-Note 1003 select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where ((`revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`revenue0`.`total_revenue` = (select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`))) order by `dbt3_s001`.`supplier`.`s_suppkey`
+Note 1003 select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey`
select s_suppkey, s_name, s_address, s_phone, total_revenue
from supplier, revenue0
where s_suppkey = supplier_no
@@ -193,7 +193,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY partsupp ref PRIMARY,i_ps_partkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index
2 MATERIALIZED supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`part`.`p_brand` <> 'Brand#11') and (not((`dbt3_s001`.`part`.`p_type` like 'SMALL POLISHED%'))) and (`dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8)) and (not(<expr_cache><`dbt3_s001`.`partsupp`.`ps_suppkey`>(<in_optimizer>(`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( <materialize> (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where (`dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%') ), <primary_index_lookup>(`dbt3_s001`.`partsupp`.`ps_suppkey` in <temporary table> on distinct_key where ((`dbt3_s001`.`partsupp`.`ps_suppkey` = `<subquery2>`.`s_suppkey`))))))))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size`
+Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`part`.`p_brand` <> 'Brand#11' and `dbt3_s001`.`part`.`p_type` not like 'SMALL POLISHED%' and `dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8) and !<expr_cache><`dbt3_s001`.`partsupp`.`ps_suppkey`>(<in_optimizer>(`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( <materialize> (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where `dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%' ), <primary_index_lookup>(`dbt3_s001`.`partsupp`.`ps_suppkey` in <temporary table> on distinct_key where `dbt3_s001`.`partsupp`.`ps_suppkey` = `<subquery2>`.`s_suppkey`)))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size`
select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt
from partsupp, part
where p_partkey = ps_partkey
@@ -237,7 +237,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY partsupp ref PRIMARY,i_ps_partkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index
2 MATERIALIZED supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`part`.`p_brand` <> 'Brand#11') and (not((`dbt3_s001`.`part`.`p_type` like 'SMALL POLISHED%'))) and (`dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8)) and (not(<expr_cache><`dbt3_s001`.`partsupp`.`ps_suppkey`>(<in_optimizer>(`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( <materialize> (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where (`dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%') ), <primary_index_lookup>(`dbt3_s001`.`partsupp`.`ps_suppkey` in <temporary table> on distinct_key where ((`dbt3_s001`.`partsupp`.`ps_suppkey` = `<subquery2>`.`s_suppkey`))))))))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size`
+Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`part`.`p_brand` <> 'Brand#11' and `dbt3_s001`.`part`.`p_type` not like 'SMALL POLISHED%' and `dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8) and !<expr_cache><`dbt3_s001`.`partsupp`.`ps_suppkey`>(<in_optimizer>(`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( <materialize> (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where `dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%' ), <primary_index_lookup>(`dbt3_s001`.`partsupp`.`ps_suppkey` in <temporary table> on distinct_key where `dbt3_s001`.`partsupp`.`ps_suppkey` = `<subquery2>`.`s_suppkey`)))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size`
select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt
from partsupp, part
where p_partkey = ps_partkey
@@ -281,7 +281,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY partsupp ref PRIMARY,i_ps_partkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index
2 MATERIALIZED supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`part`.`p_brand` <> 'Brand#11') and (not((`dbt3_s001`.`part`.`p_type` like 'SMALL POLISHED%'))) and (`dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8)) and (not(<expr_cache><`dbt3_s001`.`partsupp`.`ps_suppkey`>(<in_optimizer>(`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( <materialize> (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where (`dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%') ), <primary_index_lookup>(`dbt3_s001`.`partsupp`.`ps_suppkey` in <temporary table> on distinct_key where ((`dbt3_s001`.`partsupp`.`ps_suppkey` = `<subquery2>`.`s_suppkey`))))))))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size`
+Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`part`.`p_brand` <> 'Brand#11' and `dbt3_s001`.`part`.`p_type` not like 'SMALL POLISHED%' and `dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8) and !<expr_cache><`dbt3_s001`.`partsupp`.`ps_suppkey`>(<in_optimizer>(`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( <materialize> (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where `dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%' ), <primary_index_lookup>(`dbt3_s001`.`partsupp`.`ps_suppkey` in <temporary table> on distinct_key where `dbt3_s001`.`partsupp`.`ps_suppkey` = `<subquery2>`.`s_suppkey`)))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size`
select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt
from partsupp, part
where p_partkey = ps_partkey
@@ -328,7 +328,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey_quantity 4 dbt3_s001.orders.o_orderkey 4 100.00 Using index
2 MATERIALIZED lineitem index NULL i_l_orderkey_quantity 13 NULL 6005 100.00 Using index
Warnings:
-Note 1003 select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from <materialize> (select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having (sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250)) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey`) and (`<subquery2>`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey`) and (`dbt3_s001`.`lineitem`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey`)) group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE`
+Note 1003 select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from <materialize> (select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where `dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey` and `<subquery2>`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` and `dbt3_s001`.`lineitem`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE`
select
c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
from customer, orders, lineitem
@@ -362,7 +362,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 <subquery2>.l_orderkey 4 100.00
2 MATERIALIZED lineitem index NULL i_l_orderkey_quantity 13 NULL 6005 100.00 Using index
Warnings:
-Note 1003 select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from <materialize> (select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having (sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250)) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey`) and (`dbt3_s001`.`orders`.`o_orderkey` = `<subquery2>`.`l_orderkey`) and (`dbt3_s001`.`lineitem`.`l_orderkey` = `<subquery2>`.`l_orderkey`)) group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE`
+Note 1003 select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from <materialize> (select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where `dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey` and `dbt3_s001`.`orders`.`o_orderkey` = `<subquery2>`.`l_orderkey` and `dbt3_s001`.`lineitem`.`l_orderkey` = `<subquery2>`.`l_orderkey` group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE`
select
c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
from customer, orders, lineitem
@@ -400,7 +400,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 SUBQUERY customer ALL NULL NULL NULL NULL 150 100.00 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where ((substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and (`dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where ((`dbt3_s001`.`customer`.`c_acctbal` > 0.00) and (substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25'))))) and (not(<in_optimizer>(1,exists(select 1 from `dbt3_s001`.`orders` where (`dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)))))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
+Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !<in_optimizer>(1,exists(select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal
from (
select substr(c_phone, 1, 2) as cntrycode, c_acctbal
@@ -441,7 +441,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 SUBQUERY customer ALL NULL NULL NULL NULL 150 91.00 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where ((substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and (`dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where ((`dbt3_s001`.`customer`.`c_acctbal` > 0.00) and (substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25'))))) and (not(<in_optimizer>(1,exists(select 1 from `dbt3_s001`.`orders` where (`dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)))))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
+Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !<in_optimizer>(1,exists(select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal
from (
select substr(c_phone, 1, 2) as cntrycode, c_acctbal
@@ -491,7 +491,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10
+Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>(cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10
select sql_calc_found_rows
s_name, s_address
from supplier, nation
@@ -544,7 +544,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10
+Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>(cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10
select sql_calc_found_rows
s_name, s_address
from supplier, nation
@@ -599,7 +599,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10
+Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>(cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10
select sql_calc_found_rows
s_name, s_address
from supplier, nation
@@ -654,7 +654,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10
+Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>(cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10
select sql_calc_found_rows
s_name, s_address
from supplier, nation
@@ -709,7 +709,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10
+Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>(cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10
select sql_calc_found_rows
s_name, s_address
from supplier, nation
@@ -754,7 +754,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t2 ref idx idx 5 test.t1.b 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t2`.`d` = `test`.`t1`.`b`))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t2`.`d` = `test`.`t1`.`b`
SELECT * FROM v1 INNER JOIN t2 ON ( a = c AND b = d );
a b c d
0 7 0 7
@@ -775,7 +775,7 @@ select * from t1 where a < 1 and a > 7;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` < 1) and (`test`.`t1`.`a` > 7))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1 and `test`.`t1`.`a` > 7
select * from t1 where a < 1 and a > 7;
a
set optimizer_use_condition_selectivity=3;
@@ -833,7 +833,7 @@ explain extended select * from t1 where a=0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.39 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 0)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0
drop table t1;
set histogram_size=@save_histogram_size;
set histogram_type=@save_histogram_type;
@@ -902,7 +902,7 @@ SELECT * FROM t1 WHERE a > 3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 75.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 3)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 3
SELECT * FROM t1 WHERE a > 3;
a
9
@@ -985,7 +985,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00
2 SUBQUERY t1 ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where ((<cache>(<in_optimizer>(1,exists(select 1 from `test`.`t1` join `test`.`t2`))) and (`test`.`t1`.`a` <> `test`.`t2`.`b`)) or (`test`.`t1`.`a` <= 4))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where <cache>(<in_optimizer>(1,exists(select 1 from `test`.`t1` join `test`.`t2`))) and `test`.`t1`.`a` <> `test`.`t2`.`b` or `test`.`t1`.`a` <= 4
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1,t2;
set use_stat_tables=@save_use_stat_tables;
@@ -1008,25 +1008,25 @@ SELECT * FROM t1 WHERE a IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 14 28.57 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where isnull(`test`.`t1`.`a`)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a IS NOT NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 14 71.43 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` is not null)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not null
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a IS NULL OR a IS NOT NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 14 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (isnull(`test`.`t1`.`a`) or (`test`.`t1`.`a` is not null))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null or `test`.`t1`.`a` is not null
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a IS NULL OR a < 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 14 69.39 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (isnull(`test`.`t1`.`a`) or (`test`.`t1`.`a` < 5))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null or `test`.`t1`.`a` < 5
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1;
set use_stat_tables=@save_use_stat_tables;
@@ -1135,7 +1135,7 @@ explain extended select * from t1 where a between 5 and 7;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 25.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` between 5 and 7)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` between 5 and 7
alter table t1 change column a a int;
analyze table t1;
Table Op Msg_type Msg_text
@@ -1146,7 +1146,7 @@ explain extended select * from t1 where a between 5 and 7;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 25.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` between 5 and 7)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`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;
@@ -1179,7 +1179,7 @@ WHERE 2 IN ( SELECT pk2 FROM t2 LEFT JOIN t3 ON (c3 = c2 ) WHERE i2 = 3 );
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` left join `test`.`t3` on((`test`.`t3`.`c3` = 'b'))) where 0
+Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` left join `test`.`t3` on(`test`.`t3`.`c3` = 'b')) where 0
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1,t2,t3;
#
@@ -1246,7 +1246,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE language ALL NULL NULL NULL NULL 6 0.00 Using where; Using join buffer (flat, BNL join)
1 SIMPLE continent ALL NULL NULL NULL NULL 6 100.00 Using join buffer (incremental, BNL join)
Warnings:
-Note 1003 select `test`.`language`.`lang_group` AS `lang_group`,`test`.`language`.`lang` AS `lang`,`test`.`country`.`code` AS `code`,`test`.`country`.`country_group` AS `country_group`,`test`.`continent`.`cont_group` AS `cont_group`,`test`.`continent`.`cont` AS `cont` from `test`.`language` join `test`.`country` join `test`.`continent` where ((`test`.`language`.`lang_group` = `test`.`country`.`country_group`) and isnull(`test`.`country`.`country_group`))
+Note 1003 select `test`.`language`.`lang_group` AS `lang_group`,`test`.`language`.`lang` AS `lang`,`test`.`country`.`code` AS `code`,`test`.`country`.`country_group` AS `country_group`,`test`.`continent`.`cont_group` AS `cont_group`,`test`.`continent`.`cont` AS `cont` from `test`.`language` join `test`.`country` join `test`.`continent` where `test`.`language`.`lang_group` = `test`.`country`.`country_group` and `test`.`country`.`country_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;
@@ -1294,7 +1294,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref c,d c 5 test.t1.b 5 100.00
1 SIMPLE t3 ALL NULL NULL NULL NULL 262144 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where ((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t2`.`d`) and (`test`.`t3`.`b` < 5) and (`test`.`t1`.`a` < 2000))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where `test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t3`.`a` = `test`.`t2`.`d` and `test`.`t3`.`b` < 5 and `test`.`t1`.`a` < 2000
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;
a b c d a b
@@ -1311,7 +1311,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref c,d d 5 test.t3.a 7 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 262144 2.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where ((`test`.`t1`.`b` = `test`.`t2`.`c`) and (`test`.`t2`.`d` = `test`.`t3`.`a`) and (`test`.`t3`.`b` < 5) and (`test`.`t1`.`a` < 2000))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where `test`.`t1`.`b` = `test`.`t2`.`c` and `test`.`t2`.`d` = `test`.`t3`.`a` and `test`.`t3`.`b` < 5 and `test`.`t1`.`a` < 2000
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;
a b c d a b
@@ -1372,14 +1372,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 0.99 Using where
1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 10))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` < 10
explain extended
select * from t1 straight_join t2 where t1.a=t2.a and t2.a<10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 0.99 Using where
1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 10))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` < 10
set histogram_size=@save_histogram_size;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
drop table t0,t1,t2;
@@ -1405,7 +1405,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE a ALL NULL NULL NULL NULL 1000 100.00 Using where
1 SIMPLE b ALL NULL NULL NULL NULL 1000 100.00 Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`a`.`a` AS `a`,`test`.`a`.`b` AS `b`,`test`.`b`.`a` AS `a`,`test`.`b`.`b` AS `b` from `test`.`t2` `a` straight_join `test`.`t2` `b` where isnull(`test`.`a`.`a`)
+Note 1003 select `test`.`a`.`a` AS `a`,`test`.`a`.`b` AS `b`,`test`.`b`.`a` AS `a`,`test`.`b`.`b` AS `b` from `test`.`t2` `a` straight_join `test`.`t2` `b` where `test`.`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;
@@ -1433,7 +1433,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ref PRIMARY,b b 5 const 1 100.00 Using index condition; Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`i` AS `i` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` <> 'USARussian') and isnull(`test`.`t1`.`b`))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`i` AS `i` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` <> 'USARussian' and `test`.`t1`.`b` is null
SELECT * FROM t1, t2
WHERE a <> 'USARussian' AND b IS NULL;
a b i
@@ -1456,7 +1456,7 @@ select * from t1 where col1 > 'b' and col1 < 'e';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where ((`test`.`t1`.`col1` > 'b') and (`test`.`t1`.`col1` < 'e'))
+Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` > 'b' and `test`.`t1`.`col1` < 'e'
select * from t1 where col1 > 'b' and col1 < 'e';
col1
c
@@ -1491,7 +1491,7 @@ select * from t1 where col1 > 'b' and col1 < 'd';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 28.57 Using where
Warnings:
-Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where ((`test`.`t1`.`col1` > 'b') and (`test`.`t1`.`col1` < 'd'))
+Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` > 'b' and `test`.`t1`.`col1` < 'd'
select * from t2 where col1 > 'b' and col1 < 'd';
col1
c
@@ -1500,7 +1500,7 @@ select * from t2 where col1 > 'b' and col1 < 'd';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where ((`test`.`t2`.`col1` > 'b') and (`test`.`t2`.`col1` < 'd'))
+Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` > 'b' and `test`.`t2`.`col1` < 'd'
select * from t2 where col1 < 'b' and col1 > 'd';
col1
explain extended
diff --git a/mysql-test/r/selectivity_innodb.result b/mysql-test/r/selectivity_innodb.result
index 070cc49ca7f..a05c14c8e71 100644
--- a/mysql-test/r/selectivity_innodb.result
+++ b/mysql-test/r/selectivity_innodb.result
@@ -30,13 +30,13 @@ select * from t1 where a is null;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 40.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where isnull(`test`.`t1`.`a`)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null
explain extended
select * from t1 where a is not null;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 60.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` is not null)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not null
drop table t1;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP DATABASE IF EXISTS dbt3_s001;
@@ -83,7 +83,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.part.p_partkey' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`part`.`p_size` = 9) and (`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey`) and (`dbt3_s001`.`region`.`r_name` = 'ASIA') and (`dbt3_s001`.`part`.`p_type` like '%TIN') and (`dbt3_s001`.`partsupp`.`ps_supplycost` = <expr_cache><`dbt3_s001`.`part`.`p_partkey`>((select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where ((`dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey`) and (`dbt3_s001`.`region`.`r_name` = 'ASIA') and (`dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)))))) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey`
+Note 1003 select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`part`.`p_size` = 9 and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_type` like '%TIN' and `dbt3_s001`.`partsupp`.`ps_supplycost` = <expr_cache><`dbt3_s001`.`part`.`p_partkey`>((select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey`
set optimizer_use_condition_selectivity=4;
explain extended
select
@@ -124,7 +124,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.part.p_partkey' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`part`.`p_size` = 9) and (`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey`) and (`dbt3_s001`.`region`.`r_name` = 'ASIA') and (`dbt3_s001`.`part`.`p_type` like '%TIN') and (`dbt3_s001`.`partsupp`.`ps_supplycost` = <expr_cache><`dbt3_s001`.`part`.`p_partkey`>((select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where ((`dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey`) and (`dbt3_s001`.`region`.`r_name` = 'ASIA') and (`dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)))))) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey`
+Note 1003 select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`part`.`p_size` = 9 and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_type` like '%TIN' and `dbt3_s001`.`partsupp`.`ps_supplycost` = <expr_cache><`dbt3_s001`.`part`.`p_partkey`>((select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey`
=== Q15 ===
create view revenue0 (supplier_no, total_revenue) as
select l_suppkey, sum(l_extendedprice * (1 - l_discount))
@@ -144,11 +144,11 @@ order by s_suppkey;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY supplier index PRIMARY PRIMARY 4 NULL 10 100.00
1 PRIMARY <derived3> ref key0 key0 5 dbt3_s001.supplier.s_suppkey 10 100.00 Using where
-3 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 228 100.00 Using where; Using temporary; Using filesort
-2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 228 100.00
-4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 228 100.00 Using where; Using temporary; Using filesort
+3 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort
+2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 229 100.00
+4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort
Warnings:
-Note 1003 select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where ((`revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`revenue0`.`total_revenue` = (select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`))) order by `dbt3_s001`.`supplier`.`s_suppkey`
+Note 1003 select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey`
select s_suppkey, s_name, s_address, s_phone, total_revenue
from supplier, revenue0
where s_suppkey = supplier_no
@@ -165,11 +165,11 @@ order by s_suppkey;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY supplier index PRIMARY PRIMARY 4 NULL 10 100.00
1 PRIMARY <derived3> ref key0 key0 5 dbt3_s001.supplier.s_suppkey 10 100.00 Using where
-3 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 228 100.00 Using where; Using temporary; Using filesort
-2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 227 100.00
-4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 228 100.00 Using where; Using temporary; Using filesort
+3 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort
+2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 228 100.00
+4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort
Warnings:
-Note 1003 select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where ((`revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey`) and (`revenue0`.`total_revenue` = (select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`))) order by `dbt3_s001`.`supplier`.`s_suppkey`
+Note 1003 select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey`
select s_suppkey, s_name, s_address, s_phone, total_revenue
from supplier, revenue0
where s_suppkey = supplier_no
@@ -196,7 +196,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY partsupp ref PRIMARY,i_ps_partkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index
2 MATERIALIZED supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`part`.`p_brand` <> 'Brand#11') and (not((`dbt3_s001`.`part`.`p_type` like 'SMALL POLISHED%'))) and (`dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8)) and (not(<expr_cache><`dbt3_s001`.`partsupp`.`ps_suppkey`>(<in_optimizer>(`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( <materialize> (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where (`dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%') ), <primary_index_lookup>(`dbt3_s001`.`partsupp`.`ps_suppkey` in <temporary table> on distinct_key where ((`dbt3_s001`.`partsupp`.`ps_suppkey` = `<subquery2>`.`s_suppkey`))))))))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size`
+Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`part`.`p_brand` <> 'Brand#11' and `dbt3_s001`.`part`.`p_type` not like 'SMALL POLISHED%' and `dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8) and !<expr_cache><`dbt3_s001`.`partsupp`.`ps_suppkey`>(<in_optimizer>(`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( <materialize> (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where `dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%' ), <primary_index_lookup>(`dbt3_s001`.`partsupp`.`ps_suppkey` in <temporary table> on distinct_key where `dbt3_s001`.`partsupp`.`ps_suppkey` = `<subquery2>`.`s_suppkey`)))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size`
select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt
from partsupp, part
where p_partkey = ps_partkey
@@ -240,7 +240,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY partsupp ref PRIMARY,i_ps_partkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index
2 MATERIALIZED supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`part`.`p_brand` <> 'Brand#11') and (not((`dbt3_s001`.`part`.`p_type` like 'SMALL POLISHED%'))) and (`dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8)) and (not(<expr_cache><`dbt3_s001`.`partsupp`.`ps_suppkey`>(<in_optimizer>(`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( <materialize> (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where (`dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%') ), <primary_index_lookup>(`dbt3_s001`.`partsupp`.`ps_suppkey` in <temporary table> on distinct_key where ((`dbt3_s001`.`partsupp`.`ps_suppkey` = `<subquery2>`.`s_suppkey`))))))))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size`
+Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`part`.`p_brand` <> 'Brand#11' and `dbt3_s001`.`part`.`p_type` not like 'SMALL POLISHED%' and `dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8) and !<expr_cache><`dbt3_s001`.`partsupp`.`ps_suppkey`>(<in_optimizer>(`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( <materialize> (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where `dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%' ), <primary_index_lookup>(`dbt3_s001`.`partsupp`.`ps_suppkey` in <temporary table> on distinct_key where `dbt3_s001`.`partsupp`.`ps_suppkey` = `<subquery2>`.`s_suppkey`)))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size`
select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt
from partsupp, part
where p_partkey = ps_partkey
@@ -284,7 +284,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY partsupp ref PRIMARY,i_ps_partkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index
2 MATERIALIZED supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using where
Warnings:
-Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where ((`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`part`.`p_brand` <> 'Brand#11') and (not((`dbt3_s001`.`part`.`p_type` like 'SMALL POLISHED%'))) and (`dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8)) and (not(<expr_cache><`dbt3_s001`.`partsupp`.`ps_suppkey`>(<in_optimizer>(`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( <materialize> (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where (`dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%') ), <primary_index_lookup>(`dbt3_s001`.`partsupp`.`ps_suppkey` in <temporary table> on distinct_key where ((`dbt3_s001`.`partsupp`.`ps_suppkey` = `<subquery2>`.`s_suppkey`))))))))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size`
+Note 1003 select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`part`.`p_brand` <> 'Brand#11' and `dbt3_s001`.`part`.`p_type` not like 'SMALL POLISHED%' and `dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8) and !<expr_cache><`dbt3_s001`.`partsupp`.`ps_suppkey`>(<in_optimizer>(`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( <materialize> (select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where `dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%' ), <primary_index_lookup>(`dbt3_s001`.`partsupp`.`ps_suppkey` in <temporary table> on distinct_key where `dbt3_s001`.`partsupp`.`ps_suppkey` = `<subquery2>`.`s_suppkey`)))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size`
select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt
from partsupp, part
where p_partkey = ps_partkey
@@ -331,7 +331,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey_quantity 4 dbt3_s001.orders.o_orderkey 4 100.00 Using index
2 MATERIALIZED lineitem index NULL PRIMARY 8 NULL 6005 100.00
Warnings:
-Note 1003 select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from <materialize> (select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having (sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250)) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey`) and (`<subquery2>`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey`) and (`dbt3_s001`.`lineitem`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey`)) group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE`
+Note 1003 select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from <materialize> (select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where `dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey` and `<subquery2>`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` and `dbt3_s001`.`lineitem`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE`
select
c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
from customer, orders, lineitem
@@ -365,7 +365,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 <subquery2>.l_orderkey 4 100.00
2 MATERIALIZED lineitem index NULL PRIMARY 8 NULL 6005 100.00
Warnings:
-Note 1003 select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from <materialize> (select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having (sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250)) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey`) and (`dbt3_s001`.`orders`.`o_orderkey` = `<subquery2>`.`l_orderkey`) and (`dbt3_s001`.`lineitem`.`l_orderkey` = `<subquery2>`.`l_orderkey`)) group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE`
+Note 1003 select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from <materialize> (select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where `dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey` and `dbt3_s001`.`orders`.`o_orderkey` = `<subquery2>`.`l_orderkey` and `dbt3_s001`.`lineitem`.`l_orderkey` = `<subquery2>`.`l_orderkey` group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE`
select
c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
from customer, orders, lineitem
@@ -403,7 +403,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 SUBQUERY customer ALL NULL NULL NULL NULL 150 100.00 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where ((substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and (`dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where ((`dbt3_s001`.`customer`.`c_acctbal` > 0.00) and (substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25'))))) and (not(<in_optimizer>(1,exists(select 1 from `dbt3_s001`.`orders` where (`dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)))))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
+Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !<in_optimizer>(1,exists(select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal
from (
select substr(c_phone, 1, 2) as cntrycode, c_acctbal
@@ -444,7 +444,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 SUBQUERY customer ALL NULL NULL NULL NULL 150 91.00 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where ((substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and (`dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where ((`dbt3_s001`.`customer`.`c_acctbal` > 0.00) and (substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25'))))) and (not(<in_optimizer>(1,exists(select 1 from `dbt3_s001`.`orders` where (`dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)))))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
+Note 1003 select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !<in_optimizer>(1,exists(select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`)) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal
from (
select substr(c_phone, 1, 2) as cntrycode, c_acctbal
@@ -494,7 +494,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10
+Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>(cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10
select sql_calc_found_rows
s_name, s_address
from supplier, nation
@@ -544,11 +544,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
2 MATERIALIZED part ALL PRIMARY NULL NULL NULL 200 4.17 Using where
2 MATERIALIZED partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where
-4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 14.37 Using where
+4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 14.40 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10
+Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>(cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10
select sql_calc_found_rows
s_name, s_address
from supplier, nation
@@ -600,11 +600,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
2 MATERIALIZED part ALL PRIMARY NULL NULL NULL 200 7.03 Using where
2 MATERIALIZED partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where
-4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 14.37 Using where
+4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 14.40 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10
+Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>(cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10
select sql_calc_found_rows
s_name, s_address
from supplier, nation
@@ -656,11 +656,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
2 MATERIALIZED part ALL PRIMARY NULL NULL NULL 200 7.81 Using where
2 MATERIALIZED partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where
-4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 14.37 Using where
+4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 14.40 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10
+Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>(cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10
select sql_calc_found_rows
s_name, s_address
from supplier, nation
@@ -712,11 +712,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
2 MATERIALIZED part ALL PRIMARY NULL NULL NULL 200 7.81 Using where
2 MATERIALIZED partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where
-4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 14.37 Using where
+4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 14.40 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2
Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where ((`dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey`) and (`dbt3_s001`.`nation`.`n_name` = 'UNITED STATES') and (`dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey`) and (`dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select (0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`)) from `dbt3_s001`.`lineitem` where ((`dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`) and (`dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey`) and (`dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date))) and (`dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>((cast('1993-01-01' as date) + interval '1' year))))))) and (`dbt3_s001`.`part`.`p_name` like 'g%')) order by `dbt3_s001`.`supplier`.`s_name` limit 10
+Note 1003 select sql_calc_found_rows `dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address` from `dbt3_s001`.`supplier` semi join (`dbt3_s001`.`part` join `dbt3_s001`.`partsupp`) join `dbt3_s001`.`nation` where `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_name` = 'UNITED STATES' and `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_availqty` > <expr_cache><`dbt3_s001`.`partsupp`.`ps_partkey`,`dbt3_s001`.`partsupp`.`ps_suppkey`>((select 0.5 * sum(`dbt3_s001`.`lineitem`.`l_quantity`) from `dbt3_s001`.`lineitem` where `dbt3_s001`.`lineitem`.`l_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey` and `dbt3_s001`.`lineitem`.`l_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`lineitem`.`l_shipDATE` >= <cache>(cast('1993-01-01' as date)) and `dbt3_s001`.`lineitem`.`l_shipDATE` < <cache>(cast('1993-01-01' as date) + interval '1' year))) and `dbt3_s001`.`part`.`p_name` like 'g%' order by `dbt3_s001`.`supplier`.`s_name` limit 10
select sql_calc_found_rows
s_name, s_address
from supplier, nation
@@ -761,7 +761,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t2 ref idx idx 5 test.t1.b 1 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t2`.`d` = `test`.`t1`.`b`))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t2`.`d` = `test`.`t1`.`b`
SELECT * FROM v1 INNER JOIN t2 ON ( a = c AND b = d );
a b c d
0 7 0 7
@@ -782,7 +782,7 @@ select * from t1 where a < 1 and a > 7;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` < 1) and (`test`.`t1`.`a` > 7))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1 and `test`.`t1`.`a` > 7
select * from t1 where a < 1 and a > 7;
a
set optimizer_use_condition_selectivity=3;
@@ -806,7 +806,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t1`.`a` > 3))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t1`.`a` > 3
select * from t1 where a in ( select b from t2 ) AND ( a > 3 );
a
drop table t1,t2;
@@ -842,7 +842,7 @@ explain extended select * from t1 where a=0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.39 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 0)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0
drop table t1;
set histogram_size=@save_histogram_size;
set histogram_type=@save_histogram_type;
@@ -911,7 +911,7 @@ SELECT * FROM t1 WHERE a > 3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 75.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 3)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 3
SELECT * FROM t1 WHERE a > 3;
a
9
@@ -944,7 +944,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 5 NULL 1 0.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` > 9)
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` > 9
SELECT * FROM t1, t2 WHERE a > 9;
a b c
set optimizer_switch=@save_optimizer_switch;
@@ -995,7 +995,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00
2 SUBQUERY t1 ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where ((<cache>(<in_optimizer>(1,exists(select 1 from `test`.`t1` join `test`.`t2`))) and (`test`.`t1`.`a` <> `test`.`t2`.`b`)) or (`test`.`t1`.`a` <= 4))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where <cache>(<in_optimizer>(1,exists(select 1 from `test`.`t1` join `test`.`t2`))) and `test`.`t1`.`a` <> `test`.`t2`.`b` or `test`.`t1`.`a` <= 4
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1,t2;
set use_stat_tables=@save_use_stat_tables;
@@ -1018,25 +1018,25 @@ SELECT * FROM t1 WHERE a IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 14 28.57 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where isnull(`test`.`t1`.`a`)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a IS NOT NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 14 71.43 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` is not null)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not null
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a IS NULL OR a IS NOT NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 14 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (isnull(`test`.`t1`.`a`) or (`test`.`t1`.`a` is not null))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null or `test`.`t1`.`a` is not null
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a IS NULL OR a < 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 14 69.39 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (isnull(`test`.`t1`.`a`) or (`test`.`t1`.`a` < 5))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null or `test`.`t1`.`a` < 5
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1;
set use_stat_tables=@save_use_stat_tables;
@@ -1145,7 +1145,7 @@ explain extended select * from t1 where a between 5 and 7;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 25.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` between 5 and 7)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` between 5 and 7
alter table t1 change column a a int;
analyze table t1;
Table Op Msg_type Msg_text
@@ -1156,7 +1156,7 @@ explain extended select * from t1 where a between 5 and 7;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 25.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` between 5 and 7)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`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;
@@ -1189,7 +1189,7 @@ WHERE 2 IN ( SELECT pk2 FROM t2 LEFT JOIN t3 ON (c3 = c2 ) WHERE i2 = 3 );
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` left join `test`.`t3` on((`test`.`t3`.`c3` = 'b'))) where 0
+Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` left join `test`.`t3` on(`test`.`t3`.`c3` = 'b')) where 0
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1,t2,t3;
#
@@ -1256,7 +1256,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE language ALL NULL NULL NULL NULL 6 0.00 Using where; Using join buffer (flat, BNL join)
1 SIMPLE continent ALL NULL NULL NULL NULL 6 100.00 Using join buffer (incremental, BNL join)
Warnings:
-Note 1003 select `test`.`language`.`lang_group` AS `lang_group`,`test`.`language`.`lang` AS `lang`,`test`.`country`.`code` AS `code`,`test`.`country`.`country_group` AS `country_group`,`test`.`continent`.`cont_group` AS `cont_group`,`test`.`continent`.`cont` AS `cont` from `test`.`language` join `test`.`country` join `test`.`continent` where ((`test`.`language`.`lang_group` = `test`.`country`.`country_group`) and isnull(`test`.`country`.`country_group`))
+Note 1003 select `test`.`language`.`lang_group` AS `lang_group`,`test`.`language`.`lang` AS `lang`,`test`.`country`.`code` AS `code`,`test`.`country`.`country_group` AS `country_group`,`test`.`continent`.`cont_group` AS `cont_group`,`test`.`continent`.`cont` AS `cont` from `test`.`language` join `test`.`country` join `test`.`continent` where `test`.`language`.`lang_group` = `test`.`country`.`country_group` and `test`.`country`.`country_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;
@@ -1304,7 +1304,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref c,d c 5 test.t1.b 5 100.00
1 SIMPLE t3 ALL NULL NULL NULL NULL 262144 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where ((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t2`.`d`) and (`test`.`t3`.`b` < 5) and (`test`.`t1`.`a` < 2000))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where `test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t3`.`a` = `test`.`t2`.`d` and `test`.`t3`.`b` < 5 and `test`.`t1`.`a` < 2000
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;
a b c d a b
@@ -1321,7 +1321,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref c,d d 5 test.t3.a 7 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 262144 2.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where ((`test`.`t1`.`b` = `test`.`t2`.`c`) and (`test`.`t2`.`d` = `test`.`t3`.`a`) and (`test`.`t3`.`b` < 5) and (`test`.`t1`.`a` < 2000))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where `test`.`t1`.`b` = `test`.`t2`.`c` and `test`.`t2`.`d` = `test`.`t3`.`a` and `test`.`t3`.`b` < 5 and `test`.`t1`.`a` < 2000
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;
a b c d a b
@@ -1382,14 +1382,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 0.99 Using where
1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 10))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` < 10
explain extended
select * from t1 straight_join t2 where t1.a=t2.a and t2.a<10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 0.99 Using where
1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 10))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` < 10
set histogram_size=@save_histogram_size;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
drop table t0,t1,t2;
@@ -1415,7 +1415,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE a ALL NULL NULL NULL NULL 1000 100.00 Using where
1 SIMPLE b ALL NULL NULL NULL NULL 1000 100.00 Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`a`.`a` AS `a`,`test`.`a`.`b` AS `b`,`test`.`b`.`a` AS `a`,`test`.`b`.`b` AS `b` from `test`.`t2` `a` straight_join `test`.`t2` `b` where isnull(`test`.`a`.`a`)
+Note 1003 select `test`.`a`.`a` AS `a`,`test`.`a`.`b` AS `b`,`test`.`b`.`a` AS `a`,`test`.`b`.`b` AS `b` from `test`.`t2` `a` straight_join `test`.`t2` `b` where `test`.`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;
@@ -1443,7 +1443,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ref PRIMARY,b b 5 const 2 66.67 Using where; Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`i` AS `i` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` <> 'USARussian') and isnull(`test`.`t1`.`b`))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`i` AS `i` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` <> 'USARussian' and `test`.`t1`.`b` is null
SELECT * FROM t1, t2
WHERE a <> 'USARussian' AND b IS NULL;
a b i
@@ -1466,7 +1466,7 @@ select * from t1 where col1 > 'b' and col1 < 'e';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where ((`test`.`t1`.`col1` > 'b') and (`test`.`t1`.`col1` < 'e'))
+Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` > 'b' and `test`.`t1`.`col1` < 'e'
select * from t1 where col1 > 'b' and col1 < 'e';
col1
c
@@ -1501,7 +1501,7 @@ select * from t1 where col1 > 'b' and col1 < 'd';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 28.57 Using where
Warnings:
-Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where ((`test`.`t1`.`col1` > 'b') and (`test`.`t1`.`col1` < 'd'))
+Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` > 'b' and `test`.`t1`.`col1` < 'd'
select * from t2 where col1 > 'b' and col1 < 'd';
col1
c
@@ -1510,7 +1510,7 @@ select * from t2 where col1 > 'b' and col1 < 'd';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where ((`test`.`t2`.`col1` > 'b') and (`test`.`t2`.`col1` < 'd'))
+Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` > 'b' and `test`.`t2`.`col1` < 'd'
select * from t2 where col1 < 'b' and col1 > 'd';
col1
explain extended
@@ -1648,7 +1648,7 @@ SELECT * FROM t1 WHERE f1 < 'm';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 72.09 Using where
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1` from `test`.`t1` where (`test`.`t1`.`f1` < 'm')
+Note 1003 select `test`.`t1`.`f1` AS `f1` from `test`.`t1` where `test`.`t1`.`f1` < 'm'
CREATE TABLE t2 (f1 TEXT) ENGINE=InnoDB;
INSERT INTO t2 VALUES ('foo'),('bar'),('qux');
ANALYZE TABLE t2;
@@ -1665,7 +1665,7 @@ SELECT * FROM t2 WHERE f1 <> 'qux';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`f1` AS `f1` from `test`.`t2` where (`test`.`t2`.`f1` <> 'qux')
+Note 1003 select `test`.`t2`.`f1` AS `f1` from `test`.`t2` where `test`.`t2`.`f1` <> 'qux'
DROP TABLE t1,t2;
#
# End of 10.0 tests
diff --git a/mysql-test/r/selectivity_no_engine.result b/mysql-test/r/selectivity_no_engine.result
index 31037e90a84..7fc3c6e9909 100644
--- a/mysql-test/r/selectivity_no_engine.result
+++ b/mysql-test/r/selectivity_no_engine.result
@@ -38,12 +38,12 @@ explain extended select * from t2 where col1 IN (20, 180);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.35 Using where
Warnings:
-Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where (`test`.`t2`.`col1` in (20,180))
+Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` in (20,180)
explain extended select * from t2 where col1 IN (180, 20);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.35 Using where
Warnings:
-Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where (`test`.`t2`.`col1` in (180,20))
+Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` in (180,20)
drop table t1, t2;
#
# MDEV-5926: EITS: Histogram estimates for column=least_possible_value are wrong
@@ -65,25 +65,25 @@ explain extended select * from t1 where a=2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 9.52 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
# Should select about 10%:
explain extended select * from t1 where a=1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 9.52 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 1)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1
# Must not have filtered=100%:
explain extended select * from t1 where a=0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 9.52 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 0)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0
# Again, must not have filtered=100%:
explain extended select * from t1 where a=-1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 9.52 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = <cache>(-(1)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = -1
drop table t0, t1;
#
# MDEV-4362: Selectivity estimates for IN (...) do not depend on whether the values are in range
@@ -104,18 +104,18 @@ explain extended select * from t1 where col1 in (1,2,3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 3.37 Using where
Warnings:
-Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where (`test`.`t1`.`col1` in (1,2,3))
+Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` in (1,2,3)
# Must not cause fp division by zero, or produce nonsense numbers:
explain extended select * from t1 where col1 in (-1,-2,-3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 5.94 Using where
Warnings:
-Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where (`test`.`t1`.`col1` in (<cache>(-(1)),<cache>(-(2)),<cache>(-(3))))
+Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` in (-1,-2,-3)
explain extended select * from t1 where col1<=-1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 1.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where (`test`.`t1`.`col1` <= <cache>(-(1)))
+Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` <= -1
drop table t1, t2;
#
# MDEV-5984: EITS: Incorrect filtered% value for single-table select with range access
@@ -136,7 +136,7 @@ explain extended select * from t2 where a in (1,2,3) and b in (1,2,3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range a a 10 NULL 9 100.00 Using index condition
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col2` AS `col2` from `test`.`t2` where ((`test`.`t2`.`a` in (1,2,3)) and (`test`.`t2`.`b` in (1,2,3)))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col2` AS `col2` from `test`.`t2` where `test`.`t2`.`a` in (1,2,3) and `test`.`t2`.`b` in (1,2,3)
drop table t2, t1;
#
# MDEV-5980: EITS: if condition is used for REF access, its selectivity is still in filtered%
@@ -157,13 +157,13 @@ explain extended select * from t1 where col1=2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 9.90 Using where
Warnings:
-Note 1003 select `test`.`t1`.`key1` AS `key1`,`test`.`t1`.`col1` AS `col1` from `test`.`t1` where (`test`.`t1`.`col1` = 2)
+Note 1003 select `test`.`t1`.`key1` AS `key1`,`test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` = 2
# Must show 100%, not 10%
explain extended select * from t1 where key1=2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ref key1 key1 5 const 98 100.00
Warnings:
-Note 1003 select `test`.`t1`.`key1` AS `key1`,`test`.`t1`.`col1` AS `col1` from `test`.`t1` where (`test`.`t1`.`key1` = 2)
+Note 1003 select `test`.`t1`.`key1` AS `key1`,`test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`key1` = 2
drop table t0, t1;
# MDEV-6003: EITS: ref access, keypart2=const vs keypart2=expr - inconsistent filtered% value
#
@@ -195,14 +195,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 100.00 Using where
1 SIMPLE t1 ref kp1 kp1 10 test.t0.a,func 10 100.00 Using index condition
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t1`.`kp1` AS `kp1`,`test`.`t1`.`kp2` AS `kp2`,`test`.`t1`.`filler1` AS `filler1`,`test`.`t1`.`filler2` AS `filler2` from `test`.`t0` join `test`.`t1` where ((`test`.`t1`.`kp1` = `test`.`t0`.`a`) and (`test`.`t1`.`kp2` = (`test`.`t0`.`a` + 1)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t1`.`kp1` AS `kp1`,`test`.`t1`.`kp2` AS `kp2`,`test`.`t1`.`filler1` AS `filler1`,`test`.`t1`.`filler2` AS `filler2` from `test`.`t0` join `test`.`t1` where `test`.`t1`.`kp1` = `test`.`t0`.`a` and `test`.`t1`.`kp2` = `test`.`t0`.`a` + 1
# 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;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 100.00 Using where
1 SIMPLE t1 ref kp1 kp1 10 test.t0.a,const 10 100.00
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t1`.`kp1` AS `kp1`,`test`.`t1`.`kp2` AS `kp2`,`test`.`t1`.`filler1` AS `filler1`,`test`.`t1`.`filler2` AS `filler2` from `test`.`t0` join `test`.`t1` where ((`test`.`t1`.`kp1` = `test`.`t0`.`a`) and (`test`.`t1`.`kp2` = 4))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t1`.`kp1` AS `kp1`,`test`.`t1`.`kp2` AS `kp2`,`test`.`t1`.`filler1` AS `filler1`,`test`.`t1`.`filler2` AS `filler2` from `test`.`t0` join `test`.`t1` where `test`.`t1`.`kp1` = `test`.`t0`.`a` and `test`.`t1`.`kp2` = 4
drop table t0, t1;
#
# MDEV-6209: Assertion `join->best_read < double(1.79769313486231570815e+308L)'
@@ -267,14 +267,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE ta ALL NULL NULL NULL NULL 1000 4.95 Using where
1 SIMPLE tb ALL NULL NULL NULL NULL 1000 9.90 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`ta`.`a` AS `a`,`test`.`tb`.`a` AS `a` from `test`.`t1` `ta` join `test`.`t2` `tb` where ((`test`.`ta`.`a` < 40) and (`test`.`tb`.`a` < 100))
+Note 1003 select `test`.`ta`.`a` AS `a`,`test`.`tb`.`a` AS `a` from `test`.`t1` `ta` join `test`.`t2` `tb` where `test`.`ta`.`a` < 40 and `test`.`tb`.`a` < 100
# 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;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE ta ALL NULL NULL NULL NULL 1000 4.95 Using where
1 SIMPLE tb ALL NULL NULL NULL NULL 1000 4.95 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`ta`.`a` AS `a`,`test`.`tb`.`a` AS `a` from `test`.`t1` `ta` join `test`.`t2` `tb` where ((`test`.`tb`.`a` = `test`.`ta`.`a`) and (`test`.`ta`.`a` < 40) and (`test`.`ta`.`a` < 100))
+Note 1003 select `test`.`ta`.`a` AS `a`,`test`.`tb`.`a` AS `a` from `test`.`t1` `ta` join `test`.`t2` `tb` where `test`.`tb`.`a` = `test`.`ta`.`a` and `test`.`ta`.`a` < 40 and `test`.`ta`.`a` < 100
drop table t0,t1,t2;
#
# MDEV-8779: mysqld got signal 11 in sql/opt_range_mrr.cc:100(step_down_to)
diff --git a/mysql-test/r/set_statement.result b/mysql-test/r/set_statement.result
index adb50afde99..406ca99a5ea 100644
--- a/mysql-test/r/set_statement.result
+++ b/mysql-test/r/set_statement.result
@@ -642,7 +642,7 @@ SELECT @@myisam_sort_buffer_size,
'# Pre-STATEMENT variable value
SELECT @@sql_mode;
@@sql_mode
-NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
''
''
SET STATEMENT sql_mode='ansi' FOR PREPARE stmt FROM 'SELECT "t1".* FROM t1';
@@ -652,14 +652,16 @@ v1 v2
3 4
ALTER TABLE t1 ADD COLUMN v3 int;
execute stmt;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '.* FROM t1' at line 1
+v1 v2 v3
+1 2 NULL
+3 4 NULL
ALTER TABLE t1 drop COLUMN v3;
deallocate prepare stmt;
''
'# Post-STATEMENT
SELECT @@sql_mode;
@@sql_mode
-NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
check the same behaviour in normal set
SET sql_mode='ansi';
PREPARE stmt FROM 'SELECT "t1".* FROM t1';
@@ -670,12 +672,14 @@ v1 v2
3 4
ALTER TABLE t1 ADD COLUMN v3 int;
execute stmt;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '.* FROM t1' at line 1
+v1 v2 v3
+1 2 NULL
+3 4 NULL
ALTER TABLE t1 drop COLUMN v3;
deallocate prepare stmt;
SELECT @@sql_mode;
@@sql_mode
-NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
SET sql_mode='ansi';
SELECT @@sql_mode;
@@sql_mode
@@ -704,7 +708,7 @@ ALTER TABLE t1 drop COLUMN v3;
drop procedure p6;
SELECT @@sql_mode;
@@sql_mode
-NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
# SET and the statement parsed as one unit before the SET takes effect
SET STATEMENT sql_mode='ansi' FOR
CREATE PROCEDURE p6() BEGIN
@@ -715,7 +719,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
END' at line 4
SELECT @@sql_mode;
@@sql_mode
-NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
SET sql_mode='ansi';
SELECT @@sql_mode;
@@sql_mode
@@ -732,7 +736,7 @@ v1 v2
SET sql_mode=default;
SELECT @@sql_mode;
@@sql_mode
-NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
# SET and the statement parsed as one unit before the SET takes effect
SET STATEMENT sql_mode='ansi' FOR
BEGIN NOT ATOMIC
@@ -924,10 +928,10 @@ RETURN mx;
END|
SET STATEMENT myisam_repair_threads=(select max(v1) from t1) FOR
select 1;
-ERROR 42000: SET STATEMENT does not support subqueries or stored functions.
+ERROR 42000: SET STATEMENT does not support subqueries or stored functions
SET STATEMENT myisam_repair_threads=myProc() FOR
select 1;
-ERROR 42000: SET STATEMENT does not support subqueries or stored functions.
+ERROR 42000: SET STATEMENT does not support subqueries or stored functions
drop function myProc;
drop table t1;
set session binlog_format=mixed;
@@ -1152,7 +1156,7 @@ explain extended select week(a) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select week('2000-01-01',@@default_week_format) AS `week(a)` from dual
+Note 1003 select week('2000-01-01') AS `week(a)` from dual
prepare stmt1 from "select week(a) from t1";
execute stmt1;
week(a)
diff --git a/mysql-test/r/set_statement_debug.result b/mysql-test/r/set_statement_debug.result
index bf873a6e824..39c5af2c623 100644
--- a/mysql-test/r/set_statement_debug.result
+++ b/mysql-test/r/set_statement_debug.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("Sort aborted.*");
set @save_debug_dbug= @@debug_dbug;
set statement debug_dbug="d,something" for select @@debug_dbug;
@@debug_dbug
diff --git a/mysql-test/r/set_statement_notembedded_binlog.result b/mysql-test/r/set_statement_notembedded_binlog.result
index f23d4e97748..50fcde5a1cb 100644
--- a/mysql-test/r/set_statement_notembedded_binlog.result
+++ b/mysql-test/r/set_statement_notembedded_binlog.result
@@ -35,10 +35,10 @@ f1()
1113
111313
Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave
show binlog events limit 16, 100;
Log_name Pos Event_type Server_id End_log_pos Info
x x x x x LAST_INSERT_ID=0
@@ -77,10 +77,10 @@ f1()
1113
111313
Warnings:
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
-Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave
show binlog events limit 13, 100;
Log_name Pos Event_type Server_id End_log_pos Info
x x x x x LAST_INSERT_ID=0
diff --git a/mysql-test/r/shm.result b/mysql-test/r/shm.result
index a2c38627e9d..65187b6b19b 100644
--- a/mysql-test/r/shm.result
+++ b/mysql-test/r/shm.result
@@ -1,3 +1,4 @@
+connect shm_con,localhost,root,,,,$shm_name,SHM;
drop table if exists t1,t2,t3,t4;
CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
@@ -601,7 +602,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
+1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
1 SIMPLE t3 ref period period 4 test.t1.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
id select_type table type possible_keys key key_len ref rows Extra
@@ -1508,7 +1509,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
Warnings:
-Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> ''))
+Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> ''
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
@@ -2154,6 +2155,8 @@ Privat (Private Nutzung) Mobilfunk
Warnings:
Warning 1052 Column 'kundentyp' in group statement is ambiguous
drop table t1;
+connection default;
+disconnect shm_con;
mysqld is alive
SET @max_allowed_packet= @@global.max_allowed_packet;
SET @net_buffer_length= @@global.net_buffer_length;
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 585ab305420..1c11bdd13d1 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -12,51 +12,51 @@ insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
-- after Bug#29394 is implemented.
check table t1 fast;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def Table 253 128 7 Y 0 31 8
-def Op 253 10 5 Y 0 31 8
-def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 250 393216 27 Y 0 31 8
+def Table 253 128 7 Y 0 39 8
+def Op 253 10 5 Y 0 39 8
+def Msg_type 253 10 6 Y 0 39 8
+def Msg_text 250 393216 27 Y 0 39 8
Table Op Msg_type Msg_text
test.t1 check status Table is already up to date
check table t1 fast;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def Table 253 128 7 Y 0 31 8
-def Op 253 10 5 Y 0 31 8
-def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 250 393216 27 Y 0 31 8
+def Table 253 128 7 Y 0 39 8
+def Op 253 10 5 Y 0 39 8
+def Msg_type 253 10 6 Y 0 39 8
+def Msg_text 250 393216 27 Y 0 39 8
Table Op Msg_type Msg_text
test.t1 check status Table is already up to date
check table t1 changed;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def Table 253 128 7 Y 0 31 8
-def Op 253 10 5 Y 0 31 8
-def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 250 393216 2 Y 0 31 8
+def Table 253 128 7 Y 0 39 8
+def Op 253 10 5 Y 0 39 8
+def Msg_type 253 10 6 Y 0 39 8
+def Msg_text 250 393216 2 Y 0 39 8
Table Op Msg_type Msg_text
test.t1 check status OK
insert into t1 values (5,5,5);
check table t1 changed;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def Table 253 128 7 Y 0 31 8
-def Op 253 10 5 Y 0 31 8
-def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 250 393216 2 Y 0 31 8
+def Table 253 128 7 Y 0 39 8
+def Op 253 10 5 Y 0 39 8
+def Msg_type 253 10 6 Y 0 39 8
+def Msg_text 250 393216 2 Y 0 39 8
Table Op Msg_type Msg_text
test.t1 check status OK
check table t1 medium;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def Table 253 128 7 Y 0 31 8
-def Op 253 10 5 Y 0 31 8
-def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 250 393216 2 Y 0 31 8
+def Table 253 128 7 Y 0 39 8
+def Op 253 10 5 Y 0 39 8
+def Msg_type 253 10 6 Y 0 39 8
+def Msg_text 250 393216 2 Y 0 39 8
Table Op Msg_type Msg_text
test.t1 check status OK
check table t1 extended;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def Table 253 128 7 Y 0 31 8
-def Op 253 10 5 Y 0 31 8
-def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 250 393216 2 Y 0 31 8
+def Table 253 128 7 Y 0 39 8
+def Op 253 10 5 Y 0 39 8
+def Msg_type 253 10 6 Y 0 39 8
+def Msg_text 250 393216 2 Y 0 39 8
Table Op Msg_type Msg_text
test.t1 check status OK
show index from t1;
@@ -85,10 +85,10 @@ ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
-- after Bug#29394 is implemented.
optimize table t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def Table 253 128 7 Y 0 31 8
-def Op 253 10 8 Y 0 31 8
-def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 250 393216 2 Y 0 31 8
+def Table 253 128 7 Y 0 39 8
+def Op 253 10 8 Y 0 39 8
+def Msg_type 253 10 6 Y 0 39 8
+def Msg_text 250 393216 2 Y 0 39 8
Table Op Msg_type Msg_text
test.t1 optimize status OK
optimize table t1;
@@ -157,10 +157,10 @@ 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
-- after Bug#29394 is implemented.
analyze table t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def Table 253 128 7 Y 0 31 8
-def Op 253 10 7 Y 0 31 8
-def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 250 393216 2 Y 0 31 8
+def Table 253 128 7 Y 0 39 8
+def Op 253 10 7 Y 0 39 8
+def Msg_type 253 10 6 Y 0 39 8
+def Msg_text 250 393216 2 Y 0 39 8
Table Op Msg_type Msg_text
test.t1 analyze status OK
show index from t1;
@@ -174,10 +174,10 @@ t1 0 PRIMARY 4 f4 A 18 NULL NULL BTREE
-- after Bug#29394 is implemented.
repair table t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def Table 253 128 7 Y 0 31 8
-def Op 253 10 6 Y 0 31 8
-def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 250 393216 2 Y 0 31 8
+def Table 253 128 7 Y 0 39 8
+def Op 253 10 6 Y 0 39 8
+def Msg_type 253 10 6 Y 0 39 8
+def Msg_text 250 393216 2 Y 0 39 8
Table Op Msg_type Msg_text
test.t1 repair status OK
show index from t1;
@@ -332,7 +332,7 @@ index(type_short)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `type_bool` tinyint(1) NOT NULL DEFAULT '0',
+ `type_bool` tinyint(1) NOT NULL DEFAULT 0,
`type_tiny` tinyint(4) NOT NULL AUTO_INCREMENT,
`type_short` smallint(3) DEFAULT NULL,
`type_mediumint` mediumint(9) DEFAULT NULL,
@@ -342,17 +342,17 @@ t1 CREATE TABLE `t1` (
`empty_char` char(0) DEFAULT NULL,
`type_char` char(2) DEFAULT NULL,
`type_varchar` varchar(10) DEFAULT NULL,
- `type_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `type_timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`type_date` date NOT NULL DEFAULT '0000-00-00',
`type_time` time NOT NULL DEFAULT '00:00:00',
`type_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`type_year` year(4) DEFAULT NULL,
`type_enum` enum('red','green','blue') DEFAULT NULL,
`type_set` enum('red','green','blue') DEFAULT NULL,
- `type_tinyblob` tinyblob,
- `type_blob` blob,
- `type_medium_blob` mediumblob,
- `type_long_blob` longblob,
+ `type_tinyblob` tinyblob DEFAULT NULL,
+ `type_blob` blob DEFAULT NULL,
+ `type_medium_blob` mediumblob DEFAULT NULL,
+ `type_long_blob` longblob DEFAULT NULL,
PRIMARY KEY (`type_tiny`),
KEY `type_short` (`type_short`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test'
@@ -524,6 +524,8 @@ 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;
a
1
@@ -534,6 +536,9 @@ drop table t1;
ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1'
drop database mysqltest;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest'
+disconnect con1;
+connect con2,localhost,mysqltest_2,,test;
+connection con2;
select * from mysqltest.t1;
ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't1'
show create database mysqltest;
@@ -542,6 +547,9 @@ drop table mysqltest.t1;
ERROR 42000: DROP command denied to user 'mysqltest_2'@'localhost' for table 't1'
drop database mysqltest;
ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest'
+disconnect con2;
+connect con3,localhost,mysqltest_3,,test;
+connection con3;
select * from mysqltest.t1;
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1'
show create database mysqltest;
@@ -549,6 +557,8 @@ Database Create Database
mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */
drop table mysqltest.t1;
drop database mysqltest;
+disconnect con3;
+connection default;
set names binary;
delete from mysql.user
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
@@ -732,17 +742,17 @@ DROP VIEW v1;
CREATE VIEW v1 AS SELECT NOW();
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select now() AS `NOW()` binary binary
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select current_timestamp() AS `NOW()` binary binary
DROP VIEW v1;
CREATE VIEW v1 AS SELECT SQL_CACHE NOW();
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache now() AS `NOW()` binary binary
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache current_timestamp() AS `NOW()` binary binary
DROP VIEW v1;
CREATE VIEW v1 AS SELECT SQL_NO_CACHE NOW();
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` binary binary
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache current_timestamp() AS `NOW()` binary binary
DROP VIEW v1;
CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE NOW();
ERROR HY000: Incorrect usage of SQL_CACHE and SQL_NO_CACHE
@@ -876,8 +886,8 @@ latin1_bin latin1 47 Yes 1
----------------------------------------------------------------
SHOW CREATE DATABASE mysqltest1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def Database 253 192 10 N 1 31 33
-def Create Database 253 3072 69 N 1 31 33
+def Database 253 192 10 N 1 39 33
+def Create Database 253 3072 69 N 1 39 33
Database Create Database
mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */
----------------------------------------------------------------
@@ -889,8 +899,8 @@ mysqltest1
----------------------------------------------------------------
SHOW CREATE TABLE t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def Table 253 192 2 N 1 31 33
-def Create Table 253 3072 102 N 1 31 33
+def Table 253 192 2 N 1 39 33
+def Create Table 253 3072 102 N 1 39 33
Table Create Table
t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL,
@@ -969,7 +979,7 @@ def information_schema COLUMNS COLUMNS CHARACTER_SET_NAME CHARACTER_SET_NAME 253
def information_schema COLUMNS COLUMNS COLLATION_NAME COLLATION_NAME 253 96 0 Y 0 0 33
def information_schema COLUMNS COLUMNS COLUMN_TYPE COLUMN_TYPE 252 589815 7 N 17 0 33
def information_schema COLUMNS COLUMNS COLUMN_KEY COLUMN_KEY 253 9 3 N 1 0 33
-def information_schema COLUMNS COLUMNS EXTRA EXTRA 253 81 0 N 1 0 33
+def information_schema COLUMNS COLUMNS EXTRA EXTRA 253 90 0 N 1 0 33
def information_schema COLUMNS COLUMNS PRIVILEGES PRIVILEGES 253 240 31 N 1 0 33
def information_schema COLUMNS COLUMNS COLUMN_COMMENT COLUMN_COMMENT 253 3072 0 N 1 0 33
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
@@ -988,7 +998,7 @@ def information_schema COLUMNS COLUMNS COLUMN_TYPE Type 252 589815 7 N 17 0 33
def information_schema COLUMNS COLUMNS IS_NULLABLE Null 253 9 2 N 1 0 33
def information_schema COLUMNS COLUMNS COLUMN_KEY Key 253 9 3 N 1 0 33
def information_schema COLUMNS COLUMNS COLUMN_DEFAULT Default 252 589788 0 Y 16 0 33
-def information_schema COLUMNS COLUMNS EXTRA Extra 253 81 0 N 1 0 33
+def information_schema COLUMNS COLUMNS EXTRA Extra 253 90 0 N 1 0 33
Field Type Null Key Default Extra
c int(11) NO PRI NULL
----------------------------------------------------------------
@@ -999,14 +1009,14 @@ def information_schema TRIGGERS TRIGGERS EVENT_MANIPULATION Event 253 18 6 N 1 0
def information_schema TRIGGERS TRIGGERS EVENT_OBJECT_TABLE Table 253 192 2 N 1 0 33
def information_schema TRIGGERS TRIGGERS ACTION_STATEMENT Statement 252 589815 10 N 17 0 33
def information_schema TRIGGERS TRIGGERS ACTION_TIMING Timing 253 18 6 N 1 0 33
-def information_schema TRIGGERS TRIGGERS CREATED Created 12 19 0 Y 128 0 63
-def information_schema TRIGGERS TRIGGERS SQL_MODE sql_mode 253 24576 42 N 1 0 33
+def information_schema TRIGGERS TRIGGERS CREATED Created 12 22 22 Y 128 2 63
+def information_schema TRIGGERS TRIGGERS SQL_MODE sql_mode 253 24576 89 N 1 0 33
def information_schema TRIGGERS TRIGGERS DEFINER Definer 253 567 14 N 1 0 33
def information_schema TRIGGERS TRIGGERS CHARACTER_SET_CLIENT character_set_client 253 96 6 N 1 0 33
def information_schema TRIGGERS TRIGGERS COLLATION_CONNECTION collation_connection 253 96 6 N 1 0 33
def information_schema TRIGGERS TRIGGERS DATABASE_COLLATION Database Collation 253 96 17 N 1 0 33
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
-t1_bi INSERT t1 SET @a = 1 BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost binary binary latin1_swedish_ci
+t1_bi INSERT t1 SET @a = 1 BEFORE # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost binary binary latin1_swedish_ci
----------------------------------------------------------------
SELECT
TRIGGER_CATALOG,
@@ -1044,17 +1054,22 @@ def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_OLD_TABLE ACTION_REFER
def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_NEW_TABLE 253 192 0 Y 0 0 33
def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_OLD_ROW 253 9 3 N 1 0 33
def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_NEW_ROW ACTION_REFERENCE_NEW_ROW 253 9 3 N 1 0 33
-def information_schema TRIGGERS TRIGGERS SQL_MODE SQL_MODE 253 24576 42 N 1 0 33
+def information_schema TRIGGERS TRIGGERS SQL_MODE SQL_MODE 253 24576 89 N 1 0 33
def information_schema TRIGGERS TRIGGERS DEFINER DEFINER 253 567 14 N 1 0 33
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
-def test t1_bi INSERT def test t1 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost
+def test t1_bi INSERT def test t1 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost
+SELECT CREATED FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name='t1_bi';
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def information_schema TRIGGERS TRIGGERS CREATED CREATED 12 22 22 Y 128 2 63
+CREATED
+#
----------------------------------------------------------------
SHOW CREATE VIEW v1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def View 253 192 2 N 1 31 33
-def Create View 253 3072 103 N 1 31 33
-def character_set_client 253 96 6 N 1 31 33
-def collation_connection 253 96 6 N 1 31 33
+def View 253 192 2 N 1 39 33
+def Create View 253 3072 103 N 1 39 33
+def character_set_client 253 96 6 N 1 39 33
+def collation_connection 253 96 6 N 1 39 33
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` binary binary
----------------------------------------------------------------
@@ -1078,14 +1093,14 @@ def test v1 select 1 AS `1` NONE NO root@localhost DEFINER binary binary UNDEFIN
----------------------------------------------------------------
SHOW CREATE PROCEDURE p1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def Procedure 253 192 2 N 1 31 33
-def sql_mode 253 126 42 N 1 31 33
-def Create Procedure 253 3072 59 Y 0 31 33
-def character_set_client 253 96 6 N 1 31 33
-def collation_connection 253 96 6 N 1 31 33
-def Database Collation 253 96 17 N 1 31 33
+def Procedure 253 192 2 N 1 39 33
+def sql_mode 253 267 89 N 1 39 33
+def Create Procedure 253 3072 59 Y 0 39 33
+def character_set_client 253 96 6 N 1 39 33
+def collation_connection 253 96 6 N 1 39 33
+def Database Collation 253 96 17 N 1 39 33
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-p1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
SELECT 1 binary binary latin1_swedish_ci
----------------------------------------------------------------
SELECT
@@ -1125,22 +1140,22 @@ def information_schema ROUTINES ROUTINES IS_DETERMINISTIC IS_DETERMINISTIC 253 9
def information_schema ROUTINES ROUTINES SQL_DATA_ACCESS SQL_DATA_ACCESS 253 192 12 N 1 0 33
def information_schema ROUTINES ROUTINES SQL_PATH SQL_PATH 253 192 0 Y 0 0 33
def information_schema ROUTINES ROUTINES SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33
-def information_schema ROUTINES ROUTINES SQL_MODE SQL_MODE 253 24576 42 N 1 0 33
+def information_schema ROUTINES ROUTINES SQL_MODE SQL_MODE 253 24576 89 N 1 0 33
def information_schema ROUTINES ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 252 589815 0 N 17 0 33
def information_schema ROUTINES ROUTINES DEFINER DEFINER 253 567 14 N 1 0 33
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
-p1 def test p1 PROCEDURE NULL SQL SELECT 1 NULL NULL SQL NO CONTAINS SQL NULL DEFINER NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost
+p1 def test p1 PROCEDURE NULL SQL SELECT 1 NULL NULL SQL NO CONTAINS SQL NULL DEFINER STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost
----------------------------------------------------------------
SHOW CREATE FUNCTION f1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def Function 253 192 2 N 1 31 33
-def sql_mode 253 126 42 N 1 31 33
-def Create Function 253 3072 74 Y 0 31 33
-def character_set_client 253 96 6 N 1 31 33
-def collation_connection 253 96 6 N 1 31 33
-def Database Collation 253 96 17 N 1 31 33
+def Function 253 192 2 N 1 39 33
+def sql_mode 253 267 89 N 1 39 33
+def Create Function 253 3072 74 Y 0 39 33
+def character_set_client 253 96 6 N 1 39 33
+def collation_connection 253 96 6 N 1 39 33
+def Database Collation 253 96 17 N 1 39 33
Function sql_mode Create Function character_set_client collation_connection Database Collation
-f1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
RETURN 1 binary binary latin1_swedish_ci
----------------------------------------------------------------
SELECT
@@ -1180,11 +1195,11 @@ def information_schema ROUTINES ROUTINES IS_DETERMINISTIC IS_DETERMINISTIC 253 9
def information_schema ROUTINES ROUTINES SQL_DATA_ACCESS SQL_DATA_ACCESS 253 192 12 N 1 0 33
def information_schema ROUTINES ROUTINES SQL_PATH SQL_PATH 253 192 0 Y 0 0 33
def information_schema ROUTINES ROUTINES SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33
-def information_schema ROUTINES ROUTINES SQL_MODE SQL_MODE 253 24576 42 N 1 0 33
+def information_schema ROUTINES ROUTINES SQL_MODE SQL_MODE 253 24576 89 N 1 0 33
def information_schema ROUTINES ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 252 589815 0 N 17 0 33
def information_schema ROUTINES ROUTINES DEFINER DEFINER 253 567 14 N 1 0 33
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
-f1 def test f1 FUNCTION int(11) SQL RETURN 1 NULL NULL SQL NO CONTAINS SQL NULL DEFINER NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost
+f1 def test f1 FUNCTION int(11) SQL RETURN 1 NULL NULL SQL NO CONTAINS SQL NULL DEFINER STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost
----------------------------------------------------------------
DROP DATABASE mysqltest1;
DROP TABLE t1;
@@ -1258,14 +1273,14 @@ PRIMARY KEY (Codigo)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
show create table t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def Table 253 64 2 N 1 31 7
-def Create Table 253 1024 445 N 1 31 7
+def Table 253 64 2 N 1 39 7
+def Create Table 253 1024 458 N 1 39 7
Table Create Table
t1 CREATE TABLE `t1` (
`Codigo` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Nombre` varchar(255) DEFAULT NULL,
`Telefono` varchar(255) DEFAULT NULL,
- `Observaciones` longtext,
+ `Observaciones` longtext DEFAULT NULL,
`Direccion` varchar(255) DEFAULT NULL,
`Dni` varchar(255) DEFAULT NULL,
`CP` int(11) DEFAULT NULL,
@@ -1284,9 +1299,13 @@ 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;
Database Create Database
mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */
+disconnect con4;
+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';
@@ -1349,70 +1368,70 @@ DROP PROCEDURE IF EXISTS p1;
CREATE TABLE t1(c1 INT);
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1;
SHOW CREATE TRIGGER t1_bi;
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
CREATE PROCEDURE p1() SHOW CREATE TRIGGER t1_bi;
CALL p1();
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
CALL p1();
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
CALL p1();
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
CALL p1();
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
CALL p1();
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
CALL p1();
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
CALL p1();
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
CALL p1();
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
CALL p1();
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
CALL p1();
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
PREPARE stmt1 FROM 'SHOW CREATE TRIGGER t1_bi';
EXECUTE stmt1;
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
EXECUTE stmt1;
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
EXECUTE stmt1;
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
EXECUTE stmt1;
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
EXECUTE stmt1;
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
EXECUTE stmt1;
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
EXECUTE stmt1;
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
EXECUTE stmt1;
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
EXECUTE stmt1;
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
EXECUTE stmt1;
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci #
DROP TABLE t1;
DROP PROCEDURE p1;
DEALLOCATE PREPARE stmt1;
@@ -1436,20 +1455,20 @@ View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'теÑÑ‚' AS `test` koi8r koi8r_general_ci
SHOW CREATE PROCEDURE p1;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-p1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
SELECT 'теÑÑ‚' AS test koi8r koi8r_general_ci latin1_swedish_ci
SHOW CREATE FUNCTION f1;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-f1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS char(10) CHARSET latin1
+f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS char(10) CHARSET latin1
RETURN 'теÑÑ‚' koi8r koi8r_general_ci latin1_swedish_ci
SHOW CREATE TRIGGER t1_bi;
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1
FOR EACH ROW
-SET NEW.c1 = 'теÑÑ‚' koi8r koi8r_general_ci latin1_swedish_ci
+SET NEW.c1 = 'теÑÑ‚' koi8r koi8r_general_ci latin1_swedish_ci #
SHOW CREATE EVENT ev1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
-ev1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 'теÑÑ‚' AS test koi8r koi8r_general_ci latin1_swedish_ci
+ev1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 'теÑÑ‚' AS test koi8r koi8r_general_ci latin1_swedish_ci
DROP VIEW v1;
DROP PROCEDURE p1;
DROP FUNCTION f1;
@@ -1458,17 +1477,22 @@ DROP EVENT ev1;
SHOW STORAGE ENGINES;
CREATE USER test_u@localhost;
GRANT PROCESS ON *.* TO test_u@localhost;
+connect conn1, localhost, test_u,,;
SHOW ENGINE MYISAM MUTEX;
SHOW ENGINE MYISAM STATUS;
+disconnect conn1;
+connection default;
DROP USER test_u@localhost;
End of 5.1 tests
#
# Bug#52593 SHOW CREATE TABLE is blocked if table is locked
# for write by another connection
DROP TABLE IF EXISTS t1;
+connect con1, localhost,root;
+connection default;
CREATE TABLE t1 (i INT PRIMARY KEY);
LOCK TABLE t1 WRITE;
-# Switching to connection 'con1'.
+connection con1;
# This statement used to be blocked.
SHOW CREATE TABLE t1;
Table Create Table
@@ -1476,7 +1500,8 @@ t1 CREATE TABLE `t1` (
`i` int(11) NOT NULL,
PRIMARY KEY (`i`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-# Switching to connection 'default'.
+disconnect con1;
+connection default;
UNLOCK TABLES;
DROP TABLE t1;
#
@@ -1485,20 +1510,21 @@ DROP TABLE t1;
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT);
-# Connection con1
+connect con1,localhost,root;
LOCK TABLE t1 WRITE;
-# Connection default
+connection default;
START TRANSACTION;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-# Connection con1
+connection con1;
ALTER TABLE t1 CHARACTER SET = utf8;
UNLOCK TABLES;
-# Connection default
+connection default;
COMMIT;
+disconnect con1;
DROP TABLE t1;
#
# Bug#55498 SHOW CREATE TRIGGER takes wrong type of metadata lock.
@@ -1507,23 +1533,24 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT);
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1;
# Test 1: SHOW CREATE TRIGGER with WRITE locked table.
-# Connection con1
+connect con1, localhost, root;
LOCK TABLE t1 WRITE;
-# Connection default
+connection default;
SHOW CREATE TRIGGER t1_bi;
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci
-# Connection con1
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci #
+connection con1;
UNLOCK TABLES;
# Test 2: ALTER TABLE with SHOW CREATE TRIGGER in transaction
-# Connection default
+connection default;
START TRANSACTION;
SHOW CREATE TRIGGER t1_bi;
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci
-# Connection con1
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci #
+connection con1;
ALTER TABLE t1 CHARACTER SET = utf8;
-# Connection default
+disconnect con1;
+connection default;
COMMIT;
DROP TRIGGER t1_bi;
DROP TABLE t1;
@@ -1534,8 +1561,11 @@ SET NAMES latin1;
SELECT GET_LOCK('t', 1000);
GET_LOCK('t', 1000)
1
+connect con1,localhost,root,,;
+connection con1;
SET NAMES latin1;
SELECT GET_LOCK('t',1000) AS 'óóóó';;
+connection default;
SHOW PROCESSLIST;
Id User Host db Command Time State Info Progress
### root ### test Query ### ### SHOW PROCESSLIST 0.000
@@ -1548,8 +1578,11 @@ Id User Host db Command Time State Info Progress
SELECT RELEASE_LOCK('t');
RELEASE_LOCK('t')
1
+connection con1;
óóóó
1
+disconnect con1;
+connection default;
SET NAMES latin1;
#
# Test SHOW AUTHORS and SHOW CONTRIBUTORS
diff --git a/mysql-test/r/show_create_user.result b/mysql-test/r/show_create_user.result
new file mode 100644
index 00000000000..63013eca074
--- /dev/null
+++ b/mysql-test/r/show_create_user.result
@@ -0,0 +1,39 @@
+create user foo;
+show create user foo;
+CREATE USER for foo@%
+CREATE USER 'foo'@'%'
+create user foo@test;
+show create user foo@test;
+CREATE USER for foo@test
+CREATE USER 'foo'@'test'
+create user foo2@test identified by 'password';
+show create user foo2@test;
+CREATE USER for foo2@test
+CREATE USER 'foo2'@'test' IDENTIFIED BY PASSWORD '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'
+alter user foo2@test identified with 'someplugin' as 'somepassword';
+show create user foo2@test;
+CREATE USER for foo2@test
+CREATE USER 'foo2'@'test' IDENTIFIED VIA someplugin USING 'somepassword'
+create user foo3@test require SSL;
+show create user foo3@test;
+CREATE USER for foo3@test
+CREATE USER 'foo3'@'test' REQUIRE SSL
+create user foo4@test require cipher 'text' issuer 'foo_issuer' subject 'foo_subject';
+show create user foo4@test;
+CREATE USER for foo4@test
+CREATE USER 'foo4'@'test' REQUIRE ISSUER 'foo_issuer' SUBJECT 'foo_subject' CIPHER 'text'
+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;
+CREATE USER for foo5@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.500000
+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/r/show_explain.result b/mysql-test/r/show_explain.result
index 0dc6f2b28ac..0819ae5ba37 100644
--- a/mysql-test/r/show_explain.result
+++ b/mysql-test/r/show_explain.result
@@ -13,38 +13,48 @@ show explain for 2000000000;
ERROR HY000: Unknown thread id: 2000000000
show explain for (select max(a) from t0);
ERROR HY000: You may only use constant expressions in this statement
+connect con1, localhost, root,,;
+connection con1;
SET @old_debug= @@session.debug;
+connection default;
show explain for $thr2;
ERROR HY000: Target is not running an EXPLAINable command
show explain for $thr1;
ERROR HY000: Target is not running an EXPLAINable command
+connection con1;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
select count(*) from t1 where a < 100000;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index a a 5 NULL 1000 Using where; Using index
Warnings:
Note 1003 select count(*) from t1 where a < 100000
+connection con1;
count(*)
1000
select max(c) from t1 where a < 10;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 10 Using index condition
Warnings:
Note 1003 select max(c) from t1 where a < 10
+connection con1;
max(c)
9
# We can catch EXPLAIN, too.
set @show_expl_tmp= @@optimizer_switch;
set optimizer_switch='index_condition_pushdown=on,mrr=on,mrr_sort_keys=on';
explain select max(c) from t1 where a < 10;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan
Warnings:
Note 1003 explain select max(c) from t1 where a < 10
+connection con1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan
set optimizer_switch= @show_expl_tmp;
@@ -53,6 +63,7 @@ set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
explain select a from t0 A union select a+1 from t0 B;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A ALL NULL NULL NULL NULL 10
@@ -60,6 +71,7 @@ id select_type table type possible_keys key key_len ref rows Extra
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
Warnings:
Note 1003 explain select a from t0 A union select a+1 from t0 B
+connection con1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A ALL NULL NULL NULL NULL 10
2 UNION B ALL NULL NULL NULL NULL 10
@@ -69,6 +81,7 @@ set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
explain select a from t0 A union select a+1 from t0 B;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A ALL NULL NULL NULL NULL 10
@@ -76,6 +89,7 @@ id select_type table type possible_keys key key_len ref rows Extra
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
Warnings:
Note 1003 explain select a from t0 A union select a+1 from t0 B
+connection con1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A ALL NULL NULL NULL NULL 10
2 UNION B ALL NULL NULL NULL NULL 10
@@ -85,12 +99,14 @@ set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 B) from t0 A where a<1;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where
2 SUBQUERY B ALL NULL NULL NULL NULL 10
Warnings:
Note 1003 select a, (select max(a) from t0 B) from t0 A where a<1
+connection con1;
a (select max(a) from t0 B)
0 9
set debug_dbug=@old_debug;
@@ -98,12 +114,14 @@ set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
explain select a, (select max(a) from t0 B) from t0 A where a<1;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where
2 SUBQUERY B ALL NULL NULL NULL NULL 10
Warnings:
Note 1003 explain select a, (select max(a) from t0 B) from t0 A where a<1
+connection con1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where
2 SUBQUERY B ALL NULL NULL NULL NULL 10
@@ -112,12 +130,14 @@ set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where
2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where
Warnings:
Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
+connection con1;
a (select max(a) from t0 b where b.a+a.a<10)
0 9
set debug_dbug=@old_debug;
@@ -125,12 +145,14 @@ set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where
2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where
Warnings:
Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
+connection con1;
a (select max(a) from t0 b where b.a+a.a<10)
0 9
set debug_dbug=@old_debug;
@@ -138,12 +160,14 @@ set debug_dbug=@old_debug;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where
2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where
Warnings:
Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
+connection con1;
a (select max(a) from t0 b where b.a+a.a<10)
0 9
set debug_dbug=@old_debug;
@@ -151,12 +175,14 @@ set debug_dbug=@old_debug;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where
2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where
Warnings:
Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
+connection con1;
a (select max(a) from t0 b where b.a+a.a<10)
0 9
set debug_dbug=@old_debug;
@@ -164,12 +190,14 @@ set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where
2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where
Warnings:
Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
+connection con1;
a (select max(a) from t0 b where b.a+a.a<10)
0 9
set debug_dbug=@old_debug;
@@ -179,9 +207,11 @@ set debug_dbug=@old_debug;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set @foo= (select max(a) from t0 where sin(a) >0);
+connection default;
show explain for $thr2;
ERROR HY000: Target is not running an EXPLAINable command
kill query $thr2;
+connection con1;
ERROR 70100: Query execution was interrupted
set debug_dbug=@old_debug;
#
@@ -191,6 +221,7 @@ create table t2 as select a as a, a as dummy from t0 limit 2;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
@@ -203,6 +234,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where
Warnings:
Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3
+connection con1;
drop table t2;
set debug_dbug=@old_debug;
#
@@ -212,6 +244,7 @@ create table t2 as select a as a, a as dummy from t0 limit 2;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
@@ -224,6 +257,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where
Warnings:
Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3
+connection con1;
drop table t2;
set debug_dbug=@old_debug;
#
@@ -233,6 +267,7 @@ create table t2 as select a as a, a as dummy from t0 limit 3;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 3
@@ -251,6 +286,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where
Warnings:
Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+connection con1;
a SUBQ
0 0
1 0
@@ -266,11 +302,13 @@ id select_type table type possible_keys key key_len ref rows Extra
set debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
select * from t0 order by a;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using filesort
Warnings:
Note 1003 select * from t0 order by a
+connection con1;
a
0
1
@@ -286,17 +324,21 @@ set debug_dbug=@old_debug;
#
# SHOW EXPLAIN for SELECT ... with "Using temporary"
#
+connection default;
explain select distinct a from t0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary
+connection con1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
select distinct a from t0;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary
Warnings:
Note 1003 select distinct a from t0
+connection con1;
a
0
1
@@ -312,17 +354,21 @@ set debug_dbug=@old_debug;
#
# SHOW EXPLAIN for SELECT ... with "Using temporary; Using filesort"
#
+connection default;
explain select distinct a from t0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary
+connection con1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
select distinct a from t0;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary
Warnings:
Note 1003 select distinct a from t0
+connection con1;
a
0
1
@@ -346,6 +392,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join)
set debug_dbug='+d,show_explain_in_find_all_keys';
SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a;
+connection default;
# FIXED by "conservative assumptions about when QEP is available" fix:
# NOTE: current code will not show "Using join buffer":
show explain for $thr2;
@@ -354,6 +401,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join)
Warnings:
Note 1003 SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a
+connection con1;
a
1
2
@@ -375,12 +423,14 @@ Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` join `test`.`t2` group
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join)
Warnings:
Note 1003 EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a
+connection con1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join)
@@ -405,9 +455,11 @@ id select_type table type possible_keys key key_len ref rows Extra
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_end';
SELECT * FROM v1, t2;
+connection default;
show explain for $thr2;
ERROR HY000: Target is not running an EXPLAINable command
kill query $thr2;
+connection con1;
ERROR 70100: Query execution was interrupted
set debug_dbug=@old_debug;
DROP VIEW v1;
@@ -418,11 +470,13 @@ DROP TABLE t2, t3;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
select sleep(1);
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select sleep(1)
+connection con1;
sleep(1)
0
set debug_dbug=@old_debug;
@@ -432,11 +486,13 @@ set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
select * from t0 where 1>10;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings:
Note 1003 select * from t0 where 1>10
+connection con1;
a
set debug_dbug=@old_debug;
#
@@ -447,11 +503,13 @@ insert into t3 select a from t0;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
select * from t0,t3 where t3.a=112233;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL no matching row in const table
Warnings:
Note 1003 select * from t0,t3 where t3.a=112233
+connection con1;
a a
set debug_dbug=@old_debug;
drop table t3;
@@ -477,6 +535,7 @@ SELECT * FROM t2 WHERE a =
(SELECT MAX(a) FROM t2
WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3)
);
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 20 Using where
@@ -487,6 +546,7 @@ Note 1003 SELECT * FROM t2 WHERE a =
(SELECT MAX(a) FROM t2
WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3)
)
+connection con1;
pk a
3 7
6 7
@@ -530,6 +590,7 @@ WHERE a1 < ALL (
SELECT a1 FROM t2
WHERE a1 IN ( SELECT a1 FROM t2, t4 )
);
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL a1 5 NULL 20 Using where; Using index
@@ -541,6 +602,7 @@ WHERE a1 < ALL (
SELECT a1 FROM t2
WHERE a1 IN ( SELECT a1 FROM t2, t4 )
)
+connection con1;
count(*)
1740
set debug_dbug=@old_debug;
@@ -555,6 +617,7 @@ INSERT INTO t2 VALUES
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`);
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <subquery2> const distinct_key distinct_key 8 const,const 1
@@ -562,6 +625,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 MATERIALIZED t2 index NULL a1 4 NULL 20 Using index
Warnings:
Note 1003 SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`)
+connection con1;
pk a1
set debug_dbug=@old_debug;
DROP TABLE t2;
@@ -574,11 +638,13 @@ INSERT INTO t1 VALUES (3),(1),(5),(1);
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT 'test' FROM t1 WHERE a=1;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 5 const 1 Using index
Warnings:
Note 1003 SELECT 'test' FROM t1 WHERE a=1
+connection con1;
test
test
test
@@ -602,6 +668,7 @@ id select_type table type possible_keys key key_len ref rows Extra
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_test_if_quick_select';
select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE A ALL NULL NULL NULL NULL 100 Using where
@@ -626,6 +693,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE B ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1)
Warnings:
Note 1003 select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100
+connection con1;
count(*)
212
set debug_dbug=@old_debug;
@@ -639,11 +707,13 @@ INSERT INTO t1 (a) VALUES (3),(1),(5),(1);
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SHOW INDEX FROM t1;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE STATISTICS ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL Open_full_table; Scanned 0 databases
Warnings:
Note 1003 SHOW INDEX FROM t1
+connection con1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A NULL NULL NULL YES BTREE
t1 1 b 1 b A NULL NULL NULL YES BTREE
@@ -664,12 +734,14 @@ id select_type table type possible_keys key key_len ref rows Extra
set debug_dbug='+d,show_explain_probe_join_tab_preread';
set @show_explain_probe_select_id=1;
SELECT a + 1 FROM v1;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED t1 ALL NULL NULL NULL NULL 2
Warnings:
Note 1003 SELECT a + 1 FROM v1
+connection con1;
a + 1
2
3
@@ -691,6 +763,7 @@ id select_type table type possible_keys key key_len ref rows Extra
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
set debug_dbug='+d,show_explain_probe_union_read';
SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 );
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
@@ -707,6 +780,7 @@ id select_type table type possible_keys key key_len ref rows Extra
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
Warnings:
Note 1003 SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 )
+connection con1;
a
set debug_dbug=@old_debug;
DROP TABLE t1;
@@ -734,6 +808,7 @@ set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 20 Using where
@@ -743,6 +818,7 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1003 SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b )
+connection con1;
a b
set debug_dbug=@old_debug;
DROP TABLE t1, t2;
@@ -768,12 +844,14 @@ id select_type table type possible_keys key key_len ref rows Extra
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
select distinct t1.a from t1,t3 where t1.a=t3.a;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary
1 SIMPLE t3 ref a a 5 test.t1.a 7 Using index; Distinct
Warnings:
Note 1003 select distinct t1.a from t1,t3 where t1.a=t3.a
+connection con1;
a
1
2
@@ -785,19 +863,25 @@ drop table t1,t3,t4;
create user test2@localhost;
grant ALL on test.* to test2@localhost;
grant super on *.* to test2@localhost;
+connect con2, localhost, test2,,;
+connection con1;
#
# First, make sure that user 'test2' cannot do SHOW EXPLAIN on us
#
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
select * from t0 where a < 3;
+connection default;
+connection con2;
show explain for $thr2;
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where
Warnings:
Note 1003 select * from t0 where a < 3
+connection con1;
a
0
1
@@ -806,31 +890,44 @@ set debug_dbug=@old_debug;
#
# Check that user test2 can do SHOW EXPLAIN on its own queries
#
+connect con3, localhost, test2,,;
+connection con2;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
select * from t0 where a < 3;
+connection con1;
+connection con3;
show explain for $thr_con2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where
Warnings:
Note 1003 select * from t0 where a < 3
+connection con2;
a
0
1
2
+connection con1;
+disconnect con3;
#
# Now, grant test2 a PROCESSLIST permission, and see that he's able to observe us
#
+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';
select * from t0 where a < 3;
+connection default;
+connection con2;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where
Warnings:
Note 1003 select * from t0 where a < 3
+connection con1;
a
0
1
@@ -838,10 +935,14 @@ a
set debug_dbug=@old_debug;
revoke all privileges on test.* from test2@localhost;
drop user test2@localhost;
+disconnect con2;
#
# Test that it is possible to KILL a SHOW EXPLAIN command that's waiting
# on its target thread
#
+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;
# Lock two threads
@@ -859,12 +960,18 @@ pk data
18 data1
19 data1
20 data1
+connection con1;
set autocommit=0;
select * from t1 where pk between 10 and 20 for update;
+connection default;
# do: send_eval show explain for thr2;
+connection con3;
kill query $thr_default;
+connection default;
ERROR 70100: Query execution was interrupted
+connection con2;
rollback;
+connection con1;
pk data
10 data1
11 data1
@@ -878,6 +985,8 @@ pk data
19 data1
20 data1
drop table t1;
+disconnect con3;
+disconnect con2;
#
# Check that the I_S table is invisible
#
@@ -904,6 +1013,7 @@ set debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT a+SLEEP(0.01) FROM t1
WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
ORDER BY b;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using filesort
@@ -911,6 +1021,7 @@ Warnings:
Note 1003 SELECT a+SLEEP(0.01) FROM t1
WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
ORDER BY b
+connection con1;
a+SLEEP(0.01)
0
5372
@@ -925,6 +1036,7 @@ set debug_dbug='+d,show_explain_probe_do_select';
SELECT a+SLEEP(0.01) FROM t1
WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
ORDER BY b;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using filesort
@@ -932,6 +1044,7 @@ Warnings:
Note 1003 SELECT a+SLEEP(0.01) FROM t1
WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
ORDER BY b
+connection con1;
a+SLEEP(0.01)
0
5372
@@ -956,11 +1069,13 @@ id select_type table type possible_keys key key_len ref rows Extra
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT a FROM t1 GROUP BY a;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4112 Using temporary; Using filesort
Warnings:
Note 1003 SELECT a FROM t1 GROUP BY a
+connection con1;
a
1
2
@@ -994,12 +1109,14 @@ id select_type table type possible_keys key key_len ref rows Extra
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's';
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 index_subquery PRIMARY,c c 5 func 1 Using index; Using where
Warnings:
Note 1003 SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's'
+connection con1;
SUM(a + SLEEP(0.1))
7862
set debug_dbug=@old_debug;
@@ -1042,13 +1159,15 @@ id select_type table type possible_keys key key_len ref rows Extra
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 system NULL NULL NULL NULL 1 Using filesort
+1 SIMPLE t2 system NULL NULL NULL NULL 1
1 SIMPLE t1 range b b 6 NULL 107 Using where; Using index
1 SIMPLE t3 ref PRIMARY PRIMARY 5 test.t1.b 1 Using index
Warnings:
Note 1003 SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2
+connection con1;
field1 field2
set debug_dbug=@old_debug;
DROP TABLE t1,t2,t3;
@@ -1074,6 +1193,7 @@ set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias
WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias1 ALL NULL NULL NULL NULL 14
@@ -1082,6 +1202,7 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1003 SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias
WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10
+connection con1;
max(a+b+c)
279
set debug_dbug=@old_debug;
@@ -1112,6 +1233,7 @@ E3FB
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
select * from t0 where length('ãû') = a;
+connection default;
set names utf8;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@@ -1119,6 +1241,7 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1003 select * from t0 where length('гы') = a
set names default;
+connection con1;
a
2
set debug_dbug=@old_debug;
@@ -1152,6 +1275,7 @@ 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;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 4 NULL 2 Using index
@@ -1163,6 +1287,7 @@ Note 1003 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 con1;
SUM(b)
0
set debug_dbug=@old_debug;
@@ -1181,8 +1306,12 @@ set debug_dbug='+d,show_explain_probe_best_ext_lim_search';
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;
kill query $thr2;
+connection con1;
ERROR 70100: Query execution was interrupted
drop table t0,t1,t2;
# End
+connection default;
+disconnect con1;
set debug_sync='RESET';
diff --git a/mysql-test/r/show_explain_non_select.result b/mysql-test/r/show_explain_non_select.result
index 0bd1e959405..6076a848e22 100644
--- a/mysql-test/r/show_explain_non_select.result
+++ b/mysql-test/r/show_explain_non_select.result
@@ -1,6 +1,9 @@
drop table if exists t0, t1;
SET @old_debug= @@session.debug;
set debug_sync='RESET';
+connect con2, localhost, root,,;
+connection con2;
+connection default;
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));
@@ -10,35 +13,43 @@ from t0 A, t0 B, t0 C;
#
# Test SHOW EXPLAIN for single-table DELETE
#
+connection con2;
set debug_dbug='+d,show_explain_probe_delete_exec_start';
delete from t1 where a<10 and b+1>1000;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 1 Using where
Warnings:
Note 1003 delete from t1 where a<10 and b+1>1000
+connection con2;
#
# Test SHOW EXPLAIN for multi-table DELETE
#
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
delete t1 from t1, t0 where t0.a=t1.a and t1.b +1 > 1000;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 8 Using where
1 SIMPLE t1 ref a a 5 test.t0.a 4 Using where
Warnings:
Note 1003 delete t1 from t1, t0 where t0.a=t1.a and t1.b +1 > 1000
+connection con2;
#
# Test SHOW EXPLAIN for single-table UPDATE
#
+connection con2;
set debug_dbug='+d,show_explain_probe_update_exec_start';
update t1 set filler='filler-data-2' where a<10 and b+1>1000;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 1 Using where
Warnings:
Note 1003 update t1 set filler='filler-data-2' where a<10 and b+1>1000
+connection con2;
drop table t0,t1;
set debug_dbug=@old_debug;
set debug_sync='RESET';
diff --git a/mysql-test/r/show_explain_ps.result b/mysql-test/r/show_explain_ps.result
index f9b82c85f01..71c8f117fa2 100644
--- a/mysql-test/r/show_explain_ps.result
+++ b/mysql-test/r/show_explain_ps.result
@@ -1,3 +1,5 @@
+truncate table performance_schema.events_statements_history_long;
+truncate table performance_schema.events_stages_history_long;
drop table if exists t0, t1;
select * from performance_schema.setup_instruments where name like '%show_explain%';
NAME ENABLED TIMED
@@ -10,20 +12,31 @@ NAME OBJECT_INSTANCE_BEGIN
# Check out if our cond is hit.
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+connect con1, localhost, root,,;
+connection con1;
+connection default;
+connection con1;
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
select count(*) from t0 where a < 100000;
+connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where
Warnings:
Note 1003 select count(*) from t0 where a < 100000
+connection con1;
count(*)
10
set debug_dbug='';
select event_name
-from performance_schema.events_waits_history_long
-where event_name='wait/synch/cond/sql/show_explain';
+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');
event_name
-wait/synch/cond/sql/show_explain
+stage/sql/show explain
drop table t0;
diff --git a/mysql-test/r/shutdown.result b/mysql-test/r/shutdown.result
index 7039afb129e..7a69f58ffd9 100644
--- a/mysql-test/r/shutdown.result
+++ b/mysql-test/r/shutdown.result
@@ -1,7 +1,16 @@
create user user1@localhost;
+connect c1,localhost,user1,,;
shutdown;
ERROR 42000: Access denied; you need (at least one of) the SHUTDOWN privilege(s) for this operation
+connection default;
+disconnect c1;
+connect c1,localhost,root,,;
create procedure try_shutdown() shutdown;
drop procedure try_shutdown;
shutdown;
+connection default;
drop user user1@localhost;
+#
+# MDEV-8491 - On shutdown, report the user and the host executed that.
+#
+FOUND 2 /mysqld(\.exe)? \(initiated by: root\[root\] @ localhost \[(::1)?\]\): Normal shutdown/ in mysqld.1.err
diff --git a/mysql-test/r/signal.result b/mysql-test/r/signal.result
index a5eb24442b4..f05e357104d 100644
--- a/mysql-test/r/signal.result
+++ b/mysql-test/r/signal.result
@@ -1118,6 +1118,7 @@ end $$
call test_signal() $$
ERROR 42000: Variable 'MYSQL_ERRNO' can't be set to the value of '999999999999999999999999999999999999999999999999999'
drop procedure test_signal $$
+SET sql_mode= '' $$
create procedure test_signal()
begin
DECLARE aaax VARCHAR(65);
@@ -1177,6 +1178,7 @@ Warning 1647 Data truncated for condition item 'CURSOR_NAME'
Warning 1647 Data truncated for condition item 'MESSAGE_TEXT'
Warning 10000 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112222222222222222222288888888
drop procedure test_signal $$
+set sql_mode = DEFAULT $$
create procedure test_signal()
begin
DECLARE warn CONDITION FOR SQLSTATE "01234";
@@ -1501,7 +1503,7 @@ select "before RESIGNAL";
RESIGNAL;
select "after RESIGNAL";
end;
-insert into t_warn set a= 9999999999999999;
+insert ignore into t_warn set a= 9999999999999999;
end $$
call test_resignal() $$
before RESIGNAL
@@ -1618,7 +1620,7 @@ MESSAGE_TEXT = "RESIGNAL of a warning",
MYSQL_ERRNO = 5555 ;
select "after RESIGNAL";
end;
-insert into t_warn set a= 9999999999999999;
+insert ignore into t_warn set a= 9999999999999999;
end $$
call test_resignal() $$
before RESIGNAL
@@ -1892,7 +1894,7 @@ MESSAGE_TEXT = "RESIGNAL to a warning",
MYSQL_ERRNO = 5555 ;
select "after RESIGNAL";
end;
-insert into t_warn set a= 9999999999999999;
+insert ignore into t_warn set a= 9999999999999999;
end $$
call test_resignal() $$
before RESIGNAL
@@ -1913,7 +1915,7 @@ MESSAGE_TEXT = "RESIGNAL to a not found",
MYSQL_ERRNO = 5555 ;
select "after RESIGNAL";
end;
-insert into t_warn set a= 9999999999999999;
+insert ignore into t_warn set a= 9999999999999999;
end $$
call test_resignal() $$
before RESIGNAL
@@ -1934,7 +1936,7 @@ MESSAGE_TEXT = "RESIGNAL to an error",
MYSQL_ERRNO = 5555 ;
select "after RESIGNAL";
end;
-insert into t_warn set a= 9999999999999999;
+insert ignore into t_warn set a= 9999999999999999;
end $$
call test_resignal() $$
before RESIGNAL
diff --git a/mysql-test/r/skip_grants.result b/mysql-test/r/skip_grants.result
index b167a197e50..1c055ef7385 100644
--- a/mysql-test/r/skip_grants.result
+++ b/mysql-test/r/skip_grants.result
@@ -39,11 +39,11 @@ View Create View character_set_client collation_connection
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`a`@`%` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`c` AS `c` from `t1` latin1 latin1_swedish_ci
SHOW CREATE PROCEDURE p3;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-p3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`a`@`%` PROCEDURE `p3`()
+p3 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`a`@`%` PROCEDURE `p3`()
SELECT 3 latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE FUNCTION f3;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-f3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`a`@`%` FUNCTION `f3`() RETURNS int(11)
+f3 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`a`@`%` FUNCTION `f3`() RETURNS int(11)
RETURN 3 latin1 latin1_swedish_ci latin1_swedish_ci
DROP TRIGGER t1_bi;
DROP TRIGGER ti_ai;
diff --git a/mysql-test/r/skip_name_resolve.result b/mysql-test/r/skip_name_resolve.result
index b2230ccbd91..1362e482717 100644
--- a/mysql-test/r/skip_name_resolve.result
+++ b/mysql-test/r/skip_name_resolve.result
@@ -6,10 +6,13 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
GRANT ALL PRIVILEGES ON `test`.* TO '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';
+connect con1, localhost, root, , test, $MASTER_MYPORT, ;
SELECT USER();
USER()
#
SHOW PROCESSLIST;
+connection default;
+disconnect con1;
#
# Bug #37168: Missing variable - skip_name_resolve
#
diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result
index c9d2f7b023a..f6a7fff5d4e 100644
--- a/mysql-test/r/sp-code.result
+++ b/mysql-test/r/sp-code.result
@@ -51,10 +51,10 @@ Pos Instruction
9 set err@1 1
10 hreturn 5
11 cfetch c@0 n@4
-12 jump_if_not 15(17) isnull(n@4)
-13 set nulls@2 (nulls@2 + 1)
+12 jump_if_not 15(17) n@4 is null
+13 set nulls@2 nulls@2 + 1
14 jump 17
-15 set count@3 (count@3 + 1)
+15 set count@3 count@3 + 1
16 stmt 4 "update t2 set idx = count where name=n"
17 hpop 1
18 jump 7
@@ -167,35 +167,35 @@ Pos Instruction
12 set v_schedmax@5 NULL
13 stmt 0 "select count(*) into v_schedmax from ..."
14 set v_tcounter@6 0
-15 jump_if_not 39(39) (v_i@3 <= v_schedmax@5)
+15 jump_if_not 39(39) v_i@3 <= v_schedmax@5
16 set v_row@7 NULL
17 set v_col@8 NULL
18 stmt 0 "select row,col into v_row,v_col from ..."
19 stmt 0 "select dig into v_dig from sudoku_wor..."
20 set_case_expr (34) 0 v_dig@4
-21 jump_if_not 25(34) (case_expr@0 = 0)
+21 jump_if_not 25(34) case_expr@0 = 0
22 set v_dig@4 1
23 stmt 4 "update sudoku_work set dig = 1 where ..."
24 jump 34
-25 jump_if_not 32(34) (case_expr@0 = 9)
-26 jump_if_not 30(34) (v_i@3 > 0)
+25 jump_if_not 32(34) case_expr@0 = 9
+26 jump_if_not 30(34) v_i@3 > 0
27 stmt 4 "update sudoku_work set dig = 0 where ..."
-28 set v_i@3 (v_i@3 - 1)
+28 set v_i@3 v_i@3 - 1
29 jump 15
30 stmt 0 "select v_scounter as 'Solutions'"
31 jump 45
-32 set v_dig@4 (v_dig@4 + 1)
+32 set v_dig@4 v_dig@4 + 1
33 stmt 4 "update sudoku_work set dig = v_dig wh..."
-34 set v_tcounter@6 (v_tcounter@6 + 1)
-35 jump_if_not 37(37) (not(`sudoku_digit_ok`(v_row@7,v_col@8,v_dig@4)))
+34 set v_tcounter@6 v_tcounter@6 + 1
+35 jump_if_not 37(37) !`sudoku_digit_ok`(v_row@7,v_col@8,v_dig@4)
36 jump 15
-37 set v_i@3 (v_i@3 + 1)
+37 set v_i@3 v_i@3 + 1
38 jump 15
39 stmt 0 "select dig from sudoku_work"
40 stmt 0 "select v_tcounter as 'Tests'"
-41 set v_scounter@2 (v_scounter@2 + 1)
-42 jump_if_not 45(14) (p_all@1 and (v_i@3 > 0))
-43 set v_i@3 (v_i@3 - 1)
+41 set v_scounter@2 v_scounter@2 + 1
+42 jump_if_not 45(14) 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..."
drop procedure sudoku_solve;
@@ -323,13 +323,13 @@ SHOW PROCEDURE CODE proc_19194_simple;
Pos Instruction
0 set str@1 NULL
1 set_case_expr (12) 0 i@0
-2 jump_if_not 5(12) (case_expr@0 = 1)
+2 jump_if_not 5(12) case_expr@0 = 1
3 set str@1 '1'
4 jump 12
-5 jump_if_not 8(12) (case_expr@0 = 2)
+5 jump_if_not 8(12) case_expr@0 = 2
6 set str@1 '2'
7 jump 12
-8 jump_if_not 11(12) (case_expr@0 = 3)
+8 jump_if_not 11(12) case_expr@0 = 3
9 set str@1 '3'
10 jump 12
11 set str@1 'unknown'
@@ -337,13 +337,13 @@ Pos Instruction
SHOW PROCEDURE CODE proc_19194_searched;
Pos Instruction
0 set str@1 NULL
-1 jump_if_not 4(11) (i@0 = 1)
+1 jump_if_not 4(11) i@0 = 1
2 set str@1 '1'
3 jump 11
-4 jump_if_not 7(11) (i@0 = 2)
+4 jump_if_not 7(11) i@0 = 2
5 set str@1 '2'
6 jump 11
-7 jump_if_not 10(11) (i@0 = 3)
+7 jump_if_not 10(11) i@0 = 3
8 set str@1 '3'
9 jump 11
10 set str@1 'unknown'
@@ -353,27 +353,27 @@ Pos Instruction
0 set str_i@2 NULL
1 set str_j@3 NULL
2 set_case_expr (27) 0 i@0
-3 jump_if_not 6(27) (case_expr@0 = 10)
+3 jump_if_not 6(27) case_expr@0 = 10
4 set str_i@2 '10'
5 jump 27
-6 jump_if_not 20(27) (case_expr@0 = 20)
+6 jump_if_not 20(27) case_expr@0 = 20
7 set str_i@2 '20'
-8 jump_if_not 11(18) (j@1 = 1)
+8 jump_if_not 11(18) j@1 = 1
9 set str_j@3 '1'
10 jump 18
-11 jump_if_not 14(18) (j@1 = 2)
+11 jump_if_not 14(18) j@1 = 2
12 set str_j@3 '2'
13 jump 18
-14 jump_if_not 17(18) (j@1 = 3)
+14 jump_if_not 17(18) j@1 = 3
15 set str_j@3 '3'
16 jump 18
17 set str_j@3 'unknown'
18 stmt 0 "select "i was 20""
19 jump 27
-20 jump_if_not 23(27) (case_expr@0 = 30)
+20 jump_if_not 23(27) case_expr@0 = 30
21 set str_i@2 '30'
22 jump 27
-23 jump_if_not 26(27) (case_expr@0 = 40)
+23 jump_if_not 26(27) case_expr@0 = 40
24 set str_i@2 '40'
25 jump 27
26 set str_i@2 'unknown'
@@ -382,28 +382,28 @@ SHOW PROCEDURE CODE proc_19194_nested_2;
Pos Instruction
0 set str_i@2 NULL
1 set str_j@3 NULL
-2 jump_if_not 5(27) (i@0 = 10)
+2 jump_if_not 5(27) i@0 = 10
3 set str_i@2 '10'
4 jump 27
-5 jump_if_not 20(27) (i@0 = 20)
+5 jump_if_not 20(27) i@0 = 20
6 set str_i@2 '20'
7 set_case_expr (18) 0 j@1
-8 jump_if_not 11(18) (case_expr@0 = 1)
+8 jump_if_not 11(18) case_expr@0 = 1
9 set str_j@3 '1'
10 jump 18
-11 jump_if_not 14(18) (case_expr@0 = 2)
+11 jump_if_not 14(18) case_expr@0 = 2
12 set str_j@3 '2'
13 jump 18
-14 jump_if_not 17(18) (case_expr@0 = 3)
+14 jump_if_not 17(18) case_expr@0 = 3
15 set str_j@3 '3'
16 jump 18
17 set str_j@3 'unknown'
18 stmt 0 "select "i was 20""
19 jump 27
-20 jump_if_not 23(27) (i@0 = 30)
+20 jump_if_not 23(27) i@0 = 30
21 set str_i@2 '30'
22 jump 27
-23 jump_if_not 26(27) (i@0 = 40)
+23 jump_if_not 26(27) i@0 = 40
24 set str_i@2 '40'
25 jump 27
26 set str_i@2 'unknown'
@@ -413,28 +413,28 @@ Pos Instruction
0 set str_i@2 NULL
1 set str_j@3 NULL
2 set_case_expr (28) 0 i@0
-3 jump_if_not 6(28) (case_expr@0 = 10)
+3 jump_if_not 6(28) case_expr@0 = 10
4 set str_i@2 '10'
5 jump 28
-6 jump_if_not 21(28) (case_expr@0 = 20)
+6 jump_if_not 21(28) case_expr@0 = 20
7 set str_i@2 '20'
8 set_case_expr (19) 1 j@1
-9 jump_if_not 12(19) (case_expr@1 = 1)
+9 jump_if_not 12(19) case_expr@1 = 1
10 set str_j@3 '1'
11 jump 19
-12 jump_if_not 15(19) (case_expr@1 = 2)
+12 jump_if_not 15(19) case_expr@1 = 2
13 set str_j@3 '2'
14 jump 19
-15 jump_if_not 18(19) (case_expr@1 = 3)
+15 jump_if_not 18(19) case_expr@1 = 3
16 set str_j@3 '3'
17 jump 19
18 set str_j@3 'unknown'
19 stmt 0 "select "i was 20""
20 jump 28
-21 jump_if_not 24(28) (case_expr@0 = 30)
+21 jump_if_not 24(28) case_expr@0 = 30
22 set str_i@2 '30'
23 jump 28
-24 jump_if_not 27(28) (case_expr@0 = 40)
+24 jump_if_not 27(28) case_expr@0 = 40
25 set str_i@2 '40'
26 jump 28
27 set str_i@2 'unknown'
@@ -443,27 +443,27 @@ SHOW PROCEDURE CODE proc_19194_nested_4;
Pos Instruction
0 set str_i@2 NULL
1 set str_j@3 NULL
-2 jump_if_not 5(26) (i@0 = 10)
+2 jump_if_not 5(26) i@0 = 10
3 set str_i@2 '10'
4 jump 26
-5 jump_if_not 19(26) (i@0 = 20)
+5 jump_if_not 19(26) i@0 = 20
6 set str_i@2 '20'
-7 jump_if_not 10(17) (j@1 = 1)
+7 jump_if_not 10(17) j@1 = 1
8 set str_j@3 '1'
9 jump 17
-10 jump_if_not 13(17) (j@1 = 2)
+10 jump_if_not 13(17) j@1 = 2
11 set str_j@3 '2'
12 jump 17
-13 jump_if_not 16(17) (j@1 = 3)
+13 jump_if_not 16(17) j@1 = 3
14 set str_j@3 '3'
15 jump 17
16 set str_j@3 'unknown'
17 stmt 0 "select "i was 20""
18 jump 26
-19 jump_if_not 22(26) (i@0 = 30)
+19 jump_if_not 22(26) i@0 = 30
20 set str_i@2 '30'
21 jump 26
-22 jump_if_not 25(26) (i@0 = 40)
+22 jump_if_not 25(26) i@0 = 40
23 set str_i@2 '40'
24 jump 26
25 set str_i@2 'unknown'
@@ -668,8 +668,8 @@ Pos Instruction
0 set i@1 5
1 hpush_jump 8 2 CONTINUE
2 stmt 0 "select 'caught something'"
-3 jump_if_not 7(7) (i@1 > 0)
-4 set i@1 (i@1 - 1)
+3 jump_if_not 7(7) i@1 > 0
+4 set i@1 i@1 - 1
5 stmt 0 "select 'looping', i"
6 jump 3
7 hreturn 2
@@ -683,8 +683,8 @@ Pos Instruction
0 set i@1 5
1 hpush_jump 9 2 CONTINUE
2 stmt 0 "select 'caught something'"
-3 jump_if_not 7(7) (i@1 > 0)
-4 set i@1 (i@1 - 1)
+3 jump_if_not 7(7) i@1 > 0
+4 set i@1 i@1 - 1
5 stmt 0 "select 'looping', i"
6 jump 3
7 stmt 0 "select 'optimizer: keep hreturn'"
@@ -796,8 +796,8 @@ Pos Instruction
0 set count1@1 '0'
1 set vb@2 NULL
2 set last_row@3 NULL
-3 jump_if_not 24(24) (num@0 >= 1)
-4 set num@0 (num@0 - 1)
+3 jump_if_not 24(24) num@0 >= 1
+4 set num@0 num@0 - 1
5 cpush cur1@0
6 hpush_jump 9 4 CONTINUE
7 set last_row@3 1
@@ -807,11 +807,11 @@ Pos Instruction
11 hpush_jump 13 4 EXIT
12 hreturn 0 17
13 cfetch cur1@0 vb@2
-14 jump_if_not 17(17) (last_row@3 = 1)
+14 jump_if_not 17(17) last_row@3 = 1
15 hpop 1
16 jump 19
17 hpop 1
-18 jump_if_not 11(19) (last_row@3 = 1)
+18 jump_if_not 11(19) last_row@3 = 1
19 cclose cur1@0
20 hpop 1
21 cpop 1
@@ -821,8 +821,8 @@ Pos Instruction
0 set count1@1 '0'
1 set vb@2 NULL
2 set last_row@3 NULL
-3 jump_if_not 23(23) (num@0 >= 1)
-4 set num@0 (num@0 - 1)
+3 jump_if_not 23(23) num@0 >= 1
+4 set num@0 num@0 - 1
5 cpush cur1@0
6 hpush_jump 9 4 CONTINUE
7 set last_row@3 1
@@ -831,11 +831,11 @@ Pos Instruction
10 copen cur1@0
11 cpush cur2@1
12 cfetch cur1@0 vb@2
-13 jump_if_not 16(16) (last_row@3 = 1)
+13 jump_if_not 16(16) last_row@3 = 1
14 cpop 1
15 jump 18
16 cpop 1
-17 jump_if_not 11(18) (last_row@3 = 1)
+17 jump_if_not 11(18) last_row@3 = 1
18 cclose cur1@0
19 hpop 1
20 cpop 1
@@ -883,7 +883,7 @@ SHOW PROCEDURE CODE p1;
Pos Instruction
0 set dummy@0 0
1 set_case_expr (6) 0 12
-2 jump_if_not 5(6) (case_expr@0 = 12)
+2 jump_if_not 5(6) case_expr@0 = 12
3 set dummy@0 0
4 jump 6
5 error 1339
diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result
index a3754d25a8a..3cd0e4773b9 100644
--- a/mysql-test/r/sp-destruct.result
+++ b/mysql-test/r/sp-destruct.result
@@ -12,7 +12,7 @@ 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();
-alter table mysql.proc drop type;
+alter table mysql.proc drop security_type;
call bug14233();
ERROR HY000: Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted
create view v1 as select bug14233_f();
@@ -142,7 +142,7 @@ drop database if exists mysqltest;
flush table mysql.proc;
create database mysqltest;
# Corrupt mysql.proc to make it unusable by current version of server.
-alter table mysql.proc drop column type;
+alter table mysql.proc drop column security_type;
# The below statement should not cause assertion failure.
drop database mysqltest;
Warnings:
diff --git a/mysql-test/r/sp-dynamic.result b/mysql-test/r/sp-dynamic.result
index 7309ba4c765..9fa3bea1108 100644
--- a/mysql-test/r/sp-dynamic.result
+++ b/mysql-test/r/sp-dynamic.result
@@ -220,6 +220,7 @@ id name
call p1()|
ERROR HY000: Unknown prepared statement handler (stmt) given to EXECUTE
drop procedure p1|
+set sql_mode= ''|
create procedure p1()
begin
declare a char(10);
@@ -232,6 +233,7 @@ call p1()|
ERROR 42S22: Unknown column 'a' in 'field list'
call p1()|
ERROR 42S22: Unknown column 'a' in 'field list'
+set sql_mode= DEFAULT|
drop procedure p1|
create procedure p1()
begin
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index 1f38e3888a0..6fbe2d62fd7 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -310,15 +310,15 @@ insert into t1 (val) values (i);
return 0;
end|
select val, f1(val) from t1|
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
select val, f1(val) from t1 as tab|
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
select * from t1|
val x
42 3.1
19 1.2
update t1 set val= f1(val)|
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
select * from t1|
val x
42 3.1
@@ -746,7 +746,7 @@ return (i in (100, 200, bug11394(i-1), 400));
end if;
end|
select bug11394(2)|
-ERROR HY000: Recursive stored functions and triggers are not allowed.
+ERROR HY000: Recursive stored functions and triggers are not allowed
drop function bug11394|
create function bug11394_1(i int) returns int
begin
@@ -757,7 +757,7 @@ return (select bug11394_1(i-1));
end if;
end|
select bug11394_1(2)|
-ERROR HY000: Recursive stored functions and triggers are not allowed.
+ERROR HY000: Recursive stored functions and triggers are not allowed
drop function bug11394_1|
create function bug11394_2(i int) returns int return i|
select bug11394_2(bug11394_2(10))|
@@ -779,7 +779,7 @@ drop procedure bug11394|
CREATE PROCEDURE BUG_12490() HELP CONTENTS;
ERROR 0A000: HELP is not allowed in stored procedures
CREATE FUNCTION BUG_12490() RETURNS INT HELP CONTENTS;
-ERROR 0A000: HELP is not allowed in stored procedures
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'HELP CONTENTS' at line 1
CREATE TABLE t_bug_12490(a int);
CREATE TRIGGER BUG_12490 BEFORE UPDATE ON t_bug_12490 FOR EACH ROW HELP CONTENTS;
ERROR 0A000: HELP is not allowed in stored procedures
@@ -918,37 +918,37 @@ drop procedure bug13510_4|
drop function if exists bug_13627_f|
CREATE TABLE t1 (a int)|
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN DROP TRIGGER test1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug_13627_f() returns int BEGIN DROP TRIGGER test1; return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create table t2 (a int); END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug_13627_f() returns int BEGIN create table t2 (a int); return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create index t1_i on t1 (a); END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug_13627_f() returns int BEGIN create index t1_i on t1 (a); return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter table t1 add column b int; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug_13627_f() returns int BEGIN alter table t1 add column b int; return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN rename table t1 to t2; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug_13627_f() returns int BEGIN rename table t1 to t2; return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN truncate table t1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug_13627_f() returns int BEGIN truncate table t1; return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop table t1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug_13627_f() returns int BEGIN drop table t1; return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop index t1_i on t1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug_13627_f() returns int BEGIN drop index t1_i on t1; return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN unlock tables; END |
ERROR 0A000: UNLOCK is not allowed in stored procedures
CREATE FUNCTION bug_13627_f() returns int BEGIN unlock tables; return 1; END |
@@ -958,49 +958,49 @@ ERROR 0A000: LOCK is not allowed in stored procedures
CREATE FUNCTION bug_13627_f() returns int BEGIN LOCK TABLE t1 READ; return 1; END |
ERROR 0A000: LOCK is not allowed in stored procedures
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create database mysqltest; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug_13627_f() returns int BEGIN create database mysqltest; return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop database mysqltest; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug_13627_f() returns int BEGIN drop database mysqltest; return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create user 'mysqltest_1'; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug_13627_f() returns int BEGIN create user 'mysqltest_1'; return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE TRIGGER bug21975 BEFORE INSERT ON t1 FOR EACH ROW BEGIN grant select on t1 to 'mysqltest_1'; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug21975() returns int BEGIN grant select on t1 to 'mysqltest_1'; return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE TRIGGER bug21975 BEFORE INSERT ON t1 FOR EACH ROW BEGIN revoke select on t1 from 'mysqltest_1'; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug21975() returns int BEGIN revoke select on t1 from 'mysqltest_1'; return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE TRIGGER bug21975 BEFORE INSERT ON t1 FOR EACH ROW BEGIN revoke all privileges on *.* from 'mysqltest_1'; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug21975() returns int BEGIN revoke all privileges on *.* from 'mysqltest_1'; return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop user 'mysqltest_1'; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug_13627_f() returns int BEGIN drop user 'mysqltest_1'; return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN rename user 'mysqltest_2' to 'mysqltest_1'; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug_13627_f() returns int BEGIN rename user 'mysqltest_2' to 'mysqltest_1'; return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create view v1 as select 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug_13627_f() returns int BEGIN create view v1 as select 1; return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter view v1 as select 1; END |
ERROR 0A000: ALTER VIEW is not allowed in stored procedures
CREATE FUNCTION bug_13627_f() returns int BEGIN alter view v1 as select 1; return 1; END |
ERROR 0A000: ALTER VIEW is not allowed in stored procedures
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop view v1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
CREATE FUNCTION bug_13627_f() returns int BEGIN drop view v1; return 1; END |
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
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 2F003: Can't create a TRIGGER from within another stored routine
CREATE FUNCTION bug_13627_f() returns int BEGIN create trigger tr2 before insert on t1 for each row do select 1; return 1; END |
@@ -1227,16 +1227,16 @@ DROP PROCEDURE IF EXISTS bug14702;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT);
CREATE PROCEDURE bug20953() CREATE VIEW v AS SELECT 1 INTO @a;
-ERROR HY000: View's SELECT contains a 'INTO' clause
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @a' at line 1
CREATE PROCEDURE bug20953() CREATE VIEW v AS SELECT 1 INTO DUMPFILE "file";
-ERROR HY000: View's SELECT contains a 'INTO' clause
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO DUMPFILE "file"' at line 1
CREATE PROCEDURE bug20953() CREATE VIEW v AS SELECT 1 INTO OUTFILE "file";
-ERROR HY000: View's SELECT contains a 'INTO' clause
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO OUTFILE "file"' at line 1
CREATE PROCEDURE bug20953()
CREATE VIEW v AS SELECT i FROM t1 PROCEDURE ANALYSE();
-ERROR HY000: View's SELECT contains a 'PROCEDURE' clause
-CREATE PROCEDURE bug20953() CREATE VIEW v AS SELECT 1 FROM (SELECT 1) AS d1;
-ERROR HY000: View's SELECT contains a subquery in the FROM clause
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE()' at line 2
+CREATE PROCEDURE bug20953() CREATE VIEW v AS SELECT 1 FROM (SELECT 1) AS d1 into @w;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'into @w' at line 1
CREATE PROCEDURE bug20953(i INT) CREATE VIEW v AS SELECT i;
ERROR HY000: View's SELECT contains a variable or parameter
CREATE PROCEDURE bug20953()
@@ -1288,11 +1288,11 @@ END |
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
CALL bug18914_p1();
INSERT INTO t1 VALUES (1);
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
SELECT bug18914_f1();
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
SELECT bug18914_f2();
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
SELECT * FROM t2;
ERROR 42S02: Table 'test.t2' doesn't exist
DROP FUNCTION bug18914_f1;
@@ -1524,14 +1524,14 @@ drop temporary table t1;
return 1;
end|
create temporary table t1 as select f1();
-ERROR HY000: Can't reopen table: 't1'
+ERROR 42S02: Unknown table 'test.t1'
create function f2() returns int
begin
create temporary table t2 as select f1();
return 1;
end|
create temporary table t1 as select f2();
-ERROR HY000: Can't reopen table: 't1'
+ERROR 42S02: Unknown table 'test.t1'
drop function f1;
drop function f2;
create function f1() returns int
@@ -1545,7 +1545,7 @@ create temporary table t2 as select f1();
return 1;
end|
create temporary table t1 as select f2();
-ERROR HY000: Can't reopen table: 't2'
+ERROR 42S02: Unknown table 'test.t2,test.t1'
drop function f1;
drop function f2;
create temporary table t2(a int);
@@ -1693,7 +1693,7 @@ INSERT INTO t1 SELECT * FROM t1 ;
RETURN 1 ;
END|
INSERT INTO t1 SELECT * FROM (SELECT 2 AS f1, 2 AS f2) AS A WHERE func_1() = 5;
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
DROP FUNCTION func_1;
DROP TABLE t1;
#
@@ -1879,6 +1879,7 @@ DROP PROCEDURE p1;
#
# Bug#5889: Exit handler for a warning doesn't hide the warning in trigger
#
+SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
CREATE TABLE t1(a INT, b INT);
INSERT INTO t1 VALUES (1, 2);
CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
@@ -1895,6 +1896,7 @@ a b
10 20
DROP TRIGGER t1_bu;
DROP TABLE t1;
+SET sql_mode = DEFAULT;
#
# Bug#9857: Stored procedures: handler for sqlwarning ignored
#
@@ -1940,11 +1942,11 @@ 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 INTO t2(a, b, c) VALUES(99999, 99999, 99999);
+INSERT IGNORE INTO t2(a, b, c) VALUES(99999, 99999, 99999);
CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
-INSERT INTO t2(d, e, f) VALUES(99999, 99999, 99999);
+INSERT IGNORE INTO t2(d, e, f) VALUES(99999, 99999, 99999);
CREATE PROCEDURE p1()
-INSERT INTO t1 VALUES(99999, 99999, 99999);
+INSERT IGNORE INTO t1 VALUES(99999, 99999, 99999);
CALL p1();
Warnings:
@@ -1962,6 +1964,7 @@ DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
# ----------------------------------------------------------------------
+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);
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
@@ -1991,6 +1994,7 @@ Error 1048 Column 'c' cannot be null
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
+SET sql_mode = DEFAULT;
###################################################################
# Tests for the following bugs:
@@ -2614,7 +2618,7 @@ 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 INTO t1 VALUES('qqqq', 'ww', 'eee');
+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|
@@ -2638,7 +2642,7 @@ SELECT 'Warning 1292 caught' AS msg;
# 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 INTO t2
+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),
@@ -2708,7 +2712,7 @@ SIGNAL SQLSTATE '01000' SET MYSQL_ERRNO = 1234;
SHOW WARNINGS;
SELECT 'Handler for 1292 (2)' AS Msg;
END;
-INSERT INTO t2
+INSERT IGNORE INTO t2
SELECT
CAST(999999 AS SIGNED INTEGER),
CAST(CONCAT(CAST('2 ' AS UNSIGNED INTEGER), '999999 ') AS SIGNED INTEGER),
@@ -2735,7 +2739,7 @@ BEGIN
SHOW WARNINGS;
SELECT 'Handler for 1292' Msg;
END;
-INSERT INTO t2
+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),
@@ -2771,6 +2775,7 @@ DROP TABLE t2;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
+SET sql_mode = '';
CREATE PROCEDURE p1()
BEGIN
DECLARE var1 INTEGER DEFAULT 'string';
@@ -2781,6 +2786,7 @@ CALL p1()|
Warnings:
Warning 1366 Incorrect integer value: 'string' for column 'var1' at row 1
+SET sql_mode = DEFAULT;
CREATE PROCEDURE p2()
BEGIN
DECLARE EXIT HANDLER FOR SQLWARNING SELECT 'H2';
diff --git a/mysql-test/r/sp-innodb.result b/mysql-test/r/sp-innodb.result
index 8dee74040b3..6a4fe5146a4 100644
--- a/mysql-test/r/sp-innodb.result
+++ b/mysql-test/r/sp-innodb.result
@@ -71,6 +71,7 @@ END//
# Open another connection, create and initialize a table
# 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;
@@ -79,6 +80,7 @@ UPDATE t1 SET i=1 WHERE i=1;
# On the default connection, do an update to provoke a
# deadlock, then call the function with handler. This case
# fails without the patch (with error ER_NO_SUCH_TABLE):
+connection default;
SET AUTOCOMMIT= 0;
UPDATE t1 SET i=1 WHERE i=1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@@ -118,6 +120,7 @@ f1():
No such table
# Disconnect, drop functions and table:
+disconnect con1;
DROP FUNCTION f4;
DROP FUNCTION f3;
DROP FUNCTION f2;
diff --git a/mysql-test/r/sp-lock.result b/mysql-test/r/sp-lock.result
index 49ff0c7ba58..acf951f6676 100644
--- a/mysql-test/r/sp-lock.result
+++ b/mysql-test/r/sp-lock.result
@@ -129,11 +129,13 @@ drop temporary table t1;
# connection, try to use the routine.
# That should block on the pending exclusive lock.
#
-# Establish helper connections.
+connect con1, localhost, root,,;
+connect con2, localhost, root,,;
+connect con3, localhost, root,,;
#
# Test DROP PROCEDURE.
#
-# --> connection default
+connection default;
create procedure p1() begin end;
create function f1() returns int
begin
@@ -144,24 +146,24 @@ begin;
select f1();
f1()
1
-# --> connection con1
+connection con1;
# Sending 'drop procedure p1'...
drop procedure p1;
-# --> connection con2
+connection con2;
# Waiting for 'drop procedure t1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
-# --> connection con3
+connection con3;
# Waiting for 'select f1()' to get blocked by a pending MDL lock...
-# --> connection default
+connection default;
commit;
-# --> connection con1
+connection con1;
# Reaping 'drop procedure p1'...
-# --> connection con2
+connection con2;
# Reaping 'select f1()'
ERROR 42000: PROCEDURE test.p1 does not exist
-# --> connection default
+connection default;
#
# Test CREATE PROCEDURE.
#
@@ -170,25 +172,26 @@ begin;
select f1();
f1()
1
-# --> connection con1
+connection con1;
# Sending 'create procedure p1'...
create procedure p1() begin end;
-# --> connection con2
+connection con2;
# Waiting for 'create procedure t1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
-# --> connection con3
+connection con3;
# Waiting for 'select f1()' to get blocked by a pending MDL lock...
-# --> connection default
+connection default;
commit;
-# --> connection con1
+connection con1;
# Reaping 'create procedure p1'...
ERROR 42000: PROCEDURE p1 already exists
-# --> connection con2
+connection con2;
# Reaping 'select f1()'
f1()
1
+connection default;
#
# Test ALTER PROCEDURE.
#
@@ -196,25 +199,25 @@ begin;
select f1();
f1()
1
-# --> connection con1
+connection con1;
# Sending 'alter procedure p1'...
alter procedure p1 contains sql;
-# --> connection con2
+connection con2;
# Waiting for 'alter procedure t1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
-# --> connection con3
+connection con3;
# Waiting for 'select f1()' to get blocked by a pending MDL lock...
-# --> connection default
+connection default;
commit;
-# --> connection con1
+connection con1;
# Reaping 'alter procedure p1'...
-# --> connection con2
+connection con2;
# Reaping 'select f1()'
f1()
1
-# --> connection default
+connection default;
#
# Test DROP FUNCTION.
#
@@ -222,24 +225,24 @@ begin;
select f1();
f1()
1
-# --> connection con1
+connection con1;
# Sending 'drop function f1'...
drop function f1;
-# --> connection con2
+connection con2;
# Waiting for 'drop function f1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
-# --> connection con3
+connection con3;
# Waiting for 'select f1()' to get blocked by a pending MDL lock...
-# --> connection default
+connection default;
commit;
-# --> connection con1
+connection con1;
# Reaping 'drop function f1'...
-# --> connection con2
+connection con2;
# Reaping 'select f1()'
ERROR 42000: FUNCTION test.f1 does not exist
-# --> connection default
+connection default;
#
# Test CREATE FUNCTION.
#
@@ -248,26 +251,26 @@ begin;
select f1();
f1()
1
-# --> connection con1
+connection con1;
# Sending 'create function f1'...
create function f1() returns int return 2;
-# --> connection con2
+connection con2;
# Waiting for 'create function f1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
-# --> connection con3
+connection con3;
# Waiting for 'select f1()' to get blocked by a pending MDL lock...
-# --> connection default
+connection default;
commit;
-# --> connection con1
+connection con1;
# Reaping 'create function f1'...
ERROR 42000: FUNCTION f1 already exists
-# --> connection con2
+connection con2;
# Reaping 'select f1()'
f1()
1
-# --> connection default
+connection default;
#
# Test ALTER FUNCTION.
#
@@ -275,25 +278,25 @@ begin;
select f1();
f1()
1
-# --> connection con1
+connection con1;
# Sending 'alter function f1'...
alter function f1 contains sql;
-# --> connection con2
+connection con2;
# Waiting for 'alter function f1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
-# --> connection con3
+connection con3;
# Waiting for 'select f1()' to get blocked by a pending MDL lock...
-# --> connection default
+connection default;
commit;
-# --> connection con1
+connection con1;
# Reaping 'alter function f1'...
-# --> connection con2
+connection con2;
# Reaping 'select f1()'
f1()
1
-# --> connection default
+connection default;
drop function f1;
drop procedure p1;
#
@@ -330,12 +333,12 @@ call p4();
prepare stmt from "call p4()";
execute stmt;
execute stmt;
-# --> connection con1
+connection con1;
drop procedure p1;
drop procedure p2;
drop procedure p3;
drop procedure p4;
-# --> connection default
+connection default;
# This is to verify there was no implicit commit.
rollback to savepoint sv;
call p4();
@@ -356,16 +359,16 @@ 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
+connection con1;
# Sending 'drop function f1'
drop function f1;
-# --> connection con2
+connection con2;
# Waiting for 'drop function f1' to get blocked on MDL lock...
-# --> connnection default
+connection default;
commit;
-# --> connection con1
+connection con1;
# Reaping 'drop function f1'...
-# --> connection default
+connection default;
#
# A function is used from a view.
#
@@ -375,16 +378,16 @@ begin;
select * from v1;
a
1
-# --> connection con1
+connection con1;
# Sending 'drop function f1'
drop function f1;
-# --> connection con2
+connection con2;
# Waiting for 'drop function f1' to get blocked on MDL lock...
-# --> connnection default
+connection default;
commit;
-# --> connection con1
+connection con1;
# Reaping 'drop function f1'...
-# --> connection default
+connection default;
#
# A procedure is used from a function.
#
@@ -399,16 +402,16 @@ begin;
select * from v1;
a
3
-# --> connection con1
+connection con1;
# Sending 'drop procedure p1'
drop procedure p1;
-# --> connection con2
+connection con2;
# Waiting for 'drop procedure p1' to get blocked on MDL lock...
-# --> connnection default
+connection default;
commit;
-# --> connection con1
+connection con1;
# Reaping 'drop procedure p1'...
-# --> connection default
+connection default;
#
# Deep nesting: a function is used from a procedure used
# from a function used from a view used in a trigger.
@@ -420,16 +423,16 @@ 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
+connection con1;
# Sending 'drop function f2'
drop function f2;
-# --> connection con2
+connection con2;
# Waiting for 'drop function f2' to get blocked on MDL lock...
-# --> connnection default
+connection default;
commit;
-# --> connection con1
+connection con1;
# Reaping 'drop function f2'...
-# --> connection default
+connection default;
drop view v1;
drop function f1;
drop procedure p1;
@@ -475,23 +478,23 @@ savepoint sv;
select f2();
f2()
f2()
-# --> connection con1
+connection con1;
# Sending 'drop function f1'...
drop function f1;
-# --> connection con2
+connection con2;
# Waiting for 'drop function f1' to get blocked on MDL lock...
# Sending 'drop function f2'...
drop function f2;
-# --> connection default
+connection default;
# Waiting for 'drop function f2' to get blocked on MDL lock...
rollback to savepoint sv;
-# --> connection con2
+connection con2;
# Reaping 'drop function f2'...
-# --> connection default
+connection default;
unlock tables;
-# --> connection con1
+connection con1;
# Reaping 'drop function f1'...
-# --> connection default
+connection default;
drop function f1;
ERROR 42000: FUNCTION test.f1 does not exist
drop function f2;
@@ -526,31 +529,32 @@ begin
select f1() into @var;
execute stmt;
end|
-# --> connection con2
+connection con2;
prepare stmt from "select f2()";
-# --> connection default
+connection default;
begin;
select f1();
f1()
1
-# --> connection con1
+connection con1;
# Sending 'alter function f1 ...'...
alter function f1 comment "comment";
-# --> connection con2
+connection con2;
# Waiting for 'alter function f1 ...' to get blocked on MDL lock...
# Sending 'call p1()'...
call p1();
+connection default;
# Waiting for 'call p1()' to get blocked on MDL lock on f1...
# Let 'alter function f1 ...' go through...
commit;
-# --> connection con1
+connection con1;
# Reaping 'alter function f1 ...'
-# --> connection con2
+connection con2;
# Reaping 'call p1()'...
f2()
1
deallocate prepare stmt;
-# --> connection default
+connection default;
drop function f1;
drop function f2;
drop procedure p1;
@@ -569,10 +573,10 @@ begin;
select f1();
f1()
1
-# --> connection con1
+connection con1;
# Sending 'alter function f1 ...'...
alter function f1 comment "comment";
-# --> connection con2
+connection con2;
# Waiting for 'alter function f1 ...' to get blocked on MDL lock...
#
# We just mention p1() in the body of f2() to make
@@ -595,14 +599,15 @@ select f2() into @var;
end|
# Sending 'call p1()'...
call p1();
+connection default;
# Waiting for 'call p1()' to get blocked on MDL lock on f1...
# Let 'alter function f1 ...' go through...
commit;
-# --> connection con1
+connection con1;
# Reaping 'alter function f1 ...'
-# --> connection con2
+connection con2;
# Reaping 'call p1()'...
-# --> connection default
+connection default;
drop function f1;
drop function f2;
drop procedure p1;
@@ -626,14 +631,14 @@ close c;
select f2() into @var;
return res;
end|
-# --> connection con1
+connection con1;
select get_lock("30977", 0);
get_lock("30977", 0)
1
-# --> connection default
+connection default;
# Sending 'select f3()'...
select f3();
-# --> connection con1
+connection con1;
# Waiting for 'select f3()' to get blocked on the user level lock...
# Do something to change the cache version.
create function f4() returns int return 4;
@@ -641,7 +646,7 @@ drop function f4;
select release_lock("30977");
release_lock("30977")
1
-# --> connection default
+connection default;
# Reaping 'select f3()'...
# Routine 'f2()' should exist and get executed successfully.
f3()
@@ -681,17 +686,20 @@ select @exec_count;
set @@session.max_sp_recursion_depth=5;
set @exec_count=0;
call p1();
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
select @exec_count;
@exec_count
0
drop procedure p1;
drop function f1;
set @@session.max_sp_recursion_depth=default;
-# --> connection con1
-# --> connection con2
-# --> connection con3
-# --> connection default
+connection con1;
+disconnect con1;
+connection con2;
+disconnect con2;
+connection con3;
+disconnect con3;
+connection default;
#
# SHOW CREATE PROCEDURE p1 called from p1, after p1 was altered
#
@@ -703,36 +711,40 @@ BEGIN
SELECT get_lock("test", 10);
SHOW CREATE PROCEDURE p1;
END|
-# Connection default
+connect con2, localhost, root;
+connect con3, localhost, root;
+connection default;
SELECT get_lock("test", 10);
get_lock("test", 10)
1
-# Connection 2
+connection con2;
# Will halt before executing SHOW CREATE PROCEDURE p1
# Sending:
CALL p1();
-# Connection 3
+connection con3;
# Alter p1
DROP PROCEDURE p1;
CREATE PROCEDURE p1() BEGIN END;
-# Connection default
+connection default;
# Resume CALL p1, now with new p1
SELECT release_lock("test");
release_lock("test")
1
-# Connection 2
+connection con2;
# Reaping: CALL p1()
get_lock("test", 10)
1
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-p1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
BEGIN
SELECT get_lock("test", 10);
SHOW CREATE PROCEDURE p1;
END latin1 latin1_swedish_ci latin1_swedish_ci
-# Connection 3
-# Connection 2
-# Connection default;
+connection con3;
+disconnect con3;
+connection con2;
+disconnect con2;
+connection default;
DROP PROCEDURE p1;
#
# Bug#57663 Concurrent statement using stored function and DROP DATABASE
@@ -740,26 +752,28 @@ DROP PROCEDURE p1;
#
DROP DATABASE IF EXISTS db1;
DROP FUNCTION IF EXISTS f1;
+connect con1, localhost, root;
+connect con2, localhost, root;
# Test 1: Check that DROP DATABASE block if a function is used
# by an active transaction.
-# Connection default
+connection default;
CREATE DATABASE db1;
CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
START TRANSACTION;
SELECT db1.f1();
db1.f1()
1
-# Connection con1
+connection con1;
# Sending:
DROP DATABASE db1;
-# Connection default
+connection default;
# Waiting for DROP DATABASE to be blocked by the lock on f1()
COMMIT;
-# Connection con1
+connection con1;
# Reaping: DROP DATABASE db1
# Test 2: Check that DROP DATABASE blocks if a procedure is
# used by an active transaction.
-# Connection default
+connection default;
CREATE DATABASE db1;
CREATE PROCEDURE db1.p1() BEGIN END;
CREATE FUNCTION f1() RETURNS INTEGER
@@ -771,17 +785,17 @@ START TRANSACTION;
SELECT f1();
f1()
1
-# Connection con1
+connection con1;
# Sending:
DROP DATABASE db1;
-# Connection default
+connection default;
# Waiting for DROP DATABASE to be blocked by the lock on p1()
COMMIT;
-# Connection con1
+connection con1;
# Reaping: DROP DATABASE db1
# Test 3: Check that DROP DATABASE is not selected as a victim if a
# deadlock is discovered with DML statements.
-# Connection default
+connection default;
CREATE DATABASE db1;
CREATE TABLE db1.t1 (a INT);
CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
@@ -789,18 +803,18 @@ START TRANSACTION;
SELECT db1.f1();
db1.f1()
1
-# Connection con1
+connection con1;
# Sending:
DROP DATABASE db1;
-# Connection default
+connection default;
# Waiting for DROP DATABASE to be blocked by the lock on f1()
SELECT * FROM db1.t1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT;
-# Connection con1
+connection con1;
# Reaping: DROP DATABASE db1
# Test 4: Check that active DROP DATABASE blocks stored routine DDL.
-# Connection default
+connection default;
CREATE DATABASE db1;
CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
CREATE FUNCTION db1.f2() RETURNS INTEGER RETURN 2;
@@ -808,22 +822,24 @@ START TRANSACTION;
SELECT db1.f2();
db1.f2()
2
-# Connection con1
+connection con1;
# Sending:
DROP DATABASE db1;
-# Connection con2
+connection con2;
# Waiting for DROP DATABASE to be blocked by the lock on f2()
# Sending:
ALTER FUNCTION db1.f1 COMMENT "test";
-# Connection default
+connection default;
# Waiting for ALTER FUNCTION to be blocked by the schema lock on db1
COMMIT;
-# Connection con1
+connection con1;
# Reaping: DROP DATABASE db1
-# Connection con2
+disconnect con1;
+connection con2;
# Reaping: ALTER FUNCTION f1 COMMENT 'test'
ERROR 42000: FUNCTION db1.f1 does not exist
-# Connection default
+disconnect con2;
+connection default;
DROP FUNCTION f1;
#
# End of 5.5 tests
diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result
index 276da41a0fe..882072ff7c7 100644
--- a/mysql-test/r/sp-security.result
+++ b/mysql-test/r/sp-security.result
@@ -1,3 +1,5 @@
+connect con1root,localhost,root,,;
+connection con1root;
use test;
create user user1@localhost;
grant usage on *.* to user1@localhost;
@@ -39,6 +41,9 @@ 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,,;
+connection con2user1;
call db1_secret.stamp(2);
select db1_secret.db();
db1_secret.db()
@@ -53,6 +58,7 @@ drop procedure db1_secret.stamp;
ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db1_secret.stamp'
drop function db1_secret.db;
ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db1_secret.db'
+connection con3anon;
call db1_secret.stamp(3);
select db1_secret.db();
db1_secret.db()
@@ -67,6 +73,7 @@ drop procedure db1_secret.stamp;
ERROR 42000: alter routine command denied to user ''@'%' for routine 'db1_secret.stamp'
drop function db1_secret.db;
ERROR 42000: alter routine command denied to user ''@'%' for routine 'db1_secret.db'
+connection con1root;
select * from t1;
u i
test 0
@@ -92,14 +99,17 @@ root@localhost 4
select db();
db()
test
+connection con2user1;
call db1_secret.stamp(5);
ERROR 42000: INSERT command denied to user 'user1'@'localhost' for table 't1'
select db1_secret.db();
ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1'
+connection con3anon;
call db1_secret.stamp(6);
ERROR 42000: INSERT command denied to user ''@'localhost' for table 't1'
select db1_secret.db();
ERROR 42000: SELECT command denied to user ''@'localhost' for table 't1'
+connection con1root;
drop database if exists db2;
create database db2;
use db2;
@@ -112,10 +122,13 @@ 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);
call p();
ERROR 42000: INSERT command denied to user 'user1'@'localhost' for table 't2'
+connect con4user2,localhost,user2,,;
+connection con4user2;
use db2;
call p();
ERROR 42000: execute command denied to user 'user2'@'localhost' for routine 'db2.p'
@@ -128,8 +141,11 @@ select * from t2;
s1
0
2
+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;
call q();
select * from t2;
@@ -143,9 +159,13 @@ alter procedure q modifies sql data;
ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db2.q'
drop procedure q;
ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db2.q'
+connection con1root;
use db2;
alter procedure q modifies sql data;
drop procedure q;
+disconnect con2user1;
+disconnect con3anon;
+disconnect con4user2;
use test;
select type,db,name from mysql.proc where db like 'db%';
type db name
@@ -182,26 +202,34 @@ show grants for userc@localhost;
Grants for userc@localhost
GRANT USAGE ON *.* TO 'userc'@'localhost'
GRANT EXECUTE ON PROCEDURE `sptest`.`p1` TO 'userc'@'localhost' WITH GRANT OPTION
+connect con2usera,localhost,usera,,;
+connect con3userb,localhost,userb,,;
+connect con4userc,localhost,userc,,;
+connection con2usera;
call sptest.p1(1);
grant execute on procedure sptest.p1 to userb@localhost;
ERROR 42000: grant command denied to user 'usera'@'localhost' for routine 'sptest.p1'
drop procedure sptest.p1;
ERROR 42000: alter routine command denied to user 'usera'@'localhost' for routine 'sptest.p1'
+connection con3userb;
call sptest.p1(2);
ERROR 42000: execute command denied to user 'userb'@'localhost' for routine 'sptest.p1'
grant execute on procedure sptest.p1 to userb@localhost;
ERROR 42000: execute command denied to user 'userb'@'localhost' for routine 'sptest.p1'
drop procedure sptest.p1;
ERROR 42000: alter routine command denied to user 'userb'@'localhost' for routine 'sptest.p1'
+connection con4userc;
call sptest.p1(3);
grant execute on procedure sptest.p1 to userb@localhost;
drop procedure sptest.p1;
ERROR 42000: alter routine command denied to user 'userc'@'localhost' for routine 'sptest.p1'
+connection con3userb;
call sptest.p1(4);
grant execute on procedure sptest.p1 to userb@localhost;
ERROR 42000: grant command denied to user 'userb'@'localhost' for routine 'sptest.p1'
drop procedure sptest.p1;
ERROR 42000: alter routine command denied to user 'userb'@'localhost' for routine 'sptest.p1'
+connection con1root;
select * from t1;
u i
usera@localhost 1
@@ -216,10 +244,15 @@ show grants for userb@localhost;
Grants for userb@localhost
GRANT USAGE ON *.* TO 'userb'@'localhost'
GRANT EXECUTE ON PROCEDURE `sptest`.`p1` TO 'userb'@'localhost'
+connection con4userc;
revoke all privileges on procedure sptest.p1 from userb@localhost;
+connection con1root;
show grants for userb@localhost;
Grants for userb@localhost
GRANT USAGE ON *.* TO 'userb'@'localhost'
+disconnect con4userc;
+disconnect con3userb;
+disconnect con2usera;
use test;
drop database sptest;
delete from mysql.user where user='usera' or user='userb' or user='userc';
@@ -227,6 +260,8 @@ 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;
+connect root,localhost,root,,test;
+connection root;
drop function if exists bug_9503;
drop user if exists user1@localhost;
create database mysqltest//
@@ -236,16 +271,25 @@ 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//
+connect user1,localhost,user1,,test;
+connection user1;
use mysqltest;
select bug_9503();
ERROR 42000: execute command denied to user 'user1'@'localhost' for routine 'mysqltest.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;
+connection con1root;
use test;
select current_user();
current_user()
@@ -259,15 +303,19 @@ 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();
current_user() user()
user1@localhost user1@localhost
call bug7291_1();
current_user() user()
root@localhost user1@localhost
+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;
drop database if exists mysqltest_1;
@@ -278,10 +326,17 @@ select 1 from dual;
end//
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;
call mysqltest_1.p1();
ERROR 42000: execute command denied to user 'mysqltest_1'@'localhost' for routine 'mysqltest_1.p1'
+disconnect n1;
+connect n2,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection n2;
call mysqltest_1.p1();
ERROR 42000: execute command denied to user 'mysqltest_1'@'localhost' for routine 'mysqltest_1.p1'
+disconnect n2;
+connection default;
drop procedure mysqltest_1.p1;
drop database mysqltest_1;
revoke usage on *.* from mysqltest_1@localhost;
@@ -292,10 +347,13 @@ begin
return 'ok';
end;
create user user_bug12812@localhost IDENTIFIED BY 'ABC'|
+connect test_user_12812,localhost,user_bug12812,ABC,test;
SELECT test.bug12812()|
ERROR 42000: execute command denied to user 'user_bug12812'@'localhost' for routine 'test.bug12812'
CREATE VIEW v1 AS SELECT test.bug12812()|
ERROR 42000: execute command denied to user 'user_bug12812'@'localhost' for routine 'test.bug12812'
+connection default;
+disconnect test_user_12812;
DROP USER user_bug12812@localhost|
drop function bug12812|
create database db_bug14834;
@@ -305,16 +363,23 @@ create user user2_bug14834@localhost identified by '';
grant all on `db\_bug14834`.* to user2_bug14834@localhost;
create user user3_bug14834@localhost identified by '';
grant all on `db__ug14834`.* to user3_bug14834@localhost;
+connect user1_bug14834,localhost,user1_bug14834,,db_bug14834;
create procedure p_bug14834() select user(), current_user();
call p_bug14834();
user() current_user()
user1_bug14834@localhost user1_bug14834@localhost
+connect user2_bug14834,localhost,user2_bug14834,,db_bug14834;
call p_bug14834();
user() current_user()
user2_bug14834@localhost user1_bug14834@localhost
+connect user3_bug14834,localhost,user3_bug14834,,db_bug14834;
call p_bug14834();
user() current_user()
user3_bug14834@localhost user1_bug14834@localhost
+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;
@@ -331,6 +396,7 @@ 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;
call db_bug14533.bug14533_1();
Field Type Null Key Default Extra
id int(11) YES NULL
@@ -340,10 +406,11 @@ desc db_bug14533.t1;
ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table 't1'
select * from db_bug14533.t1;
ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table 't1'
+connection default;
+disconnect user_bug14533;
drop user user_bug14533@localhost;
drop database db_bug14533;
-
----> connection: root
+connection con1root;
DROP DATABASE IF EXISTS mysqltest;
CREATE DATABASE mysqltest;
CREATE USER mysqltest_1@localhost;
@@ -351,20 +418,19 @@ 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;
-
----> connection: mysqltest_2_con
+connect mysqltest_2_con,localhost,mysqltest_2,,mysqltest;
+connect mysqltest_1_con,localhost,mysqltest_1,,mysqltest;
+connection mysqltest_2_con;
USE mysqltest;
CREATE PROCEDURE wl2897_p1() SELECT 1;
CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
-
----> connection: mysqltest_1_con
+connection mysqltest_1_con;
USE mysqltest;
CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
CREATE DEFINER=root@localhost FUNCTION wl2897_f2() RETURNS INT RETURN 2;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
-
----> connection: mysqltest_2_con
+connection mysqltest_2_con;
use mysqltest;
CREATE DEFINER='a @ b @ c'@localhost PROCEDURE wl2897_p3() SELECT 3;
Warnings:
@@ -372,38 +438,39 @@ Note 1449 The user specified as a definer ('a @ b @ c'@'localhost') does not exi
CREATE DEFINER='a @ b @ c'@localhost FUNCTION wl2897_f3() RETURNS INT RETURN 3;
Warnings:
Note 1449 The user specified as a definer ('a @ b @ c'@'localhost') does not exist
-
----> connection: con1root
+connection con1root;
USE mysqltest;
SHOW CREATE PROCEDURE wl2897_p1;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-wl2897_p1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`mysqltest_2`@`localhost` PROCEDURE `wl2897_p1`()
+wl2897_p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`mysqltest_2`@`localhost` PROCEDURE `wl2897_p1`()
SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE PROCEDURE wl2897_p3;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-wl2897_p3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`a @ b @ c`@`localhost` PROCEDURE `wl2897_p3`()
+wl2897_p3 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`a @ b @ c`@`localhost` PROCEDURE `wl2897_p3`()
SELECT 3 latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE FUNCTION wl2897_f1;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-wl2897_f1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`mysqltest_2`@`localhost` FUNCTION `wl2897_f1`() RETURNS int(11)
+wl2897_f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`mysqltest_2`@`localhost` FUNCTION `wl2897_f1`() RETURNS int(11)
RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE FUNCTION wl2897_f3;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-wl2897_f3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`a @ b @ c`@`localhost` FUNCTION `wl2897_f3`() RETURNS int(11)
+wl2897_f3 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`a @ b @ c`@`localhost` FUNCTION `wl2897_f3`() RETURNS int(11)
RETURN 3 latin1 latin1_swedish_ci latin1_swedish_ci
DROP USER mysqltest_1@localhost;
DROP USER mysqltest_2@localhost;
DROP DATABASE mysqltest;
-
----> connection: root
+disconnect mysqltest_1_con;
+disconnect mysqltest_2_con;
+connection con1root;
DROP DATABASE IF EXISTS mysqltest;
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;
-
----> connection: mysqltest_1_con
+connect mysqltest_1_con,localhost,mysqltest_1,,mysqltest;
+connect mysqltest_2_con,localhost,mysqltest_2,,mysqltest;
+connection mysqltest_1_con;
USE mysqltest;
CREATE PROCEDURE bug13198_p1()
SELECT 1;
@@ -415,8 +482,7 @@ CALL bug13198_p1();
SELECT bug13198_f1();
bug13198_f1()
1
-
----> connection: mysqltest_2_con
+connection mysqltest_2_con;
USE mysqltest;
CALL bug13198_p1();
1
@@ -424,18 +490,17 @@ CALL bug13198_p1();
SELECT bug13198_f1();
bug13198_f1()
1
-
----> connection: root
+connection con1root;
+disconnect mysqltest_1_con;
DROP USER mysqltest_1@localhost;
-
----> connection: mysqltest_2_con
+connection mysqltest_2_con;
USE mysqltest;
CALL bug13198_p1();
ERROR HY000: The user specified as a definer ('mysqltest_1'@'localhost') does not exist
SELECT bug13198_f1();
ERROR HY000: The user specified as a definer ('mysqltest_1'@'localhost') does not exist
-
----> connection: root
+connection con1root;
+disconnect mysqltest_2_con;
DROP USER mysqltest_2@localhost;
DROP DATABASE mysqltest;
GRANT USAGE ON *.* TO user19857@localhost IDENTIFIED BY 'meow';
@@ -444,8 +509,8 @@ user19857@localhost;
SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
Host User Password
localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C
-
----> connection: mysqltest_2_con
+connect mysqltest_2_con,localhost,user19857,meow,test;
+connection mysqltest_2_con;
USE test;
CREATE PROCEDURE sp19857() DETERMINISTIC
BEGIN
@@ -455,20 +520,25 @@ SELECT a;
END //
SHOW CREATE PROCEDURE test.sp19857;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-sp19857 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user19857`@`localhost` PROCEDURE `sp19857`()
+sp19857 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user19857`@`localhost` PROCEDURE `sp19857`()
DETERMINISTIC
BEGIN
DECLARE a INT;
SET a=1;
SELECT a;
END latin1 latin1_swedish_ci latin1_swedish_ci
+disconnect mysqltest_2_con;
+connect mysqltest_2_con,localhost,user19857,meow,test;
+connection mysqltest_2_con;
DROP PROCEDURE IF EXISTS test.sp19857;
-
----> connection: root
+connection con1root;
+disconnect mysqltest_2_con;
SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
Host User Password
localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C
DROP USER user19857@localhost;
+disconnect con1root;
+connection default;
use test;
DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
@@ -493,6 +563,7 @@ SET @b:= (SELECT COUNT(*) FROM t1);
RETURN @b;
END|
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT f_evil();
+connect conn1, localhost, mysqltest_u1,,;
SELECT COUNT(*) FROM t1;
ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1'
SELECT f_evil();
@@ -515,6 +586,8 @@ ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table
SELECT @a, @b;
@a @b
mysqltest_u1@localhost NULL
+disconnect conn1;
+connection default;
DROP VIEW v1;
DROP FUNCTION f_evil;
DROP USER mysqltest_u1@localhost;
@@ -543,6 +616,9 @@ SELECT * FROM TestTab;
id
1
2
+CONNECT con_tester,localhost,tester,,B48872;
+CONNECT con_tester_denied,localhost,Tester,,B48872;
+connection con_tester;
SELECT * FROM TestTab;
id
1
@@ -559,6 +635,7 @@ f_Test()
SELECT F_TEST();
F_TEST()
123
+connection con_tester_denied;
SELECT * FROM TestTab;
SELECT `f_Test`();
SELECT `F_TEST`();
@@ -570,6 +647,9 @@ SELECT `f_Test_denied`();
SELECT `F_TEST_DENIED`();
`F_TEST_DENIED`()
123
+connection default;
+disconnect con_tester;
+disconnect con_tester_denied;
DROP TABLE `TestTab`;
DROP FUNCTION `f_Test`;
DROP FUNCTION `f_Test_denied`;
@@ -588,7 +668,7 @@ create database mysqltest_db;
create user bug57061_user@localhost;
create function mysqltest_db.f1() returns int return 0;
create procedure mysqltest_db.p1() begin end;
-# Connect as user 'bug57061_user@localhost'
+connect conn1, localhost, bug57061_user,,;
# Attempt to drop routine on which user doesn't have privileges
# should result in the same 'access denied' type of error whether
# routine exists or not.
@@ -600,7 +680,8 @@ drop function if exists mysqltest_db.f1;
ERROR 42000: alter routine command denied to user 'bug57061_user'@'localhost' for routine 'mysqltest_db.f1'
drop procedure if exists mysqltest_db.p1;
ERROR 42000: alter routine command denied to user 'bug57061_user'@'localhost' for routine 'mysqltest_db.p1'
-# Connection 'default'.
+connection default;
+disconnect conn1;
drop user bug57061_user@localhost;
drop database mysqltest_db;
#
@@ -612,20 +693,21 @@ CREATE DATABASE db1;
CREATE PROCEDURE db1.p1() SELECT 1;
CREATE USER user2@localhost IDENTIFIED BY '';
GRANT SELECT(db) ON mysql.proc TO user2@localhost;
-# Connection con2 as user2
+connect con2, localhost, user2;
# The statement below before disclosed info from body_utf8 column.
SHOW CREATE PROCEDURE db1.p1;
ERROR 42000: PROCEDURE p1 does not exist
# Check that SHOW works with SELECT grant on whole table
-# Connection default
+connection default;
GRANT SELECT ON mysql.proc TO user2@localhost;
-# Connection con2
+connection con2;
# This should work
SHOW CREATE PROCEDURE db1.p1;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-p1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci
-# Connection default
+connection default;
+disconnect con2;
DROP USER user2@localhost;
DROP DATABASE db1;
#
@@ -639,7 +721,7 @@ create function mysqltest_db.f1() returns int return 0;
create procedure mysqltest_db.p1() begin end;
# Create user with no privileges on mysqltest_db database.
create user bug12602983_user@localhost;
-# Connect as user 'bug12602983_user@localhost'
+connect conn1, localhost, bug12602983_user,,;
# Attempt to execute routine on which user doesn't have privileges
# should result in the same 'access denied' error whether
# routine exists or not.
@@ -655,7 +737,8 @@ create view bug12602983_v1 as select mysqltest_db.f_does_not_exist();
ERROR 42000: execute command denied to user 'bug12602983_user'@'localhost' for routine 'mysqltest_db.f_does_not_exist'
create view bug12602983_v1 as select mysqltest_db.f1();
ERROR 42000: execute command denied to user 'bug12602983_user'@'localhost' for routine 'mysqltest_db.f1'
-# Connection 'default'.
+connection default;
+disconnect conn1;
drop user bug12602983_user@localhost;
drop database mysqltest_db;
set password=password('foobar');
@@ -672,3 +755,21 @@ GRANT EXECUTE ON PROCEDURE `test`.`sp1` TO 'root'@'localhost'
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
drop procedure sp1;
set password='';
+#
+# MDEV-13396 Unexpected "alter routine comand defined" during CREATE OR REPLACE PROCEDURE
+#
+CREATE DATABASE u1;
+CREATE PROCEDURE u1.p1() BEGIN SELECT 1; END; $$
+CREATE FUNCTION u1.f1() RETURNS INT BEGIN RETURN 1; END; $$
+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;
+CREATE OR REPLACE FUNCTION f1() RETURNS INT BEGIN RETURN 2; END; $$
+CREATE OR REPLACE PROCEDURE p1() BEGIN SELECT 1; END; $$
+disconnect u1;
+connection default;
+DROP DATABASE u1;
+DROP USER u1@localhost;
diff --git a/mysql-test/r/sp-threads.result b/mysql-test/r/sp-threads.result
index ddf709d462b..886cbd812f2 100644
--- a/mysql-test/r/sp-threads.result
+++ b/mysql-test/r/sp-threads.result
@@ -1,3 +1,7 @@
+connect con1root,localhost,root,,;
+connect con2root,localhost,root,,;
+connect con3root,localhost,root,,;
+connection con1root;
use test;
drop table if exists t1;
create table t1 (s1 int, s2 int, s3 int);
@@ -5,22 +9,26 @@ create procedure bug4934()
begin
insert into t1 values (1,0,1);
end//
+connection con2root;
use test;
call bug4934();
select * from t1;
s1 s2 s3
1 0 1
+connection con1root;
drop table t1;
create table t1 (s1 int, s2 int, s3 int);
drop procedure bug4934;
create procedure bug4934()
begin
end//
+connection con2root;
select * from t1;
s1 s2 s3
call bug4934();
select * from t1;
s1 s2 s3
+connection con1root;
drop table t1;
drop procedure bug4934;
drop procedure if exists bug9486;
@@ -30,12 +38,16 @@ create table t2 (id2 int);
create procedure bug9486()
update t1, t2 set val= 1 where id1=id2;
call bug9486();
+connection con2root;
lock tables t2 write;
+connection con1root;
call bug9486();
+connection con2root;
SELECT state,info FROM information_schema.processlist WHERE id=con1root_id;
state info
Waiting for table metadata lock update t1, t2 set val= 1 where id1=id2
unlock tables;
+connection con1root;
drop procedure bug9486;
drop table t1, t2;
drop procedure if exists bug11158;
@@ -48,9 +60,13 @@ call bug11158();
select * from t1;
id j
2 2
+connection con2root;
lock tables t2 read;
+connection con1root;
call bug11158();
+connection con2root;
unlock tables;
+connection con1root;
drop procedure bug11158;
drop table t1, t2;
drop function if exists bug11554;
@@ -58,12 +74,15 @@ drop view if exists v1;
create table t1 (i int);
create function bug11554 () returns int return 1;
create view v1 as select bug11554() as f;
+connection con2root;
insert into t1 (select f from v1);
+connection con1root;
drop function bug11554;
drop table t1;
drop view v1;
drop procedure if exists p1;
drop procedure if exists p2;
+connection con1root;
create table t1 (s1 int)|
create procedure p1() select * from t1|
create procedure p2()
@@ -72,13 +91,18 @@ insert into t1 values (1);
call p1();
select * from t1;
end|
+connection con2root;
use test;
lock table t1 write;
+connection con1root;
call p2();
+connection con3root;
use test;
drop procedure p1;
create procedure p1() select * from t1;
+connection con2root;
unlock tables;
+connection con1root;
s1
1
s1
@@ -86,3 +110,7 @@ s1
drop procedure p1;
drop procedure p2;
drop table t1;
+connection default;
+disconnect con1root;
+disconnect con2root;
+disconnect con3root;
diff --git a/mysql-test/r/sp-ucs2.result b/mysql-test/r/sp-ucs2.result
index 3c444ad97de..b8cc5dfd73d 100644
--- a/mysql-test/r/sp-ucs2.result
+++ b/mysql-test/r/sp-ucs2.result
@@ -40,7 +40,7 @@ BEGIN
RETURN '';
END|
Function sql_mode Create Function character_set_client collation_connection Database Collation
-f NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET ucs2 COLLATE ucs2_bin
+f STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET ucs2 COLLATE ucs2_bin
BEGIN
RETURN '';
END latin1 latin1_swedish_ci latin1_swedish_ci
@@ -55,7 +55,7 @@ BEGIN
RETURN '';
END|
Function sql_mode Create Function character_set_client collation_connection Database Collation
-f NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET ucs2 COLLATE ucs2_bin
+f STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET ucs2 COLLATE ucs2_bin
BEGIN
RETURN '';
END latin1 latin1_swedish_ci latin1_swedish_ci
@@ -67,7 +67,7 @@ BEGIN
RETURN '';
END|
Function sql_mode Create Function character_set_client collation_connection Database Collation
-f NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_bin
+f STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_bin
BEGIN
RETURN '';
END latin1 latin1_swedish_ci latin1_swedish_ci
@@ -83,7 +83,7 @@ SET f2= f1;
SET f2= concat(collation(f1), ' ', collation(f2));
END|
Function sql_mode Create Function character_set_client collation_connection Database Collation
-f NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_bin
+f STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_bin
BEGIN
RETURN '';
END latin1 latin1_swedish_ci latin1_swedish_ci
@@ -127,7 +127,7 @@ RETURNS ENUM( 'w' ) CHARACTER SET ucs2
RETURN 0;
SHOW CREATE FUNCTION bug48766;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-bug48766 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `bug48766`() RETURNS enum('w') CHARSET ucs2
+bug48766 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `bug48766`() RETURNS enum('w') CHARSET ucs2
RETURN 0 utf8 utf8_general_ci latin1_swedish_ci
SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_NAME='bug48766';
@@ -139,7 +139,7 @@ RETURNS ENUM('а','б','в','г') CHARACTER SET ucs2
RETURN 0;
SHOW CREATE FUNCTION bug48766;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-bug48766 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `bug48766`() RETURNS enum('а','б','в','г') CHARSET ucs2
+bug48766 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `bug48766`() RETURNS enum('а','б','в','г') CHARSET ucs2
RETURN 0 utf8 utf8_general_ci latin1_swedish_ci
SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_NAME='bug48766';
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index ad5bddda035..537da742032 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -791,7 +791,7 @@ comment 'Characteristics procedure test'
insert into t1 values ("chistics", 1)|
show create procedure chistics|
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-chistics NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `chistics`()
+chistics STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `chistics`()
MODIFIES SQL DATA
COMMENT 'Characteristics procedure test'
insert into t1 values ("chistics", 1) latin1 latin1_swedish_ci latin1_swedish_ci
@@ -803,7 +803,7 @@ delete from t1|
alter procedure chistics sql security invoker|
show create procedure chistics|
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-chistics NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `chistics`()
+chistics STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `chistics`()
MODIFIES SQL DATA
SQL SECURITY INVOKER
COMMENT 'Characteristics procedure test'
@@ -818,7 +818,7 @@ comment 'Characteristics procedure test'
return 42|
show create function chistics|
Function sql_mode Create Function character_set_client collation_connection Database Collation
-chistics NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `chistics`() RETURNS int(11)
+chistics STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `chistics`() RETURNS int(11)
DETERMINISTIC
SQL SECURITY INVOKER
COMMENT 'Characteristics procedure test'
@@ -831,7 +831,7 @@ no sql
comment 'Characteristics function test'|
show create function chistics|
Function sql_mode Create Function character_set_client collation_connection Database Collation
-chistics NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `chistics`() RETURNS int(11)
+chistics STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `chistics`() RETURNS int(11)
NO SQL
DETERMINISTIC
SQL SECURITY INVOKER
@@ -997,9 +997,9 @@ select f5(1)|
f5(1)
1
select f5(2)|
-ERROR HY000: Recursive stored functions and triggers are not allowed.
+ERROR HY000: Recursive stored functions and triggers are not allowed
select f5(3)|
-ERROR HY000: Recursive stored functions and triggers are not allowed.
+ERROR HY000: Recursive stored functions and triggers are not allowed
create function f6() returns int
begin
declare n int;
@@ -1048,11 +1048,11 @@ ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function
create function f1() returns int
return (select sum(data) from t1) + (select sum(data) from v1)|
select f1()|
-ERROR HY000: Recursive stored functions and triggers are not allowed.
+ERROR HY000: Recursive stored functions and triggers are not allowed
select * from v1|
-ERROR HY000: Recursive stored functions and triggers are not allowed.
+ERROR HY000: Recursive stored functions and triggers are not allowed
select * from v2|
-ERROR HY000: Recursive stored functions and triggers are not allowed.
+ERROR HY000: Recursive stored functions and triggers are not allowed
drop function f1|
create function f1() returns int
return (select sum(data) from t1)|
@@ -1140,9 +1140,12 @@ insert into t3 values (1), (2), (3);
return (select count(*) from t3 as a, t3 as b);
end|
select f11()|
-ERROR HY000: Can't reopen table: 'a'
+f11()
+9
select f11() from t1|
-ERROR HY000: Can't reopen table: 'a'
+f11()
+9
+9
create function f12_1() returns int
begin
drop temporary table if exists t3;
@@ -1156,6 +1159,7 @@ drop temporary table t3|
select f12_1()|
f12_1()
3
+drop temporary table t3|
select f12_1() from t1 limit 1|
f12_1()
3
@@ -4060,9 +4064,9 @@ select @@max_sp_recursion_depth|
@@max_sp_recursion_depth
4
select bug10100f(3)|
-ERROR HY000: Recursive stored functions and triggers are not allowed.
+ERROR HY000: Recursive stored functions and triggers are not allowed
select bug10100f(6)|
-ERROR HY000: Recursive stored functions and triggers are not allowed.
+ERROR HY000: Recursive stored functions and triggers are not allowed
call bug10100t(5)|
res
120
@@ -4131,7 +4135,7 @@ select @@max_sp_recursion_depth|
@@max_sp_recursion_depth
0
select bug10100f(5)|
-ERROR HY000: Recursive stored functions and triggers are not allowed.
+ERROR HY000: Recursive stored functions and triggers are not allowed
call bug10100t(5)|
ERROR HY000: Recursive limit 0 (as set by the max_sp_recursion_depth variable) was exceeded for routine bug10100p
deallocate prepare stmt2|
@@ -6041,12 +6045,12 @@ select bug20777(9223372036854775810) as '9223372036854775810 2**63+2';
9223372036854775810 2**63+2
9223372036854775810
select bug20777(-9223372036854775808) as 'lower bounds signed bigint';
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)'
+ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10'
select bug20777(9223372036854775807) as 'upper bounds signed bigint';
upper bounds signed bigint
9223372036854775807
select bug20777(0) as 'lower bounds unsigned bigint';
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)'
+ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10'
select bug20777(18446744073709551615) as 'upper bounds unsigned bigint';
upper bounds unsigned bigint
18446744073709551615
@@ -6056,7 +6060,7 @@ upper bounds unsigned bigint + 1
Warnings:
Warning 1264 Out of range value for column 'f1' at row 1
select bug20777(-1) as 'lower bounds unsigned bigint - 1';
-ERROR 22003: BIGINT UNSIGNED value is out of range in '(f1@0 - 10)'
+ERROR 22003: BIGINT UNSIGNED value is out of range in 'f1@0 - 10'
create table examplebug20777 as select
0 as 'i',
bug20777(9223372036854775806) as '2**63-2',
@@ -6417,6 +6421,8 @@ set x=-1;
return x;
end|
create view v1 as select 1 as one, f1() as days;
+connect bug29408, localhost, root,,*NO-ONE*;
+connection bug29408;
show create view test.v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select 1 AS `one`,`f1`() AS `days` latin1 latin1_swedish_ci
@@ -6425,6 +6431,8 @@ where table_name='v1' and table_schema='test';
column_name
one
days
+connection default;
+disconnect bug29408;
drop view v1;
drop function f1;
@@ -6929,7 +6937,7 @@ CREATE TEMPORARY TABLE t3 LIKE t1;
CREATE PROCEDURE p1 () BEGIN SELECT f1 FROM t3 AS A WHERE A.f1 IN ( SELECT f1 FROM t3 ) ;
END|
CALL p1;
-ERROR HY000: Can't reopen table: 'A'
+f1
CREATE VIEW t3 AS SELECT f1 FROM t2 A WHERE A.f1 IN ( SELECT f1 FROM t2 );
DROP TABLE t3;
CALL p1;
@@ -8243,3 +8251,95 @@ DROP PROCEDURE proc_select;
DROP TABLE t1, t2;
SET max_sp_recursion_depth=default;
#End of 10.1 tests
+#
+# MDEV-11081: CURSOR for query with GROUP BY
+#
+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);
+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;
+|
+CALL p1();
+v_name v_total
+a 3
+v_name v_total
+b 2
+v_name v_total
+c 1
+DROP PROCEDURE p1;
+DROP TABLE t1;
+#
+# MDEV-13346: CURSOR a query with GROUP BY using derived table
+#
+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
+|
+CALL p1();
+DROP PROCEDURE p1;
+#
+# MDEV-15057 Crash when using an unknown identifier as an SP parameter
+#
+CREATE OR REPLACE PROCEDURE p1 (a VARCHAR(10)) SELECT 1;
+CALL p1(a);
+ERROR 42S22: Unknown column 'a' in 'field list'
+drop procedure p1;
+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|
+call p2();
+a
+hello
+call p3();
+ERROR 42S22: Unknown column 'name2' in 'field list'
+drop procedure p1;
+drop procedure p2;
+drop procedure p3;
+#
+# MDEV-15328: MariaDB 10.2.13 Crashes upon CALL PROCEDURE PARAM
+# LAST_INSERT_ID ()
+# (part 1, part 2 is in query_cache.test)
+#
+CREATE PROCEDURE foo ( IN i INT UNSIGNED ) BEGIN END;
+CALL foo( LAST_INSERT_ID() );
+DROP PROCEDURE foo;
diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result
index 40a06d312a0..190f8f78d23 100644
--- a/mysql-test/r/sp_notembedded.result
+++ b/mysql-test/r/sp_notembedded.result
@@ -56,6 +56,7 @@ 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;
@@ -63,6 +64,7 @@ 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;
@@ -154,6 +156,7 @@ 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();
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
@@ -162,6 +165,8 @@ call 15298_2();
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+connection default;
+disconnect con1;
drop user mysqltest_1@localhost;
drop procedure 15298_1;
drop procedure 15298_2;
@@ -171,26 +176,43 @@ create table t1 (value varchar(15));
create procedure p1() update t1 set value='updated' where value='old';
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);
get_lock('b26162',120)
1
+connection rl_acquirer;
select 'rl_acquirer', value from t1 where get_lock('b26162',120);;
+connection rl_wait;
+connection default;
set session low_priority_updates=on;
call p1();;
+connection rl_wait;
+connection rl_contender;
select 'rl_contender', value from t1;
rl_contender value
rl_contender old
rl_contender irrelevant
+connection rl_holder;
select release_lock('b26162');
release_lock('b26162')
1
+connection rl_acquirer;
rl_acquirer value
rl_acquirer old
rl_acquirer irrelevant
+connection default;
+disconnect rl_holder;
+disconnect rl_acquirer;
+disconnect rl_wait;
+disconnect rl_contender;
drop procedure p1;
drop table t1;
set session low_priority_updates=default;
-INSERT INTO mysql.user (Host, User, Password, Select_priv, Insert_priv, Update_priv,
+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,
@@ -203,9 +225,13 @@ VALUES('%', 'mysqltest_1', password(''), 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'N',
Warnings:
Warning 1364 Field 'authentication_string' doesn't have a default value
FLUSH PRIVILEGES;
+connect con1, localhost, mysqltest_1,,;
+connection con1;
CREATE PROCEDURE p1(i INT) BEGIN END;
Warnings:
Warning 1404 Failed to grant EXECUTE and ALTER ROUTINE privileges
+disconnect con1;
+connection default;
DROP PROCEDURE p1;
DELETE FROM mysql.user WHERE User='mysqltest_1';
FLUSH PRIVILEGES;
@@ -215,7 +241,7 @@ FLUSH PRIVILEGES;
SELECT GET_LOCK('Bug44521', 0);
GET_LOCK('Bug44521', 0)
1
-** Connection con1
+connect con1,localhost,root,,;
CREATE PROCEDURE p()
BEGIN
SELECT 1;
@@ -223,7 +249,8 @@ SELECT GET_LOCK('Bug44521', 100);
SELECT 2;
END$
CALL p();;
-** Default connection
+connection default;
+disconnect con1;
SELECT RELEASE_LOCK('Bug44521');
RELEASE_LOCK('Bug44521')
1
@@ -232,13 +259,21 @@ 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,,;
SELECT * FROM v1;;
+connect con2, localhost, root,,;
SELECT * FROM v1;
+connection default;
+connection con1;
ERROR 70100: Query execution was interrupted
+connection con2;
ERROR 70100: Query execution was interrupted
+connection default;
DROP VIEW v1;
DROP TABLE t1;
DROP FUNCTION f1;
+disconnect con1;
+disconnect con2;
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------
@@ -249,11 +284,13 @@ DROP FUNCTION f1;
# The real problem was that server was unable handle properly stored
# functions in databases which names contained dot.
#
+connection default;
DROP DATABASE IF EXISTS `my.db`;
create database `my.db`;
use `my.db`;
CREATE FUNCTION f1(a int) RETURNS INT RETURN a;
-# Create new connection.
+connect addcon, localhost, root,,;
+connection addcon;
USE `my.db`;
SELECT f1(1);
f1(1)
@@ -261,7 +298,8 @@ f1(1)
SELECT `my.db`.f1(2);
`my.db`.f1(2)
2
-# Switching to default connection.
+connection default;
+disconnect addcon;
DROP DATABASE `my.db`;
USE test;
#
@@ -289,11 +327,14 @@ DROP EVENT teste_bug11763507;
# ------------------------------------------------------------------
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;
Grants for foo1@localhost
GRANT USAGE ON *.* TO 'foo1'@'localhost' IDENTIFIED BY PASSWORD '*F3A2A51A9B0F2BE2468926B4132313728C250DBF'
GRANT CREATE ROUTINE ON `test`.* TO 'foo1'@'localhost'
+connection default;
flush privileges;
+connection foo;
show grants;
Grants for foo1@localhost
GRANT USAGE ON *.* TO 'foo1'@'localhost' IDENTIFIED BY PASSWORD '-F3A2A51A9B0F2BE2468926B4132313728C250DBF'
@@ -304,6 +345,8 @@ Grants for foo1@localhost
GRANT USAGE ON *.* TO 'foo1'@'localhost' IDENTIFIED BY PASSWORD '-F3A2A51A9B0F2BE2468926B4132313728C250DBF'
GRANT CREATE ROUTINE ON `test`.* TO 'foo1'@'localhost'
GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `test`.`spfoo` TO 'foo1'@'localhost'
+connection default;
+disconnect foo;
drop procedure spfoo;
drop user foo1@localhost;
set @@global.concurrent_insert= @old_concurrent_insert;
diff --git a/mysql-test/r/sp_sync.result b/mysql-test/r/sp_sync.result
index ba90b009ce4..d6c170712a7 100644
--- a/mysql-test/r/sp_sync.result
+++ b/mysql-test/r/sp_sync.result
@@ -8,7 +8,8 @@ SET DEBUG_SYNC= 'RESET';
# but before a MDL lock is taken. This must be noticed and the
# sp cache flushed so the correct version can be loaded.
#
-# Connection default
+connect con2, localhost, root;
+connection default;
CREATE FUNCTION f1() RETURNS INT RETURN 1;
# Get f1 cached
SELECT f1();
@@ -18,17 +19,18 @@ f1()
SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL before WAIT_FOR changed';
# Sending:
SELECT f1();
-# Connection 2
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR before';
# ... but before f1 is locked, change it.
DROP FUNCTION f1;
CREATE FUNCTION f1() RETURNS INT RETURN 2;
SET DEBUG_SYNC= 'now SIGNAL changed';
-# Connection default
# We should now get '2' and not '1'.
+connection default;
# Reaping: SELECT f1()
f1()
2
+disconnect con2;
DROP FUNCTION f1;
SET DEBUG_SYNC= 'RESET';
#
@@ -38,24 +40,28 @@ SET DEBUG_SYNC= 'RESET';
# to freed memory.
#
DROP FUNCTION IF EXISTS f1;
-# Connection default
+connect con2, localhost, root;
+connect con3, localhost, root;
+connection default;
CREATE FUNCTION f1() RETURNS INT RETURN 0;
-# Connection con2
+connection con2;
SET DEBUG_SYNC= 'after_wait_locked_pname SIGNAL locked WAIT_FOR issued';
# con2 will now have an x-lock on f1
# Sending:
ALTER FUNCTION f1 COMMENT 'comment';
-# Connection default
+connection default;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
# This query will block due to the x-lock on f1 and back-off
SHOW OPEN TABLES WHERE f1()=0;
-# Connection con3
+connection con3;
# Check that the IS query is blocked before releasing the x-lock
SET DEBUG_SYNC= 'now SIGNAL issued';
-# Connection default
+connection default;
# Reaping: ALTER FUNCTION f1 COMMENT 'comment'
DROP FUNCTION f1;
SET DEBUG_SYNC= 'RESET';
+disconnect con2;
+disconnect con3;
#
# Bug #48246 assert in close_thread_table
#
@@ -65,7 +71,7 @@ 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);
-# Connection 2
+connect con2, localhost, root;
CALL p1();
COUNT(f1(a))
2
@@ -76,7 +82,7 @@ SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked_t1 WAIT_FOR go_for_t0
# reset properly causing an eventual assert.
# Sending:
CALL p1();
-# Connection default
+connection default;
SET DEBUG_SYNC= 'now WAIT_FOR locked_t1';
# Issue LOCK TABLES statement which will enter in MDL deadlock
# with CALL statement and as result will cause it to perform
@@ -84,11 +90,12 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked_t1';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL go_for_t0';
LOCK TABLES t0 WRITE, t1 WRITE;
UNLOCK TABLES;
-# Connection 2
+connection con2;
# Reaping: CALL p1()
COUNT(f1(a))
2
-# Connection default
+connection default;
+disconnect con2;
DROP PROCEDURE p1;
DROP FUNCTION f1;
DROP TABLES t0, t1;
@@ -98,10 +105,15 @@ DROP TABLES t0, t1;
DROP SCHEMA IF EXISTS s1;
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';
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 42000: Unknown database 's1'
+connection default;
+disconnect con3;
SET DEBUG_SYNC = 'RESET';
diff --git a/mysql-test/r/sp_trans.result b/mysql-test/r/sp_trans.result
index c76615d644f..ef802279c9c 100644
--- a/mysql-test/r/sp_trans.result
+++ b/mysql-test/r/sp_trans.result
@@ -122,19 +122,19 @@ begin
alter table t1 add k int;
return 1;
end|
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
create function bug10015_7() returns int
begin
start transaction;
return 1;
end|
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
create function bug10015_7() returns int
begin
drop table t1;
return 1;
end|
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
create function bug10015_7() returns int
begin
drop temporary table t1;
@@ -146,7 +146,7 @@ begin
commit;
return 1;
end|
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
create function bug10015_7() returns int
begin
call bug10015_8();
@@ -154,11 +154,11 @@ return 1;
end|
create procedure bug10015_8() alter table t1 add k int|
select *, bug10015_7() from t1|
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
drop procedure bug10015_8|
create procedure bug10015_8() start transaction|
select *, bug10015_7() from t1|
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
drop procedure bug10015_8|
create procedure bug10015_8() drop temporary table if exists t1_temp|
select *, bug10015_7() from t1|
@@ -171,7 +171,7 @@ id bug10015_7()
drop procedure bug10015_8|
create procedure bug10015_8() commit|
select *, bug10015_7() from t1|
-ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
drop procedure bug10015_8|
drop function bug10015_7|
drop table t1, t2|
diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result
index d71748bd9b1..7c881fd5ad5 100644
--- a/mysql-test/r/sql_mode.result
+++ b/mysql-test/r/sql_mode.result
@@ -121,7 +121,7 @@ create table t1 ( min_num dec(6,6) default .000001);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `min_num` decimal(6,6) DEFAULT '0.000001'
+ `min_num` decimal(6,6) DEFAULT 0.000001
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1 ;
set session sql_mode = 'IGNORE_SPACE';
@@ -129,14 +129,14 @@ create table t1 ( min_num dec(6,6) default 0.000001);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `min_num` decimal(6,6) DEFAULT '0.000001'
+ `min_num` decimal(6,6) DEFAULT 0.000001
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1 ;
create table t1 ( min_num dec(6,6) default .000001);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `min_num` decimal(6,6) DEFAULT '0.000001'
+ `min_num` decimal(6,6) DEFAULT 0.000001
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1 ;
set @@SQL_MODE=NULL;
@@ -149,7 +149,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE "t1" (
"f1" int(11) NOT NULL AUTO_INCREMENT,
- "f2" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ "f2" timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY ("f1")
)
set session sql_mode=no_field_options;
@@ -157,7 +157,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL,
- `f2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `f2` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`f1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -497,14 +497,19 @@ xcx
drop table t1;
SET @@SQL_MODE=@OLD_SQL_MODE;
create user mysqltest_32753@localhost;
+connection default;
set @OLD_SQL_MODE=@@SESSION.SQL_MODE;
set session sql_mode='PAD_CHAR_TO_FULL_LENGTH';
flush privileges;
+connect user_32753,localhost,mysqltest_32753,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
select current_user();
current_user()
mysqltest_32753@localhost
+connection default;
set session sql_mode=@OLD_SQL_MODE;
flush privileges;
+disconnect user_32753;
+connection default;
drop user mysqltest_32753@localhost;
SET @org_mode=@@sql_mode;
SET @@sql_mode='traditional';
@@ -737,3 +742,41 @@ DROP FUNCTION test_function;
SET @@sql_mode= @org_mode;
#End of Test for Bug#12601974
+#
+# MDEV-11848 Automatic statement repreparation changes query semantics
+#
+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;
+a b
+1 NULL
+1 NULL
+1 NULL
+DROP TABLE t1;
+#
+# MDEV-12390 Wrong error line numbers reported with sql_mode=IGNORE_SPACE
+#
+SET sql_mode=IGNORE_SPACE;
+CREATE PROCEDURE p1()
+BEGIN
+SELECT 1+1;
+syntax error;
+END;
+$$
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'error;
+END' at line 4
+SET sql_mode=DEFAULT;
+CREATE PROCEDURE p1()
+BEGIN
+SELECT 1+1;
+syntax error;
+END;
+$$
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'error;
+END' at line 4
diff --git a/mysql-test/r/ssl-big.result b/mysql-test/r/ssl-big.result
index 39c4f34e46c..54c61507ade 100644
--- a/mysql-test/r/ssl-big.result
+++ b/mysql-test/r/ssl-big.result
@@ -1,3 +1,8 @@
DROP TABLE IF EXISTS t1, t2;
+connect ssl_con,localhost,root,,,,,SSL;
create table t1 (a int);
+disconnect ssl_con;
+connect ssl_con,localhost,root,,,,,SSL;
drop table t1;
+connection default;
+disconnect ssl_con;
diff --git a/mysql-test/r/ssl.result b/mysql-test/r/ssl.result
index 05ba7519781..5de9e5174d8 100644
--- a/mysql-test/r/ssl.result
+++ b/mysql-test/r/ssl.result
@@ -1,3 +1,4 @@
+connect ssl_con,localhost,root,,,,,SSL;
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
have_ssl
1
@@ -610,7 +611,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
+1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
1 SIMPLE t3 ref period period 4 test.t1.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
id select_type table type possible_keys key key_len ref rows Extra
@@ -1517,7 +1518,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
Warnings:
-Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> ''))
+Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> ''
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
@@ -2172,6 +2173,8 @@ NULL
select 'still connected?';
still connected?
still connected?
+connection default;
+disconnect ssl_con;
create user mysqltest_1@localhost;
grant usage on mysqltest.* to mysqltest_1@localhost require cipher "AES256-SHA";
Variable_name Value
diff --git a/mysql-test/r/ssl_8k_key.result b/mysql-test/r/ssl_8k_key.result
index b33a1d2854f..ff9d0cce9dc 100644
--- a/mysql-test/r/ssl_8k_key.result
+++ b/mysql-test/r/ssl_8k_key.result
@@ -1,2 +1,2 @@
-Variable_name Value
-Ssl_cipher DHE-RSA-AES256-SHA
+have_ssl
+1
diff --git a/mysql-test/r/ssl_ca.result b/mysql-test/r/ssl_ca.result
index 83a98902581..afffe4e4dff 100644
--- a/mysql-test/r/ssl_ca.result
+++ b/mysql-test/r/ssl_ca.result
@@ -2,23 +2,7 @@
# Bug#21920657: SSL-CA FAILS SILENTLY IF THE PATH CANNOT BE FOUND
#
# try to connect with wrong '--ssl-ca' path : should fail
-ERROR 2026 (HY000): SSL connection error: SSL_CTX_set_default_verify_paths failed
+ERROR 2026 (HY000): SSL connection error: xxxx
# try to connect with correct '--ssl-ca' path : should connect
have_ssl
1
-#
-# Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY
-# PATH SUBSTITUTION
-#
-# try to connect with '--ssl-ca' option using tilde home directoy
-# path substitution : should connect
-have_ssl
-1
-# try to connect with '--ssl-key' option using tilde home directoy
-# path substitution : should connect
-have_ssl
-1
-# try to connect with '--ssl-cert' option using tilde home directoy
-# path substitution : should connect
-have_ssl
-1
diff --git a/mysql-test/r/ssl_cipher.result b/mysql-test/r/ssl_cipher.result
index 78081300b5b..79998dfca80 100644
--- a/mysql-test/r/ssl_cipher.result
+++ b/mysql-test/r/ssl_cipher.result
@@ -1,9 +1,12 @@
#
# BUG#11760210 - SSL_CIPHER_LIST NOT SET OR RETURNED FOR "SHOW STATUS LIKE 'SSL_CIPHER_LIST'"
#
+connect ssl_con,localhost,root,,,,,SSL;
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
Ssl_cipher AES128-SHA
SHOW STATUS LIKE 'Ssl_cipher_list';
Variable_name Value
Ssl_cipher_list AES128-SHA
+connection default;
+disconnect ssl_con;
diff --git a/mysql-test/r/ssl_compress.result b/mysql-test/r/ssl_compress.result
index d6a65c2b06d..4e37cc68a24 100644
--- a/mysql-test/r/ssl_compress.result
+++ b/mysql-test/r/ssl_compress.result
@@ -1,3 +1,4 @@
+connect ssl_compress_con,localhost,root,,,,,SSL COMPRESS;
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
have_ssl
1
@@ -607,7 +608,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
+1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
1 SIMPLE t3 ref period period 4 test.t1.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
id select_type table type possible_keys key key_len ref rows Extra
@@ -1514,7 +1515,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
Warnings:
-Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> ''))
+Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> ''
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
@@ -2166,3 +2167,5 @@ have_ssl
SHOW STATUS LIKE 'Compression';
Variable_name Value
Compression ON
+connection default;
+disconnect ssl_compress_con;
diff --git a/mysql-test/r/ssl_timeout-9836.result b/mysql-test/r/ssl_timeout-9836.result
index bc2e19e1475..7e21a8a435b 100644
--- a/mysql-test/r/ssl_timeout-9836.result
+++ b/mysql-test/r/ssl_timeout-9836.result
@@ -1,3 +1,4 @@
+connect con1,localhost,root,,,,,SSL;
SET @@net_read_timeout=1;
SELECT 1;
1
@@ -5,3 +6,4 @@ SELECT 1;
SELECT 1;
1
1
+disconnect con1;
diff --git a/mysql-test/r/ssl_timeout.result b/mysql-test/r/ssl_timeout.result
index d9ef0f7a16f..3c94a9927da 100644
--- a/mysql-test/r/ssl_timeout.result
+++ b/mysql-test/r/ssl_timeout.result
@@ -1,7 +1,10 @@
# connect with read timeout so SLEEP() should timeout
+connect ssl_con,localhost,root,,,,,SSL read_timeout=5;
# Check ssl turned on
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
have_ssl
1
SELECT SLEEP(600);
ERROR HY000: Lost connection to MySQL server during query
+connection default;
+disconnect ssl_con;
diff --git a/mysql-test/r/stat_tables_innodb.result b/mysql-test/r/stat_tables_innodb.result
index 0e866755532..42443bfcb72 100644
--- a/mysql-test/r/stat_tables_innodb.result
+++ b/mysql-test/r/stat_tables_innodb.result
@@ -67,7 +67,7 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01'
group by n_name
order by revenue desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 211 Using where; Using temporary; Using filesort
+1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 213 Using where; Using temporary; Using filesort
1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where
1 SIMPLE nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1
1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.customer.c_nationkey 1 Using index
@@ -198,7 +198,7 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01'
group by n_name
order by revenue desc;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 211 Using where; Using temporary; Using filesort
+1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 213 Using where; Using temporary; Using filesort
1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where
1 SIMPLE nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1
1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.customer.c_nationkey 1 Using index
diff --git a/mysql-test/r/stat_tables_innodb_debug.result b/mysql-test/r/stat_tables_innodb_debug.result
new file mode 100644
index 00000000000..e0c4c78cd29
--- /dev/null
+++ b/mysql-test/r/stat_tables_innodb_debug.result
@@ -0,0 +1,25 @@
+#
+# MDEV-7901: re-implement analyze table for low impact
+#
+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';
+analyze table t1 persistent for all;
+connect con1, localhost, root,,;
+connection con1;
+SET DEBUG_SYNC= 'now WAIT_FOR analyzing';
+select count(*) from t1;
+count(*)
+10
+insert into t1 values (333,333,333);
+update t1 set a=1;
+SET DEBUG_SYNC= 'now SIGNAL written';
+connection default;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+select count(*) from t1;
+count(*)
+11
+set debug_sync='RESET';
+drop table t1;
diff --git a/mysql-test/r/stat_tables_myisam_debug.result b/mysql-test/r/stat_tables_myisam_debug.result
new file mode 100644
index 00000000000..ae9a001bdfa
--- /dev/null
+++ b/mysql-test/r/stat_tables_myisam_debug.result
@@ -0,0 +1,24 @@
+#
+# MDEV-7901: re-implement analyze table for low impact
+#
+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';
+analyze table t1 persistent for all;
+connect con1, localhost, root,,;
+connection con1;
+SET DEBUG_SYNC= 'now WAIT_FOR analyzing';
+select count(*) from t1;
+count(*)
+10
+insert into t1 values (333,333,333);
+SET DEBUG_SYNC= 'now SIGNAL written';
+connection default;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status Table is already up to date
+select count(*) from t1;
+count(*)
+11
+set debug_sync='RESET';
+drop table t1;
diff --git a/mysql-test/r/stat_tables_par.result b/mysql-test/r/stat_tables_par.result
index aaebb929c9d..09ee2bbf16a 100644
--- a/mysql-test/r/stat_tables_par.result
+++ b/mysql-test/r/stat_tables_par.result
@@ -54,6 +54,9 @@ and l_discount between 0.06 - 0.01 and 0.06 + 0.01
and l_quantity < 24;
revenue
77949.9186
+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;
@@ -64,6 +67,7 @@ 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 ;
+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;
@@ -74,11 +78,16 @@ 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;
+connection con1;
revenue
77949.9186
+connection con2;
revenue
77949.9186
+connection default;
set use_stat_tables='preferably';
+disconnect con1;
+disconnect con2;
set debug_sync='RESET';
select * from mysql.index_stats where table_name='lineitem' order by index_name;
db_name table_name index_name prefix_arity avg_frequency
@@ -137,16 +146,25 @@ dbt3_s001 lineitem i_l_partkey 1 30.0250
dbt3_s001 lineitem i_l_suppkey 1 600.5000
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
+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';
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';
analyze table lineitem persistent for columns() indexes (i_l_receiptdate);
+connection con1;
+connection con2;
+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;
db_name table_name index_name prefix_arity avg_frequency
@@ -178,14 +196,22 @@ dbt3_s001 lineitem i_l_suppkey 1 600.5000
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
set debug_sync='RESET';
+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';
analyze table lineitem persistent for all;
+connection con2;
set debug_sync='now WAIT_FOR parked';
use dbt3_s001;
set use_stat_tables='never';
set debug_sync='now SIGNAL finish';
+connection con1;
+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;
@@ -205,16 +231,25 @@ dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
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_after_thr_lock SIGNAL go2 EXECUTE 2';
+set debug_sync='thr_multi_lock_before_thr_lock SIGNAL go2 EXECUTE 3';
use dbt3_s001;
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;
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;
+connection con2;
db_name table_name index_name prefix_arity avg_frequency l_orderkey l_partkey l_suppkey l_linenumber l_quantity l_extendedprice l_discount l_tax l_returnflag l_linestatus l_shipDATE l_commitDATE l_receiptDATE l_shipinstruct l_shipmode l_comment
dbt3_s001 lineitem i_l_shipdate 1 2.6500 1 68 9 2 36 34850.16 0.09 0.06 N O 1996-04-12 1996-02-28 1996-04-20 TAKE BACK RETURN MAIL slyly bold pinto beans detect s
+connection default;
+disconnect con1;
+disconnect con2;
set debug_sync='RESET';
set global use_stat_tables=@save_global_use_stat_tables;
DROP DATABASE dbt3_s001;
@@ -230,13 +265,18 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SET debug_sync='after_open_table_ignore_flush WAIT_FOR go';
select * from information_schema.statistics where table_schema='test';
+connect con1, localhost, root;
+connection con1;
select * from t1;
a b
1 1
2 2
SET DEBUG_SYNC= "now SIGNAL go";
+connection default;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
def test t1 1 test a 1 a A 2 NULL NULL YES BTREE
+connection default;
+disconnect con1;
set debug_sync='RESET';
drop table t1;
set global use_stat_tables=@save_global_use_stat_tables;
diff --git a/mysql-test/r/stat_tables_par_innodb.result b/mysql-test/r/stat_tables_par_innodb.result
index e08392678c5..54579aff990 100644
--- a/mysql-test/r/stat_tables_par_innodb.result
+++ b/mysql-test/r/stat_tables_par_innodb.result
@@ -57,6 +57,9 @@ and l_discount between 0.06 - 0.01 and 0.06 + 0.01
and l_quantity < 24;
revenue
77949.9186
+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;
@@ -67,6 +70,7 @@ 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 ;
+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;
@@ -77,11 +81,16 @@ 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;
+connection con1;
revenue
77949.9186
+connection con2;
revenue
77949.9186
+connection default;
set use_stat_tables='preferably';
+disconnect con1;
+disconnect con2;
set debug_sync='RESET';
select * from mysql.index_stats where table_name='lineitem' order by index_name;
db_name table_name index_name prefix_arity avg_frequency
@@ -140,16 +149,25 @@ dbt3_s001 lineitem i_l_partkey 1 30.0250
dbt3_s001 lineitem i_l_suppkey 1 600.5000
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
+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';
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';
analyze table lineitem persistent for columns() indexes (i_l_receiptdate);
+connection con1;
+connection con2;
+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;
db_name table_name index_name prefix_arity avg_frequency
@@ -189,10 +207,14 @@ dbt3_s001 lineitem i_l_suppkey 1 600.5000
dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250
dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786
set debug_sync='RESET';
+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';
analyze table lineitem persistent for all;
+connection con2;
set debug_sync='now WAIT_FOR parked';
use dbt3_s001;
set use_stat_tables='never';
@@ -203,6 +225,10 @@ delete from lineitem where l_orderkey=1 and l_partkey=156;
select * from lineitem where l_orderkey=1 and l_partkey=156;
l_orderkey l_partkey l_suppkey l_linenumber l_quantity l_extendedprice l_discount l_tax l_returnflag l_linestatus l_shipDATE l_commitDATE l_receiptDATE l_shipinstruct l_shipmode l_comment
set debug_sync='now SIGNAL finish';
+connection con1;
+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;
@@ -236,18 +262,27 @@ dbt3_s001 lineitem i_l_suppkey_partkey 4 1.0000
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_after_thr_lock SIGNAL go2 EXECUTE 2';
+set debug_sync='thr_multi_lock_before_thr_lock SIGNAL go2 EXECUTE 3';
use dbt3_s001;
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;
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;
+connection con2;
db_name table_name index_name prefix_arity avg_frequency l_orderkey l_partkey l_suppkey l_linenumber l_quantity l_extendedprice l_discount l_tax l_returnflag l_linestatus l_shipDATE l_commitDATE l_receiptDATE l_shipinstruct l_shipmode l_comment
dbt3_s001 lineitem i_l_shipdate 1 2.6496 1 68 9 2 36 34850.16 0.09 0.06 N O 1996-04-12 1996-02-28 1996-04-20 TAKE BACK RETURN MAIL slyly bold pinto beans detect s
dbt3_s001 lineitem i_l_shipdate 2 1.0149 1 68 9 2 36 34850.16 0.09 0.06 N O 1996-04-12 1996-02-28 1996-04-20 TAKE BACK RETURN MAIL slyly bold pinto beans detect s
dbt3_s001 lineitem i_l_shipdate 3 1.0000 1 68 9 2 36 34850.16 0.09 0.06 N O 1996-04-12 1996-02-28 1996-04-20 TAKE BACK RETURN MAIL slyly bold pinto beans detect s
+connection default;
+disconnect con1;
+disconnect con2;
set debug_sync='RESET';
set global use_stat_tables=@save_global_use_stat_tables;
DROP DATABASE dbt3_s001;
@@ -263,13 +298,18 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SET debug_sync='after_open_table_ignore_flush WAIT_FOR go';
select * from information_schema.statistics where table_schema='test';
+connect con1, localhost, root;
+connection con1;
select * from t1;
a b
1 1
2 2
SET DEBUG_SYNC= "now SIGNAL go";
+connection default;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
def test t1 1 test a 1 a A 2 NULL NULL YES BTREE
+connection default;
+disconnect con1;
set debug_sync='RESET';
drop table t1;
set global use_stat_tables=@save_global_use_stat_tables;
diff --git a/mysql-test/r/stat_tables_rbr.result b/mysql-test/r/stat_tables_rbr.result
index 35e74e29b08..7ae7ade4398 100644
--- a/mysql-test/r/stat_tables_rbr.result
+++ b/mysql-test/r/stat_tables_rbr.result
@@ -2,6 +2,7 @@
# Bug mdev-463: assertion failure when running ANALYZE with RBR on
#
SET GLOBAL use_stat_tables = PREFERABLY;
+connect con1,localhost,root,,;
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
@@ -9,6 +10,8 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
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;
diff --git a/mysql-test/r/stat_tables_repl.result b/mysql-test/r/stat_tables_repl.result
index 132e5f7beae..43c9fa554c9 100644
--- a/mysql-test/r/stat_tables_repl.result
+++ b/mysql-test/r/stat_tables_repl.result
@@ -11,6 +11,8 @@ Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP TABLE t1;
+connection slave;
+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;
@@ -18,6 +20,8 @@ Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
DROP INDEX idx1 ON t1;
+connection slave;
+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);
@@ -26,6 +30,8 @@ Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
ALTER TABLE t1 DROP COLUMN b;
+connection slave;
+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);
@@ -34,6 +40,8 @@ Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
ALTER TABLE t1 RENAME to s;
+connection slave;
+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);
@@ -42,5 +50,7 @@ Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
ALTER TABLE t1 CHANGE COLUMN b c int ;
+connection slave;
+connection master;
DROP TABLE t1;
include/rpl_end.inc
diff --git a/mysql-test/r/statistics.result b/mysql-test/r/statistics.result
index d5a112cc779..8f87b166e8d 100644
--- a/mysql-test/r/statistics.result
+++ b/mysql-test/r/statistics.result
@@ -413,11 +413,11 @@ t1 CREATE TABLE `t1` (
SELECT * FROM mysql.column_stats;
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL
-test t1 x vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL
test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL
test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL
-test t1 y 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL
test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL
+test t1 x vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL
+test t1 y 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL
ALTER TABLE t1 CHANGE COLUMN x b varchar(32),
CHANGE COLUMN y e double;
SHOW CREATE TABLE t1;
@@ -465,11 +465,11 @@ test s1 40
SELECT * FROM mysql.column_stats;
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
test s1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL
-test s1 x vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL
test s1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL
test s1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL
test s1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL
test s1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL
+test s1 x vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL
SELECT * FROM mysql.index_stats;
db_name table_name index_name prefix_arity avg_frequency
test s1 PRIMARY 1 1.0000
@@ -592,14 +592,14 @@ test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL
SELECT * FROM mysql.index_stats;
db_name table_name index_name prefix_arity avg_frequency
test t1 PRIMARY 1 1.0000
-test t1 idx4 3 1.1304
-test t1 idx4 2 1.6875
+test t1 idx1 1 6.4000
+test t1 idx1 2 1.6875
test t1 idx2 1 7.0000
test t1 idx2 2 2.3846
test t1 idx3 1 8.5000
test t1 idx4 1 6.2000
-test t1 idx1 2 1.6875
-test t1 idx1 1 6.4000
+test t1 idx4 2 1.6875
+test t1 idx4 3 1.1304
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';
@@ -681,14 +681,14 @@ test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL
SELECT * FROM mysql.index_stats;
db_name table_name index_name prefix_arity avg_frequency
test t1 PRIMARY 1 1.0000
-test t1 idx4 3 1.1304
+test t1 idx1 1 6.4000
+test t1 idx1 2 1.6875
test t1 idx2 1 7.0000
test t1 idx2 2 2.3846
test t1 idx3 1 8.5000
-test t1 idx4 2 1.6875
test t1 idx4 1 6.2000
-test t1 idx1 2 1.6875
-test t1 idx1 1 6.4000
+test t1 idx4 2 1.6875
+test t1 idx4 3 1.1304
ALTER TABLE t1 DROP COLUMN b;
SHOW CREATE TABLE t1;
Table Create Table
@@ -793,11 +793,11 @@ test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL
SELECT * FROM mysql.index_stats;
db_name table_name index_name prefix_arity avg_frequency
test t1 PRIMARY 1 1.0000
-test t1 idx2 1 7.0000
-test t1 idx1 2 NULL
test t1 idx1 1 NULL
-test t1 idx3 1 8.5000
+test t1 idx1 2 NULL
+test t1 idx2 1 7.0000
test t1 idx2 2 2.3846
+test t1 idx3 1 8.5000
test t1 idx4 1 6.2000
test t1 idx4 2 NULL
test t1 idx4 3 NULL
@@ -817,11 +817,11 @@ test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL
SELECT * FROM mysql.index_stats;
db_name table_name index_name prefix_arity avg_frequency
test t1 PRIMARY 1 1.0000
-test t1 idx2 1 7.0000
-test t1 idx1 2 1.6875
test t1 idx1 1 6.4000
-test t1 idx3 1 8.5000
+test t1 idx1 2 1.6875
+test t1 idx2 1 7.0000
test t1 idx2 2 2.3846
+test t1 idx3 1 8.5000
test t1 idx4 1 6.2000
test t1 idx4 2 1.6875
test t1 idx4 3 1.1304
@@ -894,13 +894,13 @@ test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL
SELECT * FROM mysql.index_stats;
db_name table_name index_name prefix_arity avg_frequency
test t1 PRIMARY 1 1.0000
+test t1 idx1 1 6.4000
+test t1 idx1 2 1.6875
+test t1 idx2 1 7.0000
+test t1 idx2 2 2.3846
+test t1 idx3 1 8.5000
test t1 idx4 1 6.2000
test t1 idx4 2 1.6875
-test t1 idx3 1 8.5000
-test t1 idx2 2 2.3846
-test t1 idx2 1 7.0000
-test t1 idx1 2 1.6875
-test t1 idx1 1 6.4000
test t1 idx4 3 1.1304
DELETE FROM mysql.table_stats;
DELETE FROM mysql.column_stats;
@@ -925,9 +925,9 @@ db_name table_name cardinality
test t1 40
SELECT * FROM mysql.column_stats;
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
+test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL
test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL
test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL
-test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL
SELECT * FROM mysql.index_stats;
db_name table_name index_name prefix_arity avg_frequency
test t1 idx2 1 7.0000
@@ -949,12 +949,12 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
SELECT * FROM mysql.index_stats;
db_name table_name index_name prefix_arity avg_frequency
+test t1 PRIMARY 1 1.0000
test t1 idx2 1 7.0000
test t1 idx2 2 2.3846
test t1 idx4 1 6.2000
test t1 idx4 2 1.6875
test t1 idx4 3 1.1304
-test t1 PRIMARY 1 1.0000
DELETE FROM mysql.table_stats;
DELETE FROM mysql.column_stats;
DELETE FROM mysql.index_stats;
@@ -968,19 +968,19 @@ test t1 40
SELECT * FROM mysql.column_stats;
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL
+test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL
test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL
test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL
test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL
test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL
-test t1 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 0 NULL NULL
SELECT * FROM mysql.index_stats;
db_name table_name index_name prefix_arity avg_frequency
test t1 PRIMARY 1 1.0000
-test t1 idx3 1 8.5000
test t1 idx1 1 6.4000
test t1 idx1 2 1.6875
test t1 idx2 1 7.0000
test t1 idx2 2 2.3846
+test t1 idx3 1 8.5000
test t1 idx4 1 6.2000
test t1 idx4 2 1.6875
test t1 idx4 3 1.1304
@@ -996,7 +996,7 @@ SELECT * FROM mysql.table_stats;
db_name table_name cardinality
test t1 40
test t2 40
-SELECT * FROM mysql.column_stats ORDER BY column_name;
+SELECT * FROM mysql.column_stats ORDER BY column_name, table_name;
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL
test t2 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL
@@ -1162,7 +1162,7 @@ test t2 idx4 1 6.2000
test t2 idx4 2 1.7222
test t2 idx4 3 1.1154
test t2 idx4 4 1.0000
-ALTER TABLE t2 DROP COLUMN b;
+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;
db_name table_name index_name prefix_arity avg_frequency
test t2 idx2 1 7.0000
@@ -1200,15 +1200,15 @@ test t2 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL
test t2 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL
SELECT * FROM mysql.index_stats;
db_name table_name index_name prefix_arity avg_frequency
-test t2 idx3 1 8.5000
+test t2 PRIMARY 1 1.0000
test t2 idx2 1 7.0000
test t2 idx2 2 2.3846
test t2 idx2 3 1.0000
+test t2 idx3 1 8.5000
+test t2 idx3 2 1.0000
test t2 idx4 1 6.2000
test t2 idx4 2 2.2308
test t2 idx4 3 1.0000
-test t2 idx3 2 1.0000
-test t2 PRIMARY 1 1.0000
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
@@ -1216,36 +1216,36 @@ test.t1 analyze Warning Engine-independent statistics are not collected for colu
test.t1 analyze status OK
SELECT * FROM mysql.column_stats;
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
-test t2 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL
-test t2 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL
-test t2 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL
-test t2 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL
-test t2 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL
test t1 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL
test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL
test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL
test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL
test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL
+test t2 a 0 49 0.0000 4.0000 1.0000 0 NULL NULL
+test t2 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL
+test t2 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL
+test t2 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL
+test t2 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL
SELECT * FROM mysql.index_stats;
db_name table_name index_name prefix_arity avg_frequency
+test t1 PRIMARY 1 1.0000
+test t1 idx1 1 NULL
+test t1 idx1 2 NULL
test t1 idx2 1 7.0000
-test t2 idx3 1 8.5000
+test t1 idx2 2 2.3846
test t1 idx3 1 8.5000
-test t1 PRIMARY 1 1.0000
+test t1 idx4 1 6.2000
+test t1 idx4 2 NULL
+test t1 idx4 3 NULL
+test t2 PRIMARY 1 1.0000
test t2 idx2 1 7.0000
test t2 idx2 2 2.3846
test t2 idx2 3 1.0000
+test t2 idx3 1 8.5000
+test t2 idx3 2 1.0000
test t2 idx4 1 6.2000
test t2 idx4 2 2.2308
test t2 idx4 3 1.0000
-test t2 idx3 2 1.0000
-test t2 PRIMARY 1 1.0000
-test t1 idx2 2 2.3846
-test t1 idx1 1 NULL
-test t1 idx1 2 NULL
-test t1 idx4 1 6.2000
-test t1 idx4 2 NULL
-test t1 idx4 3 NULL
DELETE FROM mysql.table_stats;
DELETE FROM mysql.column_stats;
DELETE FROM mysql.index_stats;
@@ -1280,11 +1280,11 @@ test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL
SELECT * FROM mysql.index_stats;
db_name table_name index_name prefix_arity avg_frequency
test t1 PRIMARY 1 1.0000
-test t1 idx3 1 8.5000
-test t1 idx2 1 7.0000
-test t1 idx2 2 2.3846
test t1 idx1 1 NULL
test t1 idx1 2 NULL
+test t1 idx2 1 7.0000
+test t1 idx2 2 2.3846
+test t1 idx3 1 8.5000
test t1 idx4 1 6.2000
test t1 idx4 2 NULL
test t1 idx4 3 NULL
@@ -1347,22 +1347,22 @@ ANALYZE TABLE Country, City, CountryLanguage;
SELECT UPPER(db_name), UPPER(table_name), cardinality
FROM mysql.table_stats;
UPPER(db_name) UPPER(table_name) cardinality
-WORLD COUNTRY 239
WORLD CITY 4079
+WORLD COUNTRY 239
WORLD COUNTRYLANGUAGE 984
SELECT UPPER(db_name), UPPER(table_name),
column_name, min_value, max_value, nulls_ratio, avg_length, avg_frequency
FROM mysql.column_stats;
UPPER(db_name) UPPER(table_name) column_name min_value max_value nulls_ratio avg_length avg_frequency
-WORLD COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000
-WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000
-WORLD COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042
-WORLD COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575
-WORLD COUNTRY Capital 1 4074 0.0293 4.0000 1.0000
+WORLD CITY Country ABW ZWE 0.0000 3.0000 17.5819
WORLD CITY ID 1 4079 0.0000 4.0000 1.0000
WORLD CITY Name A Coruña (La Coruña) Ürgenc 0.0000 8.6416 1.0195
-WORLD CITY Country ABW ZWE 0.0000 3.0000 17.5819
WORLD CITY Population 42 10500000 0.0000 4.0000 1.0467
+WORLD COUNTRY Capital 1 4074 0.0293 4.0000 1.0000
+WORLD COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000
+WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000
+WORLD COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575
+WORLD COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042
WORLD COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232
WORLD COUNTRYLANGUAGE Language Abhyasi [South]Mande 0.0000 7.1778 2.1532
WORLD COUNTRYLANGUAGE Percentage 0.0 99.9 0.0000 4.0000 2.7640
@@ -1370,11 +1370,11 @@ SELECT UPPER(db_name), UPPER(table_name),
index_name, prefix_arity, avg_frequency
FROM mysql.index_stats;
UPPER(db_name) UPPER(table_name) index_name prefix_arity avg_frequency
-WORLD COUNTRY PRIMARY 1 1.0000
-WORLD COUNTRY Name 1 1.0000
+WORLD CITY Country 1 17.5819
WORLD CITY PRIMARY 1 1.0000
WORLD CITY Population 1 1.0467
-WORLD CITY Country 1 17.5819
+WORLD COUNTRY Name 1 1.0000
+WORLD COUNTRY PRIMARY 1 1.0000
WORLD COUNTRYLANGUAGE PRIMARY 1 4.2232
WORLD COUNTRYLANGUAGE PRIMARY 2 1.0000
WORLD COUNTRYLANGUAGE Percentage 1 2.7640
@@ -1415,37 +1415,37 @@ ANALYZE TABLE Country, City, CountryLanguage;
SELECT UPPER(db_name), UPPER(table_name), cardinality
FROM mysql.table_stats;
UPPER(db_name) UPPER(table_name) cardinality
-WORLD COUNTRY 239
WORLD CITY 4079
+WORLD COUNTRY 239
WORLD COUNTRYLANGUAGE 984
-WORLD_INNODB COUNTRY 239
WORLD_INNODB CITY 4079
+WORLD_INNODB COUNTRY 239
WORLD_INNODB COUNTRYLANGUAGE 984
SELECT UPPER(db_name), UPPER(table_name),
column_name, min_value, max_value, nulls_ratio, avg_length, avg_frequency
FROM mysql.column_stats;
UPPER(db_name) UPPER(table_name) column_name min_value max_value nulls_ratio avg_length avg_frequency
-WORLD COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000
-WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000
-WORLD COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042
-WORLD COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575
-WORLD COUNTRY Capital 1 4074 0.0293 4.0000 1.0000
+WORLD CITY Country ABW ZWE 0.0000 3.0000 17.5819
WORLD CITY ID 1 4079 0.0000 4.0000 1.0000
WORLD CITY Name A Coruña (La Coruña) Ürgenc 0.0000 8.6416 1.0195
-WORLD CITY Country ABW ZWE 0.0000 3.0000 17.5819
WORLD CITY Population 42 10500000 0.0000 4.0000 1.0467
+WORLD COUNTRY Capital 1 4074 0.0293 4.0000 1.0000
+WORLD COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000
+WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000
+WORLD COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575
+WORLD COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042
WORLD COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232
WORLD COUNTRYLANGUAGE Language Abhyasi [South]Mande 0.0000 7.1778 2.1532
WORLD COUNTRYLANGUAGE Percentage 0.0 99.9 0.0000 4.0000 2.7640
-WORLD_INNODB COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000
-WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000
-WORLD_INNODB COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042
-WORLD_INNODB COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575
-WORLD_INNODB COUNTRY Capital 1 4074 0.0293 4.0000 1.0000
+WORLD_INNODB CITY Country ABW ZWE 0.0000 3.0000 17.5819
WORLD_INNODB CITY ID 1 4079 0.0000 4.0000 1.0000
WORLD_INNODB CITY Name A Coruña (La Coruña) Ürgenc 0.0000 8.6416 1.0195
-WORLD_INNODB CITY Country ABW ZWE 0.0000 3.0000 17.5819
WORLD_INNODB CITY Population 42 10500000 0.0000 4.0000 1.0467
+WORLD_INNODB COUNTRY Capital 1 4074 0.0293 4.0000 1.0000
+WORLD_INNODB COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000
+WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000
+WORLD_INNODB COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575
+WORLD_INNODB COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042
WORLD_INNODB COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232
WORLD_INNODB COUNTRYLANGUAGE Language Abhyasi [South]Mande 0.0000 7.1778 2.1532
WORLD_INNODB COUNTRYLANGUAGE Percentage 0.0 99.9 0.0000 4.0000 2.7640
@@ -1453,19 +1453,19 @@ SELECT UPPER(db_name), UPPER(table_name),
index_name, prefix_arity, avg_frequency
FROM mysql.index_stats;
UPPER(db_name) UPPER(table_name) index_name prefix_arity avg_frequency
-WORLD COUNTRY PRIMARY 1 1.0000
-WORLD COUNTRY Name 1 1.0000
+WORLD CITY Country 1 17.5819
WORLD CITY PRIMARY 1 1.0000
WORLD CITY Population 1 1.0467
-WORLD CITY Country 1 17.5819
+WORLD COUNTRY Name 1 1.0000
+WORLD COUNTRY PRIMARY 1 1.0000
WORLD COUNTRYLANGUAGE PRIMARY 1 4.2232
WORLD COUNTRYLANGUAGE PRIMARY 2 1.0000
WORLD COUNTRYLANGUAGE Percentage 1 2.7640
-WORLD_INNODB COUNTRY PRIMARY 1 1.0000
-WORLD_INNODB COUNTRY Name 1 1.0000
+WORLD_INNODB CITY Country 1 17.5819
WORLD_INNODB CITY PRIMARY 1 1.0000
WORLD_INNODB CITY Population 1 1.0467
-WORLD_INNODB CITY Country 1 17.5819
+WORLD_INNODB COUNTRY Name 1 1.0000
+WORLD_INNODB COUNTRY PRIMARY 1 1.0000
WORLD_INNODB COUNTRYLANGUAGE PRIMARY 1 4.2232
WORLD_INNODB COUNTRYLANGUAGE PRIMARY 2 1.0000
WORLD_INNODB COUNTRYLANGUAGE Percentage 1 2.7640
@@ -1511,22 +1511,22 @@ DROP DATABASE world;
SELECT UPPER(db_name), UPPER(table_name), cardinality
FROM mysql.table_stats;
UPPER(db_name) UPPER(table_name) cardinality
-WORLD_INNODB COUNTRY 239
WORLD_INNODB CITY 4079
+WORLD_INNODB COUNTRY 239
WORLD_INNODB COUNTRYLANGUAGE 984
SELECT UPPER(db_name), UPPER(table_name),
column_name, min_value, max_value, nulls_ratio, avg_length, avg_frequency
FROM mysql.column_stats;
UPPER(db_name) UPPER(table_name) column_name min_value max_value nulls_ratio avg_length avg_frequency
-WORLD_INNODB COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000
-WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000
-WORLD_INNODB COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042
-WORLD_INNODB COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575
-WORLD_INNODB COUNTRY Capital 1 4074 0.0293 4.0000 1.0000
+WORLD_INNODB CITY Country ABW ZWE 0.0000 3.0000 17.5819
WORLD_INNODB CITY ID 1 4079 0.0000 4.0000 1.0000
WORLD_INNODB CITY Name A Coruña (La Coruña) Ürgenc 0.0000 8.6416 1.0195
-WORLD_INNODB CITY Country ABW ZWE 0.0000 3.0000 17.5819
WORLD_INNODB CITY Population 42 10500000 0.0000 4.0000 1.0467
+WORLD_INNODB COUNTRY Capital 1 4074 0.0293 4.0000 1.0000
+WORLD_INNODB COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000
+WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000
+WORLD_INNODB COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575
+WORLD_INNODB COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042
WORLD_INNODB COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232
WORLD_INNODB COUNTRYLANGUAGE Language Abhyasi [South]Mande 0.0000 7.1778 2.1532
WORLD_INNODB COUNTRYLANGUAGE Percentage 0.0 99.9 0.0000 4.0000 2.7640
@@ -1534,11 +1534,11 @@ SELECT UPPER(db_name), UPPER(table_name),
index_name, prefix_arity, avg_frequency
FROM mysql.index_stats;
UPPER(db_name) UPPER(table_name) index_name prefix_arity avg_frequency
-WORLD_INNODB COUNTRY PRIMARY 1 1.0000
-WORLD_INNODB COUNTRY Name 1 1.0000
+WORLD_INNODB CITY Country 1 17.5819
WORLD_INNODB CITY PRIMARY 1 1.0000
WORLD_INNODB CITY Population 1 1.0467
-WORLD_INNODB CITY Country 1 17.5819
+WORLD_INNODB COUNTRY Name 1 1.0000
+WORLD_INNODB COUNTRY PRIMARY 1 1.0000
WORLD_INNODB COUNTRYLANGUAGE PRIMARY 1 4.2232
WORLD_INNODB COUNTRYLANGUAGE PRIMARY 2 1.0000
WORLD_INNODB COUNTRYLANGUAGE Percentage 1 2.7640
@@ -1715,3 +1715,24 @@ ERROR 42S02: Table 'test.t3' doesn't exist
drop table t1, mysql.table_stats;
rename table test.table_stats to mysql.table_stats;
set use_stat_tables=@save_use_stat_tables;
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-10134 Add full support for DEFAULT
+#
+CREATE TABLE t1 (a BLOB, b TEXT DEFAULT DECODE_HISTOGRAM('SINGLE_PREC_HB',a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` blob DEFAULT NULL,
+ `b` text DEFAULT decode_histogram('SINGLE_PREC_HB',`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES (0x0000000000000000000000000101010101010101010202020303030304040404050505050606070707080809090A0A0B0C0D0D0E0E0F10111213131415161718191B1C1E202224292A2E33373B4850575F6A76818C9AA7B9C4CFDADFE5EBF0F4F8FAFCFF);
+SELECT b FROM t1;
+b
+0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.004,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.004,0.000,0.000,0.004,0.000,0.000,0.000,0.004,0.000,0.000,0.000,0.004,0.000,0.000,0.000,0.004,0.000,0.004,0.000,0.000,0.004,0.000,0.004,0.000,0.004,0.000,0.004,0.004,0.004,0.000,0.004,0.000,0.004,0.004,0.004,0.004,0.004,0.000,0.004,0.004,0.004,0.004,0.004,0.004,0.008,0.004,0.008,0.008,0.008,0.008,0.020,0.004,0.016,0.020,0.016,0.016,0.051,0.031,0.027,0.031,0.043,0.047,0.043,0.043,0.055,0.051,0.071,0.043,0.043,0.043,0.020,0.024,0.024,0.020,0.016,0.016,0.008,0.008,0.012,0.000
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result
index 7c82936d30a..4966418dbfd 100644
--- a/mysql-test/r/status.result
+++ b/mysql-test/r/status.result
@@ -2,6 +2,9 @@ set @old_concurrent_insert= @@global.concurrent_insert;
set @@global.concurrent_insert= 0;
SET @old_log_output = @@global.log_output;
SET GLOBAL LOG_OUTPUT = 'FILE';
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection default;
flush status;
show status like 'Table_lock%';
Variable_name Value
@@ -11,31 +14,42 @@ select * from information_schema.session_status where variable_name like 'Table_
VARIABLE_NAME VARIABLE_VALUE
TABLE_LOCKS_IMMEDIATE 0
TABLE_LOCKS_WAITED 0
-# Switched to connection: con1
set sql_log_bin=0;
set @old_general_log = @@global.general_log;
set global general_log = 'OFF';
drop table if exists t1;
create table t1(n int) engine=myisam;
insert into t1 values(1);
-select 1;
-1
+select get_lock('mysqltest_lock', 100);
+get_lock('mysqltest_lock', 100)
1
-# Switched to connection: con2
-lock tables t1 read;
-unlock tables;
-lock tables t1 read;
-# Switched to connection: con1
+connection con2;
+# Sending:
+update t1 set n = get_lock('mysqltest_lock', 100);
+connection con1;
+# Wait for the first UPDATE to get blocked.
+# Sending:
update t1 set n = 3;
-# Switched to connection: con2
-unlock tables;
-# Switched to connection: con1
+connection default;
+# wait for the second UPDATE to get blocked
+select release_lock('mysqltest_lock');
+release_lock('mysqltest_lock')
+1
+connection con2;
+# Reaping first UPDATE
+select release_lock('mysqltest_lock');
+release_lock('mysqltest_lock')
+1
+connection con1;
+# Reaping second UPDATE
show status like 'Table_locks_waited';
Variable_name Value
Table_locks_waited 1
+connection default;
drop table t1;
set global general_log = @old_general_log;
-# Switched to connection: default
+disconnect con2;
+disconnect con1;
select 1;
1
1
@@ -77,6 +91,10 @@ VARIABLE_NAME VARIABLE_VALUE
MAX_USED_CONNECTIONS 1
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;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 3
@@ -90,19 +108,25 @@ Max_used_connections 2
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
VARIABLE_NAME VARIABLE_VALUE
MAX_USED_CONNECTIONS 2
+connect con2,localhost,root,,;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 3
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
VARIABLE_NAME VARIABLE_VALUE
MAX_USED_CONNECTIONS 3
+connect con3,localhost,root,,;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections 4
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
VARIABLE_NAME VARIABLE_VALUE
MAX_USED_CONNECTIONS 4
+connection default;
SET GLOBAL thread_cache_size=@save_thread_cache_size;
+disconnect con3;
+disconnect con2;
+disconnect con1;
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (1), (2);
SELECT a FROM t1 LIMIT 1;
@@ -151,6 +175,7 @@ SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name Value
Last_query_cost 5.205836
DROP TABLE t1;
+connect con1,localhost,root,,;
show status like 'com_show_status';
Variable_name Value
Com_show_status 3
@@ -183,6 +208,8 @@ Variable_name Value
Com_show_status 8
rnd_diff tmp_table_diff
28 8
+disconnect con1;
+connection default;
flush status;
show status like 'Com%function';
Variable_name Value
@@ -201,6 +228,8 @@ Variable_name Value
Com_alter_function 0
Com_create_function 1
Com_drop_function 1
+connect root, localhost, root,,test;
+connection root;
create database db37908;
create table db37908.t1(f1 int);
insert into db37908.t1 values(1);
@@ -209,6 +238,8 @@ grant usage,execute on test.* to mysqltest_1@localhost;
create procedure proc37908() begin select 1; end |
create function func37908() returns int sql security invoker
return (select * from db37908.t1 limit 1)|
+connect user1,localhost,mysqltest_1,,test;
+connection user1;
select * from db37908.t1;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
show status where variable_name ='uptime' and 2 in (select * from db37908.t1);
@@ -217,11 +248,16 @@ show procedure status where name ='proc37908' and 1 in (select f1 from db37908.t
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
show function status where name ='func37908' and 1 in (select func37908());
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
+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;
+connect con1,localhost,root,,;
+connection con1;
DROP PROCEDURE IF EXISTS p1;
DROP FUNCTION IF EXISTS f1;
CREATE FUNCTION f1() RETURNS INTEGER
@@ -245,6 +281,8 @@ CALL p1();
SELECT 9;
9
9
+disconnect con1;
+connection default;
DROP PROCEDURE p1;
DROP FUNCTION f1;
flush status;
@@ -343,5 +381,6 @@ Handler_tmp_write 2
Handler_update 0
Handler_write 0
drop table t1;
+connection default;
set @@global.concurrent_insert= @old_concurrent_insert;
SET GLOBAL log_output = @old_log_output;
diff --git a/mysql-test/r/status2.result b/mysql-test/r/status2.result
index 146fb2adbaf..5805818fdf5 100644
--- a/mysql-test/r/status2.result
+++ b/mysql-test/r/status2.result
@@ -44,9 +44,13 @@ Assert Questions == 13
SHOW STATUS LIKE 'Questions';
Variable_name Value
Questions 13
+connect con1,localhost,root,,;
+connection con1;
SELECT 1;
1
1
+connection default;
+disconnect con1;
Assert Questions == 14
SHOW STATUS LIKE 'Questions';
Variable_name Value
diff --git a/mysql-test/r/status_bug17954.result b/mysql-test/r/status_bug17954.result
index 5c244cd8aca..82d4d1a9a7e 100644
--- a/mysql-test/r/status_bug17954.result
+++ b/mysql-test/r/status_bug17954.result
@@ -9,5 +9,6 @@ SELECT VALUE INTO @tc FROM v1 WHERE NAME = 'Threads_connected';
SELECT NAME FROM v1 WHERE NAME = 'Threads_created' AND VALUE < @tc;
NAME
DROP VIEW v1;
+connection default;
set @@global.concurrent_insert= @old_concurrent_insert;
SET GLOBAL log_output = @old_log_output;
diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result
index 68efe3df8d0..315bb9dc1b5 100644
--- a/mysql-test/r/strict.result
+++ b/mysql-test/r/strict.result
@@ -897,7 +897,7 @@ ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES ('-1.2E-3');
ERROR 22003: Out of range value for column 'col2' at row 1
UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
-ERROR 22003: DOUBLE value is out of range in '("test"."t1"."col1" * 5000)'
+ERROR 22003: DOUBLE value is out of range in '"test"."t1"."col1" * 5000'
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
ERROR 22012: Division by 0
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
@@ -1015,7 +1015,7 @@ CREATE TABLE t1 (col1 INT NOT NULL default 99, col2 CHAR(6) NOT NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
- "col1" int(11) NOT NULL DEFAULT '99',
+ "col1" int(11) NOT NULL DEFAULT 99,
"col2" char(6) NOT NULL
)
INSERT INTO t1 VALUES (1, 'hello');
@@ -1273,7 +1273,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
- `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -1374,6 +1374,7 @@ i int comment
123456789*123456789*123456789*123456789*');
ERROR HY000: Comment for field 'i' is too long (max = 1024)
set @@sql_mode= @org_mode;
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t1
(i int comment
'123456789*123456789*123456789*123456789*
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 40f936fb3b4..e2ed43158f1 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -1,5 +1,6 @@
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
drop view if exists v2;
+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");
@@ -56,7 +57,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 1 AS `1` from dual having ((select 1) = 1)
+Note 1003 select 1 AS `1` from dual having (select 1) = 1
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
@@ -79,7 +80,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
1
1
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
-ERROR HY000: Incorrect usage of PROCEDURE and subquery
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE(1))' at line 1
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
@@ -197,7 +198,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`)))
+Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (select max(`test`.`t2`.`a`) * 4 from `test`.`t2`))
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
3 1
@@ -215,7 +216,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
Warnings:
-Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
+Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt`
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);
a
@@ -237,7 +238,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
+Note 1003 select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((select avg(`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
select * from t3 where exists (select * from t2 where t2.b=t3.a);
a
7
@@ -283,7 +284,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2);
a
7
@@ -327,7 +328,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select <expr_cache><`test`.`t2`.`a`>((select 2 from dual where (2 = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`))) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
+Note 1003 select <expr_cache><`test`.`t2`.`a`>((select 2 from dual where 2 = `test`.`t2`.`a` union select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -345,7 +346,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t6 ALL i1 NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where (`test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`)
+Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous
drop table t1,t2,t3;
@@ -406,13 +407,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
Warnings:
-Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
+Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03'
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
Warnings:
-Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
+Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
date
2002-08-03
@@ -559,7 +560,7 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
+Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1'
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
@@ -741,7 +742,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref id id 5 const 1 100.00 Using index
Warnings:
Note 1249 Select 2 was reduced during optimization
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 1)
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1
SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id
1
@@ -754,7 +755,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1249 Select 3 was reduced during optimization
Note 1249 Select 2 was reduced during optimization
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = <cache>((1 + 1)))
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = <cache>(1 + 1)
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index
@@ -762,7 +763,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <expr_cache><`test`.`t2`.`id`>(<in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3)))))
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <expr_cache><`test`.`t2`.`id`>(<in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(1) union select 3 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
id
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
@@ -888,7 +889,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1249 Select 2 was reduced during optimization
-Note 1003 select (`test`.`t1`.`a` + 1) AS `(select a+1)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
select (select a+1) from t1;
(select a+1)
2.5
@@ -910,7 +911,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having <is_not_null_test>(`test`.`t2`.`a`))))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having `test`.`t2`.`a` is null)))) AS `t1.a in (select t2.a from t2)` from `test`.`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;
@@ -925,7 +926,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`)))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a` or `test`.`t2`.`a` is null) having `test`.`t2`.`a` is null))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
drop table t1,t2,t3;
# check correct NULL Processing for normal IN/ALL/ANY
# and 2 ways of max/min optimization
@@ -1056,7 +1057,7 @@ create table t1 (a float);
select 10.5 IN (SELECT * from t1 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1.5)' at line 1
select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
drop table t1;
@@ -1202,11 +1203,11 @@ CREATE TABLE `t3` (
PRIMARY KEY (`numeropost`),
UNIQUE KEY `maxnumrep` (`maxnumrep`)
) ENGINE=MyISAM CHARSET=latin1;
-INSERT INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
+INSERT IGNORE INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
Warnings:
Warning 1265 Data truncated for column 'date' at row 1
Warning 1265 Data truncated for column 'date' at row 2
-INSERT INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
+INSERT IGNORE INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
Warnings:
Warning 1265 Data truncated for column 'date' at row 1
Warning 1265 Data truncated for column 'date' at row 2
@@ -1232,24 +1233,24 @@ CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT 1)` int(1) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT 1)` int(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT a)` int(1) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT a)` int(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT a+0)` int(3) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT a+0)` int(3) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
@@ -1325,7 +1326,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)`
INSERT INTO t1 (pseudo) VALUES ('test1');
SELECT 0 IN (SELECT 1 FROM t1 a);
0 IN (SELECT 1 FROM t1 a)
@@ -1335,7 +1336,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)`
drop table t1;
CREATE TABLE `t1` (
`i` int(11) NOT NULL default '0',
@@ -1380,7 +1381,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
+Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`)
drop table t1;
CREATE TABLE t1 (
ID int(10) unsigned NOT NULL auto_increment,
@@ -1442,7 +1443,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1452,7 +1453,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1463,7 +1464,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = `test`.`t2`.`a`))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`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));
@@ -1485,7 +1486,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index
1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where (`test`.`t1`.`a` = `test`.`t2`.`a`)
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1495,7 +1496,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index
1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1506,7 +1507,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 index a a 5 NULL 3 100.00 Using where; Using index
1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where `test`.`t1`.`b` = `test`.`t3`.`a` and `test`.`t1`.`a` = `test`.`t2`.`a`
insert into t1 values (3,31);
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
@@ -1522,7 +1523,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index
1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
drop table t0, t1, t2, t3;
create table t1 (a int, b int);
create table t2 (a int, b int);
@@ -1613,25 +1614,25 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
create table t2 (a int, b int not null);
create table t3 (a int);
@@ -1646,7 +1647,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2);
a
explain extended select * from t3 where a >= some (select b from t2);
@@ -1654,7 +1655,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2 group by 1);
a
6
@@ -1665,7 +1666,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2 group by 1);
a
explain extended select * from t3 where a >= some (select b from t2 group by 1);
@@ -1673,7 +1674,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where NULL >= any (select b from t2);
a
explain extended select * from t3 where NULL >= any (select b from t2);
@@ -1716,7 +1717,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`)))
drop table t2, t3;
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());
@@ -1886,14 +1887,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where
Warnings:
-Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not(<expr_cache><`test`.`t1`.`id`>(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where ((`test`.`t1`.`id` < 8) and (<cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`))))))))
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !<expr_cache><`test`.`t1`.`id`>(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where `test`.`t1`.`id` < 8 and <cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`))))
explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))))
+Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`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');
@@ -1919,7 +1920,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00
1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition
Warnings:
-Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`b`.`id` = `test`.`a`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`)
+Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id`
drop table t1,t2;
create table t1 (a int);
insert into t1 values (1);
@@ -2611,7 +2612,11 @@ explain select a from t1 where c=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
drop table t1;
+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;
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);
@@ -2973,20 +2978,20 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`)))))) AS `test` from `test`.`t1`
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1`
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where (`test`.`t2`.`flag` = 'N')
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`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;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`)))))) AS `test` from `test`.`t1`
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1`
DROP TABLE t1,t2;
set optimizer_switch=@tmp11867_optimizer_switch;
CREATE TABLE t1 (a char(5), b char(5));
@@ -4452,14 +4457,14 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))))
+Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)))
DROP TABLE t1,t2;
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);
-insert into t2
+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;
set session sort_buffer_size= 33*1024;
@@ -4533,14 +4538,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
Warnings:
-Note 1003 select 1 AS `1` from <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where (`<subquery2>`.`min(a)` = 1)
+Note 1003 select 1 AS `1` from <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
Warnings:
-Note 1003 select 1 AS `1` from <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a`) join `test`.`t1` where (`<subquery2>`.`min(a)` = 1)
+Note 1003 select 1 AS `1` from <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` where `test`.`t1`.`a` > 3 group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1
SET join_cache_level=@save_join_cache_level;
DROP TABLE t1;
#
@@ -4997,7 +5002,7 @@ 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;
INSERT INTO v2(a,b) VALUES (2,2);
-ERROR HY000: CHECK OPTION failed 'test.v2'
+ERROR 44000: CHECK OPTION failed `test`.`v2`
SELECT * FROM v1;
c
1
@@ -5184,9 +5189,9 @@ a 1
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
ERROR 42000: Every derived table must have its own alias
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ON 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1) ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) ON 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1)) ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't1a ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
@@ -6007,26 +6012,26 @@ 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);
f1 f1_key
-v j
+s c
+s d
+s d
+s d
s j
-v v
+s m
+s s
+s t
s v
+s y
v c
-s c
-v m
-s m
v d
-s d
v d
-s d
-v y
-s y
-v t
-s t
v d
-s d
+v j
+v m
v s
-s s
+v t
+v v
+v y
DROP TABLE t1,t2;
#
# LP bug 919427: EXPLAIN for a query over a single-row table
@@ -6357,26 +6362,26 @@ SELECT DISTINCT f1_key
FROM t2
WHERE f1_key != table2.f1_key AND f1_key >= table1.f1 );
f1 f1_key
-v j
+s c
+s d
+s d
+s d
s j
-v v
+s m
+s s
+s t
s v
+s y
v c
-s c
-v m
-s m
v d
-s d
v d
-s d
-v y
-s y
-v t
-s t
v d
-s d
+v j
+v m
v s
-s s
+v t
+v v
+v y
explain SELECT table1.f1, table2.f1_key
FROM t1 AS table1, t2 AS table2
WHERE EXISTS
@@ -7265,3 +7270,17 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
# End of 10.1 tests
+#
+# MDEV-12564: IN TO EXISTS transformation for rows after
+# conversion an outer join to inner join
+#
+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';
+pk i c pk i c
+1 10 foo 1 10 foo
+DROP TABLE t;
+# End of 10.2 tests
diff --git a/mysql-test/r/subselect2.result b/mysql-test/r/subselect2.result
index a54080f6cb4..b8295416e93 100644
--- a/mysql-test/r/subselect2.result
+++ b/mysql-test/r/subselect2.result
@@ -16,7 +16,7 @@ DOCID VARCHAR(32)BINARY NOT NULL
, PRIMARY KEY ( DOCID )
) ENGINE=InnoDB
;
-INSERT INTO t1 (DOCID) VALUES ("1"), ("2");
+INSERT IGNORE INTO t1 (DOCID) VALUES ("1"), ("2");
Warnings:
Warning 1364 Field 'UUID' doesn't have a default value
CREATE TABLE t2
@@ -262,7 +262,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2c ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`c1` AS `c1` from `test`.`t1` where (not(<expr_cache><`test`.`t1`.`c1`,`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t2a`.`c2` from `test`.`t2` `t2a` join `test`.`t2` `t2b` join `test`.`t2` `t2c` where (((`test`.`t2b`.`m` <> `test`.`t1`.`a`) or (`test`.`t2b`.`m` = `test`.`t2a`.`m`)) and trigcond(((<cache>(`test`.`t1`.`c1`) = `test`.`t2a`.`c2`) or isnull(`test`.`t2a`.`c2`))) and (`test`.`t2c`.`c2` = `test`.`t2b`.`c2`) and (`test`.`t2b`.`n` = `test`.`t2a`.`m`)) having trigcond(<is_not_null_test>(`test`.`t2a`.`c2`)))))))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`c1` AS `c1` from `test`.`t1` where !<expr_cache><`test`.`t1`.`c1`,`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t2a`.`c2` from `test`.`t2` `t2a` join `test`.`t2` `t2b` join `test`.`t2` `t2c` where (`test`.`t2b`.`m` <> `test`.`t1`.`a` or `test`.`t2b`.`m` = `test`.`t2a`.`m`) and trigcond(<cache>(`test`.`t1`.`c1`) = `test`.`t2a`.`c2` or `test`.`t2a`.`c2` is null) and `test`.`t2c`.`c2` = `test`.`t2b`.`c2` and `test`.`t2b`.`n` = `test`.`t2a`.`m` having trigcond(`test`.`t2a`.`c2` is null))))
DROP TABLE t1,t2;
#
# MDEV-614, also MDEV-536, also LP:1050806:
@@ -342,7 +342,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ref idx idx 6 func 2 100.00 Using where; Using index
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`a` = `test`.`t1`.`a`)) where ((`test`.`t1`.`a` = (select min(`test`.`t1`.`a`) from `test`.`t1`)) and (`test`.`t2`.`a` = (select min(`test`.`t1`.`a`) from `test`.`t1`)))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t1`.`a`) where `test`.`t1`.`a` = (select min(`test`.`t1`.`a`) from `test`.`t1`) and `test`.`t2`.`a` = (select min(`test`.`t1`.`a`) from `test`.`t1`)
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 );
a a a
diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result
index b495b0a2fa9..9ed067c0bdc 100644
--- a/mysql-test/r/subselect3.result
+++ b/mysql-test/r/subselect3.result
@@ -33,7 +33,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary
Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`))))))) AS `Z` from `test`.`t2`
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = `test`.`t2`.`oref` group by `test`.`t1`.`grp` having trigcond(<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `Z` from `test`.`t2`
explain extended
select a, oref from t2
where a in (select max(ie) from t1 where oref=t2.oref group by grp);
@@ -42,7 +42,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary
Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having (<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`))))))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = `test`.`t2`.`oref` group by `test`.`t1`.`grp` having <cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))
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
@@ -73,7 +73,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary
Warnings:
-Note 1003 select <expr_cache><`test`.`t3`.`a`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = 4) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t3`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`))))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3`
+Note 1003 select <expr_cache><`test`.`t3`.`a`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = 4 group by `test`.`t1`.`grp` having trigcond(<cache>(`test`.`t3`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3`
set @@optimizer_switch=@save_optimizer_switch;
drop table t1, t2, t3;
create table t1 (a int, oref int, key(a));
@@ -99,7 +99,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 2 100.00 Using where; Full scan on NULL key
Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a checking NULL where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) having trigcond(<is_not_null_test>(`test`.`t1`.`a`)))))) AS `Z` from `test`.`t2`
+Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a checking NULL where `test`.`t1`.`oref` = `test`.`t2`.`oref` having trigcond(`test`.`t1`.`a` is null))))) AS `Z` from `test`.`t2`
flush status;
select oref, a from t2 where a in (select a from t1 where oref=t2.oref);
oref a
@@ -169,7 +169,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ref a a 5 test.t1.b 1 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<expr_cache><`test`.`t3`.`a`,`test`.`t3`.`oref`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond(((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`))) and (`test`.`t2`.`a` = `test`.`t1`.`b`)) having trigcond(<is_not_null_test>(`test`.`t1`.`a`))))) AS `Z` from `test`.`t3`
+Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<expr_cache><`test`.`t3`.`a`,`test`.`t3`.`oref`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond(<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) and `test`.`t2`.`a` = `test`.`t1`.`b` having trigcond(`test`.`t1`.`a` is null)))) AS `Z` from `test`.`t3`
drop table t1, t2, t3;
create table t1 (a int NOT NULL, b int NOT NULL, key(a));
insert into t1 values
@@ -197,7 +197,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ref a a 4 test.t1.b 1 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<expr_cache><`test`.`t3`.`a`,`test`.`t3`.`oref`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`)) and (`test`.`t2`.`a` = `test`.`t1`.`b`))))) AS `Z` from `test`.`t3`
+Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<expr_cache><`test`.`t3`.`a`,`test`.`t3`.`oref`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond(<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`) and `test`.`t2`.`a` = `test`.`t1`.`b`))) AS `Z` from `test`.`t3`
drop table t1,t2,t3;
create table t1 (oref int, grp int);
insert into t1 (oref, grp) values
@@ -221,7 +221,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
Warnings:
Note 1276 Field or reference 't2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(select count(0) from `test`.`t1` group by `test`.`t1`.`grp` having ((`test`.`t1`.`grp` = `test`.`t2`.`oref`) and trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(count(0)))))))) AS `Z` from `test`.`t2`
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(select count(0) from `test`.`t1` group by `test`.`t1`.`grp` having `test`.`t1`.`grp` = `test`.`t2`.`oref` and trigcond(<cache>(`test`.`t2`.`a`) = <ref_null_helper>(count(0)))))) AS `Z` from `test`.`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);
@@ -253,7 +253,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 2 100.00 Using where; Full scan on NULL key
Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a checking NULL where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`a`)) and trigcond(<is_not_null_test>(`test`.`t1`.`b`))))))) AS `Z` from `test`.`t2`
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a checking NULL where `test`.`t1`.`c` = `test`.`t2`.`oref` and trigcond(trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null)) and trigcond(trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b` or `test`.`t1`.`b` is null)) having trigcond(`test`.`t1`.`a` is null) and trigcond(`test`.`t1`.`b` is null))))) AS `Z` from `test`.`t2`
select a,b, oref, (a,b) in (select a,b from t1 where c=t2.oref) Z from t2;
a b oref Z
NULL 1 100 0
@@ -270,7 +270,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 100 100.00 Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`a`)) and trigcond(<is_not_null_test>(`test`.`t1`.`b`)))))) AS `Z` from `test`.`t2`
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where `test`.`t1`.`c` = `test`.`t2`.`oref` and trigcond(trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null)) and trigcond(trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b` or `test`.`t1`.`b` is null)) having trigcond(`test`.`t1`.`a` is null) and trigcond(`test`.`t1`.`b` is null)))) AS `Z` from `test`.`t2`
select a,b, oref,
(a,b) in (select a,b from t1,t4 where c=t2.oref) Z
from t2;
@@ -315,7 +315,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key
Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where ((`test`.`t1`.`oref` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1`) or isnull(`test`.`t1`.`ie1`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2`) or isnull(`test`.`t1`.`ie2`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`ie1`)) and trigcond(<is_not_null_test>(`test`.`t1`.`ie2`))))))) AS `Z` from `test`.`t2` where ((`test`.`t2`.`a` = 10) and (`test`.`t2`.`b` = 10))
+Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where `test`.`t1`.`oref` = `test`.`t2`.`oref` and trigcond(trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1` or `test`.`t1`.`ie1` is null)) and trigcond(trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2` or `test`.`t1`.`ie2` is null)) having trigcond(`test`.`t1`.`ie1` is null) and trigcond(`test`.`t1`.`ie2` is null))))) AS `Z` from `test`.`t2` where `test`.`t2`.`a` = 10 and `test`.`t2`.`b` = 10
drop table t1, t2;
create table t1 (oref char(4), grp int, ie int);
insert into t1 (oref, grp, ie) values
@@ -585,7 +585,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key
Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where ((`test`.`t1`.`oref` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1`) or isnull(`test`.`t1`.`ie1`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2`) or isnull(`test`.`t1`.`ie2`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`ie1`)) and trigcond(<is_not_null_test>(`test`.`t1`.`ie2`))))))) AS `Z` from `test`.`t2`
+Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where `test`.`t1`.`oref` = `test`.`t2`.`oref` and trigcond(trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1` or `test`.`t1`.`ie1` is null)) and trigcond(trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2` or `test`.`t1`.`ie2` is null)) having trigcond(`test`.`t1`.`ie1` is null) and trigcond(`test`.`t1`.`ie2` is null))))) AS `Z` from `test`.`t2`
drop table t1,t2;
create table t1 (oref char(4), grp int, ie int primary key);
insert into t1 (oref, grp, ie) values
@@ -716,7 +716,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t1`.`a`) and (not(<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` where trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`))) having trigcond(<is_not_null_test>(`test`.`t1`.`a`))))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t1`.`a` and !<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` where trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) having trigcond(`test`.`t1`.`a` is null))))
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1));
a
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1 WHERE a > 4));
@@ -1296,7 +1296,7 @@ id select_type table type possible_keys key key_len ref rows Extra
set @save_optimizer_search_depth=@@optimizer_search_depth;
set @@optimizer_search_depth=63;
Warnings:
-Warning 1287 'optimizer-search-depth=63' is deprecated and will be removed in a future release. Please use a search depth less than 63 instead
+Warning 1292 Truncated incorrect optimizer_search_depth value: '63'
explain select * from t1 where (a,b) in (select a,b from t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 10
@@ -1418,7 +1418,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY c eq_ref PRIMARY PRIMARY 4 test.cona.idContact 1 100.00 Using where
1 PRIMARY a eq_ref PRIMARY PRIMARY 4 test.c.idObj 1 100.00 Using index; End temporary
Warnings:
-Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where ((`test`.`cona`.`postalStripped` = 'T2H3B2') and (`test`.`a`.`idIndividual` = `test`.`c`.`idObj`) and (`test`.`c`.`idContact` = `test`.`cona`.`idContact`))
+Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where `test`.`cona`.`postalStripped` = 'T2H3B2' and `test`.`a`.`idIndividual` = `test`.`c`.`idObj` and `test`.`c`.`idContact` = `test`.`cona`.`idContact`
set @@optimizer_switch=@save_optimizer_switch;
drop table t1,t2,t3;
#
@@ -1541,7 +1541,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t2.v' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`v` AS `v`,<expr_cache><`test`.`t2`.`v`>((select count(distinct `test`.`t1`.`i`) from `test`.`t1` where (`test`.`t1`.`v` = `test`.`t2`.`v`))) AS `subsel` from `test`.`t2`
+Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`v` AS `v`,<expr_cache><`test`.`t2`.`v`>((select count(distinct `test`.`t1`.`i`) from `test`.`t1` where `test`.`t1`.`v` = `test`.`t2`.`v`)) AS `subsel` from `test`.`t2`
DROP TABLE t1,t2;
End of 5.6 tests
set @@optimizer_switch=@subselect3_tmp;
diff --git a/mysql-test/r/subselect3_jcl6.result b/mysql-test/r/subselect3_jcl6.result
index 2e2da205fc3..2a1fc0df957 100644
--- a/mysql-test/r/subselect3_jcl6.result
+++ b/mysql-test/r/subselect3_jcl6.result
@@ -43,7 +43,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary
Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`))))))) AS `Z` from `test`.`t2`
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = `test`.`t2`.`oref` group by `test`.`t1`.`grp` having trigcond(<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `Z` from `test`.`t2`
explain extended
select a, oref from t2
where a in (select max(ie) from t1 where oref=t2.oref group by grp);
@@ -52,7 +52,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary
Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) group by `test`.`t1`.`grp` having (<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`))))))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = `test`.`t2`.`oref` group by `test`.`t1`.`grp` having <cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))
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
@@ -83,7 +83,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary
Warnings:
-Note 1003 select <expr_cache><`test`.`t3`.`a`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where (`test`.`t1`.`oref` = 4) group by `test`.`t1`.`grp` having trigcond((<cache>(`test`.`t3`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`))))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3`
+Note 1003 select <expr_cache><`test`.`t3`.`a`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = 4 group by `test`.`t1`.`grp` having trigcond(<cache>(`test`.`t3`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3`
set @@optimizer_switch=@save_optimizer_switch;
drop table t1, t2, t3;
create table t1 (a int, oref int, key(a));
@@ -109,7 +109,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 2 100.00 Using where; Full scan on NULL key
Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a checking NULL where (`test`.`t1`.`oref` = `test`.`t2`.`oref`) having trigcond(<is_not_null_test>(`test`.`t1`.`a`)))))) AS `Z` from `test`.`t2`
+Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a checking NULL where `test`.`t1`.`oref` = `test`.`t2`.`oref` having trigcond(`test`.`t1`.`a` is null))))) AS `Z` from `test`.`t2`
flush status;
select oref, a from t2 where a in (select a from t1 where oref=t2.oref);
oref a
@@ -179,7 +179,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ref a a 5 test.t1.b 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
Warnings:
Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<expr_cache><`test`.`t3`.`a`,`test`.`t3`.`oref`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond(((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`))) and (`test`.`t2`.`a` = `test`.`t1`.`b`)) having trigcond(<is_not_null_test>(`test`.`t1`.`a`))))) AS `Z` from `test`.`t3`
+Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<expr_cache><`test`.`t3`.`a`,`test`.`t3`.`oref`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond(<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) and `test`.`t2`.`a` = `test`.`t1`.`b` having trigcond(`test`.`t1`.`a` is null)))) AS `Z` from `test`.`t3`
drop table t1, t2, t3;
create table t1 (a int NOT NULL, b int NOT NULL, key(a));
insert into t1 values
@@ -207,7 +207,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ref a a 4 test.t1.b 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
Warnings:
Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<expr_cache><`test`.`t3`.`a`,`test`.`t3`.`oref`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t3`.`oref`) and trigcond((<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`)) and (`test`.`t2`.`a` = `test`.`t1`.`b`))))) AS `Z` from `test`.`t3`
+Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<expr_cache><`test`.`t3`.`a`,`test`.`t3`.`oref`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond(<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`) and `test`.`t2`.`a` = `test`.`t1`.`b`))) AS `Z` from `test`.`t3`
drop table t1,t2,t3;
create table t1 (oref int, grp int);
insert into t1 (oref, grp) values
@@ -231,7 +231,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
Warnings:
Note 1276 Field or reference 't2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(select count(0) from `test`.`t1` group by `test`.`t1`.`grp` having ((`test`.`t1`.`grp` = `test`.`t2`.`oref`) and trigcond((<cache>(`test`.`t2`.`a`) = <ref_null_helper>(count(0)))))))) AS `Z` from `test`.`t2`
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(select count(0) from `test`.`t1` group by `test`.`t1`.`grp` having `test`.`t1`.`grp` = `test`.`t2`.`oref` and trigcond(<cache>(`test`.`t2`.`a`) = <ref_null_helper>(count(0)))))) AS `Z` from `test`.`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);
@@ -263,7 +263,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 2 100.00 Using where; Full scan on NULL key
Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a checking NULL where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`a`)) and trigcond(<is_not_null_test>(`test`.`t1`.`b`))))))) AS `Z` from `test`.`t2`
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a checking NULL where `test`.`t1`.`c` = `test`.`t2`.`oref` and trigcond(trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null)) and trigcond(trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b` or `test`.`t1`.`b` is null)) having trigcond(`test`.`t1`.`a` is null) and trigcond(`test`.`t1`.`b` is null))))) AS `Z` from `test`.`t2`
select a,b, oref, (a,b) in (select a,b from t1 where c=t2.oref) Z from t2;
a b oref Z
NULL 1 100 0
@@ -280,7 +280,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 100 100.00 Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where ((`test`.`t1`.`c` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`a`)) and trigcond(<is_not_null_test>(`test`.`t1`.`b`)))))) AS `Z` from `test`.`t2`
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where `test`.`t1`.`c` = `test`.`t2`.`oref` and trigcond(trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null)) and trigcond(trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b` or `test`.`t1`.`b` is null)) having trigcond(`test`.`t1`.`a` is null) and trigcond(`test`.`t1`.`b` is null)))) AS `Z` from `test`.`t2`
select a,b, oref,
(a,b) in (select a,b from t1,t4 where c=t2.oref) Z
from t2;
@@ -325,7 +325,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key
Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where ((`test`.`t1`.`oref` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1`) or isnull(`test`.`t1`.`ie1`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2`) or isnull(`test`.`t1`.`ie2`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`ie1`)) and trigcond(<is_not_null_test>(`test`.`t1`.`ie2`))))))) AS `Z` from `test`.`t2` where ((`test`.`t2`.`a` = 10) and (`test`.`t2`.`b` = 10))
+Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where `test`.`t1`.`oref` = `test`.`t2`.`oref` and trigcond(trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1` or `test`.`t1`.`ie1` is null)) and trigcond(trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2` or `test`.`t1`.`ie2` is null)) having trigcond(`test`.`t1`.`ie1` is null) and trigcond(`test`.`t1`.`ie2` is null))))) AS `Z` from `test`.`t2` where `test`.`t2`.`a` = 10 and `test`.`t2`.`b` = 10
drop table t1, t2;
create table t1 (oref char(4), grp int, ie int);
insert into t1 (oref, grp, ie) values
@@ -595,7 +595,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key
Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where ((`test`.`t1`.`oref` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1`) or isnull(`test`.`t1`.`ie1`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2`) or isnull(`test`.`t1`.`ie2`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`ie1`)) and trigcond(<is_not_null_test>(`test`.`t1`.`ie2`))))))) AS `Z` from `test`.`t2`
+Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where `test`.`t1`.`oref` = `test`.`t2`.`oref` and trigcond(trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1` or `test`.`t1`.`ie1` is null)) and trigcond(trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2` or `test`.`t1`.`ie2` is null)) having trigcond(`test`.`t1`.`ie1` is null) and trigcond(`test`.`t1`.`ie2` is null))))) AS `Z` from `test`.`t2`
drop table t1,t2;
create table t1 (oref char(4), grp int, ie int primary key);
insert into t1 (oref, grp, ie) values
@@ -726,7 +726,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t1`.`a`) and (not(<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` where trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`))) having trigcond(<is_not_null_test>(`test`.`t1`.`a`))))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t1`.`a` and !<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` where trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) having trigcond(`test`.`t1`.`a` is null))))
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1));
a
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1 WHERE a > 4));
@@ -1306,7 +1306,7 @@ id select_type table type possible_keys key key_len ref rows Extra
set @save_optimizer_search_depth=@@optimizer_search_depth;
set @@optimizer_search_depth=63;
Warnings:
-Warning 1287 'optimizer-search-depth=63' is deprecated and will be removed in a future release. Please use a search depth less than 63 instead
+Warning 1292 Truncated incorrect optimizer_search_depth value: '63'
explain select * from t1 where (a,b) in (select a,b from t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where
@@ -1428,7 +1428,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY c eq_ref PRIMARY PRIMARY 4 test.cona.idContact 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
1 PRIMARY a eq_ref PRIMARY PRIMARY 4 test.c.idObj 1 100.00 Using index; End temporary
Warnings:
-Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where ((`test`.`cona`.`postalStripped` = 'T2H3B2') and (`test`.`a`.`idIndividual` = `test`.`c`.`idObj`) and (`test`.`c`.`idContact` = `test`.`cona`.`idContact`))
+Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where `test`.`cona`.`postalStripped` = 'T2H3B2' and `test`.`a`.`idIndividual` = `test`.`c`.`idObj` and `test`.`c`.`idContact` = `test`.`cona`.`idContact`
set @@optimizer_switch=@save_optimizer_switch;
drop table t1,t2,t3;
#
@@ -1551,7 +1551,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t2.v' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`v` AS `v`,<expr_cache><`test`.`t2`.`v`>((select count(distinct `test`.`t1`.`i`) from `test`.`t1` where (`test`.`t1`.`v` = `test`.`t2`.`v`))) AS `subsel` from `test`.`t2`
+Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`v` AS `v`,<expr_cache><`test`.`t2`.`v`>((select count(distinct `test`.`t1`.`i`) from `test`.`t1` where `test`.`t1`.`v` = `test`.`t2`.`v`)) AS `subsel` from `test`.`t2`
DROP TABLE t1,t2;
End of 5.6 tests
set @@optimizer_switch=@subselect3_tmp;
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index a7e2bd9d1b5..2fc87a9e0d8 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -19,7 +19,7 @@ SELECT 1 FROM t1
WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
ORDER BY count(*);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 index NULL a 5 NULL 2 Using index; Using temporary
+1 PRIMARY t1 index NULL a 5 NULL 2 Using index
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 const row not found
# should not crash the next statement
@@ -428,7 +428,7 @@ 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';
Warnings:
-Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release.
+Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release
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` ;
@@ -618,7 +618,7 @@ INSERT INTO t2 VALUES (9,1);
set @old_icp=@@optimizer_switch;
SET SESSION optimizer_switch="engine_condition_pushdown=on";
Warnings:
-Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release.
+Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release
SELECT pk
FROM t2
@@ -2003,8 +2003,8 @@ FROM t2 JOIN t3 ON t3.f4 = t2.f4
WHERE t3.f1 = 8
GROUP BY 1, 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t3 system NULL NULL NULL NULL 1 Using filesort
-1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
+1 PRIMARY t3 system NULL NULL NULL NULL 1
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using filesort
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
PREPARE st1 FROM "
@@ -2349,7 +2349,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select 3 AS `f` from dual where (not(<expr_cache><3>(<in_optimizer>(3,<exists>(select `test`.`t1`.`b` from `test`.`t1` where (((`test`.`t1`.`c` = 'USA') or (`test`.`t1`.`c` <> 'USA')) and trigcond(((<cache>(3) = `test`.`t1`.`b`) or isnull(`test`.`t1`.`b`))) and (`test`.`t1`.`b` = `test`.`t1`.`a`)) having trigcond(<is_not_null_test>(`test`.`t1`.`b`)))))))
+Note 1003 select 3 AS `f` from dual where !<expr_cache><3>(<in_optimizer>(3,<exists>(select `test`.`t1`.`b` from `test`.`t1` where (`test`.`t1`.`c` = 'USA' or `test`.`t1`.`c` <> 'USA') and trigcond(<cache>(3) = `test`.`t1`.`b` or `test`.`t1`.`b` is null) and `test`.`t1`.`b` = `test`.`t1`.`a` having trigcond(`test`.`t1`.`b` is null))))
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);
diff --git a/mysql-test/r/subselect_cache.result b/mysql-test/r/subselect_cache.result
index 97a5f5a77f6..5c74555af00 100644
--- a/mysql-test/r/subselect_cache.result
+++ b/mysql-test/r/subselect_cache.result
@@ -76,7 +76,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 18.75,
- "attached_condition": "(t1.b = t2.c)"
+ "attached_condition": "t1.b = t2.c"
}
}
}
@@ -128,7 +128,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 18.75,
- "attached_condition": "(t1.b = t2.c)"
+ "attached_condition": "t1.b = t2.c"
}
}
},
@@ -162,7 +162,7 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 18.75,
- "attached_condition": "(t1.b = t2.c)"
+ "attached_condition": "t1.b = t2.c"
}
}
}
@@ -193,7 +193,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 4,
"filtered": 100,
- "attached_condition": "(t1.b = t2.c)"
+ "attached_condition": "t1.b = t2.c"
}
}
}
@@ -230,7 +230,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 4,
"filtered": 100,
- "attached_condition": "(t1.b = t2.c)"
+ "attached_condition": "t1.b = t2.c"
}
}
},
@@ -257,7 +257,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 4,
"filtered": 100,
- "attached_condition": "(t1.b = t2.c)"
+ "attached_condition": "t1.b = t2.c"
}
}
}
@@ -2842,70 +2842,70 @@ WHERE table1 .`col_varchar_key` ) field10
1 NULL w
1 NULL y
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'o'
-Warning 1292 Truncated incorrect DOUBLE value: 'o'
-Warning 1292 Truncated incorrect DOUBLE value: 'o'
-Warning 1292 Truncated incorrect DOUBLE value: 'o'
-Warning 1292 Truncated incorrect DOUBLE value: 'o'
-Warning 1292 Truncated incorrect DOUBLE value: 'o'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
SET @@optimizer_switch='subquery_cache=on';
/* cache is on */ SELECT COUNT( DISTINCT table2 .`col_int_key` ) , (
SELECT SUBQUERY2_t1 .`col_int_key`
@@ -2933,32 +2933,32 @@ WHERE table1 .`col_varchar_key` ) field10
1 NULL w
1 NULL y
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: 'r'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
Warning 1292 Truncated incorrect DOUBLE value: 'c'
-Warning 1292 Truncated incorrect DOUBLE value: 'o'
Warning 1292 Truncated incorrect DOUBLE value: 'd'
-Warning 1292 Truncated incorrect DOUBLE value: 'v'
-Warning 1292 Truncated incorrect DOUBLE value: 'm'
-Warning 1292 Truncated incorrect DOUBLE value: 'j'
+Warning 1292 Truncated incorrect DOUBLE value: 'e'
Warning 1292 Truncated incorrect DOUBLE value: 'f'
-Warning 1292 Truncated incorrect DOUBLE value: 'n'
-Warning 1292 Truncated incorrect DOUBLE value: 'z'
+Warning 1292 Truncated incorrect DOUBLE value: 'g'
Warning 1292 Truncated incorrect DOUBLE value: 'h'
+Warning 1292 Truncated incorrect DOUBLE value: 'i'
+Warning 1292 Truncated incorrect DOUBLE value: 'j'
+Warning 1292 Truncated incorrect DOUBLE value: 'k'
+Warning 1292 Truncated incorrect DOUBLE value: 'l'
+Warning 1292 Truncated incorrect DOUBLE value: 'm'
+Warning 1292 Truncated incorrect DOUBLE value: 'n'
+Warning 1292 Truncated incorrect DOUBLE value: 'o'
+Warning 1292 Truncated incorrect DOUBLE value: 'p'
Warning 1292 Truncated incorrect DOUBLE value: 'q'
-Warning 1292 Truncated incorrect DOUBLE value: 'w'
-Warning 1292 Truncated incorrect DOUBLE value: 'a'
-Warning 1292 Truncated incorrect DOUBLE value: 'e'
-Warning 1292 Truncated incorrect DOUBLE value: 'u'
+Warning 1292 Truncated incorrect DOUBLE value: 'r'
Warning 1292 Truncated incorrect DOUBLE value: 's'
-Warning 1292 Truncated incorrect DOUBLE value: 'g'
-Warning 1292 Truncated incorrect DOUBLE value: 'b'
-Warning 1292 Truncated incorrect DOUBLE value: 'y'
-Warning 1292 Truncated incorrect DOUBLE value: 'p'
Warning 1292 Truncated incorrect DOUBLE value: 't'
+Warning 1292 Truncated incorrect DOUBLE value: 'u'
+Warning 1292 Truncated incorrect DOUBLE value: 'v'
+Warning 1292 Truncated incorrect DOUBLE value: 'w'
Warning 1292 Truncated incorrect DOUBLE value: 'x'
-Warning 1292 Truncated incorrect DOUBLE value: 'l'
-Warning 1292 Truncated incorrect DOUBLE value: 'k'
-Warning 1292 Truncated incorrect DOUBLE value: 'i'
+Warning 1292 Truncated incorrect DOUBLE value: 'y'
+Warning 1292 Truncated incorrect DOUBLE value: 'z'
drop table t1,t2,t3,t4;
set @@optimizer_switch= default;
#launchpad BUG#609045
@@ -3613,7 +3613,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`b` from `test`.`t2` where (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`b`))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`b` from `test`.`t2` where <cache>(`test`.`t1`.`a`) = `test`.`t2`.`b`)))
drop table t1,t2;
set @@optimizer_switch= default;
# LP BUG#615760 (part 2: incorrect heap table index flags)
diff --git a/mysql-test/r/subselect_exists2in.result b/mysql-test/r/subselect_exists2in.result
index d47e446fe8f..caec9f40e1d 100644
--- a/mysql-test/r/subselect_exists2in.result
+++ b/mysql-test/r/subselect_exists2in.result
@@ -55,7 +55,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL bb NULL NULL NULL 2 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t3`) where (`test`.`t3`.`b` = `test`.`t1`.`a`)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t3`) where `test`.`t3`.`b` = `test`.`t1`.`a`
-- 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);
@@ -68,7 +68,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t3 ALL bb NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t3`.`b` from `test`.`t3` where (<cache>(`test`.`t1`.`a`) = `test`.`t3`.`b`)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t3`.`b` from `test`.`t3` where <cache>(`test`.`t1`.`a`) = `test`.`t3`.`b`))
-- 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);
@@ -81,7 +81,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t3`.`b` from `test`.`t3` where 1 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`b`)))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t3`.`b` from `test`.`t3` where 1 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`b`)))
-- 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);
@@ -94,7 +94,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t3 ALL bb NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`b` = `test`.`t1`.`a`))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`b` = `test`.`t1`.`a`)
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
drop table t1,t2,t3;
@@ -313,7 +313,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`b` from `test`.`t2` where 1 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`b`)))))) or (`test`.`t1`.`a` > 0))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`b` from `test`.`t2` where 1 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`b`)))) or `test`.`t1`.`a` > 0
drop tables t1,t2;
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (1),(5);
@@ -330,7 +330,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2
-Note 1003 select (select 1 from dual where (not(((1 is not null) and <in_optimizer>(1,1 in ( <materialize> (select `test`.`t3`.`c` from `test`.`t3` where (`test`.`t3`.`c` is not null) ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `<subquery3>`.`c`))))))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
+Note 1003 select (select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in ( <materialize> (select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` is not null ), <primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )
1
@@ -344,7 +344,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2
-Note 1003 select (select 1 from dual where (not(((1 is not null) and <in_optimizer>(1,1 in ( <materialize> (select `test`.`t3`.`c` from `test`.`t3` where (`test`.`t3`.`c` is not null) ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `<subquery3>`.`c`))))))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
+Note 1003 select (select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in ( <materialize> (select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` is not null ), <primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )
1
@@ -358,7 +358,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2
-Note 1003 select (select 1 from dual where (not(exists(select `test`.`t3`.`c` from `test`.`t3` where (`test`.`t3`.`c` = 1))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
+Note 1003 select (select 1 from dual where !exists(select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` = 1)) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )
1
@@ -387,7 +387,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` semi join (`test`.`t3`) where ((`test`.`t1`.`a` = `test`.`t3`.`b`) and (`test`.`t1`.`a1` = `test`.`t3`.`b1`))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` semi join (`test`.`t3`) where `test`.`t1`.`a` = `test`.`t3`.`b` and `test`.`t1`.`a1` = `test`.`t3`.`b1`
-- 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);
@@ -401,7 +401,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a`,`test`.`t1`.`a1`),<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t3 on bb where ((<cache>(`test`.`t1`.`a`) = `test`.`t3`.`b`) and (<cache>(`test`.`t1`.`a1`) = `test`.`t3`.`b1`)))))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a`,`test`.`t1`.`a1`),<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t3 on bb where <cache>(`test`.`t1`.`a`) = `test`.`t3`.`b` and <cache>(`test`.`t1`.`a1`) = `test`.`t3`.`b1`)))
-- 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);
@@ -415,7 +415,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a`,`test`.`t1`.`a1`),(`test`.`t1`.`a`,`test`.`t1`.`a1`) in ( <materialize> (select `test`.`t3`.`b`,`test`.`t3`.`b1` from `test`.`t3` where 1 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`b`) and (`test`.`t1`.`a1` = `<subquery2>`.`b1`)))))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a`,`test`.`t1`.`a1`),(`test`.`t1`.`a`,`test`.`t1`.`a1`) in ( <materialize> (select `test`.`t3`.`b`,`test`.`t3`.`b1` from `test`.`t3` where 1 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`b` and `test`.`t1`.`a1` = `<subquery2>`.`b1`)))
-- 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);
@@ -429,7 +429,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` where exists(select 1 from `test`.`t3` where ((`test`.`t3`.`b` = `test`.`t1`.`a`) and (`test`.`t3`.`b1` = `test`.`t1`.`a1`)))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` where exists(select 1 from `test`.`t3` where `test`.`t3`.`b` = `test`.`t1`.`a` and `test`.`t3`.`b1` = `test`.`t1`.`a1`)
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
drop table t1,t3;
@@ -466,7 +466,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'v.d' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'v.b' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`c` AS `c` from `test`.`t2` where (<in_optimizer>(`test`.`t2`.`b`,<exists>(select `test`.`t2`.`b` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` <= `test`.`t2`.`d`) and (<cache>(`test`.`t2`.`b`) = `test`.`t2`.`b`)))) and (`test`.`t2`.`b` < 1))
+Note 1003 select `test`.`t2`.`c` AS `c` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`b`,<exists>(select `test`.`t2`.`b` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` <= `test`.`t2`.`d` and <cache>(`test`.`t2`.`b`) = `test`.`t2`.`b`)) and `test`.`t2`.`b` < 1
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
drop view v;
@@ -544,7 +544,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.alias2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.alias1.b' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`alias1`.`a` AS `a`,`test`.`alias1`.`b` AS `b`,`test`.`alias2`.`a` AS `a`,`test`.`alias2`.`b` AS `b` from `test`.`t1` `alias1` join `test`.`t1` `alias2` where (<expr_cache><`test`.`alias1`.`b`,`test`.`alias2`.`a`>(<in_optimizer>(`test`.`alias1`.`b`,<exists>(select `test`.`t2`.`c` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` <= `test`.`alias2`.`a`) and (<cache>(`test`.`alias1`.`b`) = `test`.`t2`.`c`))))) or (`test`.`alias1`.`a` = 'foo'))
+Note 1003 select `test`.`alias1`.`a` AS `a`,`test`.`alias1`.`b` AS `b`,`test`.`alias2`.`a` AS `a`,`test`.`alias2`.`b` AS `b` from `test`.`t1` `alias1` join `test`.`t1` `alias2` where <expr_cache><`test`.`alias1`.`b`,`test`.`alias2`.`a`>(<in_optimizer>(`test`.`alias1`.`b`,<exists>(select `test`.`t2`.`c` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` <= `test`.`alias2`.`a` and <cache>(`test`.`alias1`.`b`) = `test`.`t2`.`c`))) or `test`.`alias1`.`a` = 'foo'
drop table t1,t2;
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
@@ -568,7 +568,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (not(((`test`.`t1`.`a` is not null) and <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`b` from `test`.`t2` where ((`test`.`t2`.`b` is not null) and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`b`))))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where !(`test`.`t1`.`a` is not null and <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`b` from `test`.`t2` where `test`.`t2`.`b` is not null and <cache>(`test`.`t1`.`a`) = `test`.`t2`.`b`))))
drop table t1,t2;
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
@@ -592,7 +592,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.alias.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.alias.b' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`alias`.`a` AS `a`,`test`.`alias`.`b` AS `b` from `test`.`t1` `alias` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`alias`.`b`) and (`test`.`alias`.`b` > `test`.`alias`.`a`))
+Note 1003 select `test`.`alias`.`a` AS `a`,`test`.`alias`.`b` AS `b` from `test`.`t1` `alias` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`alias`.`b` and `test`.`alias`.`b` > `test`.`alias`.`a`
SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
SET optimizer_switch = 'exists_to_in=on,materialization=on,semijoin=off';
SELECT * FROM t1 AS alias
@@ -608,7 +608,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.alias.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.alias.b' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`alias`.`a` AS `a`,`test`.`alias`.`b` AS `b` from `test`.`t1` `alias` where <in_optimizer>(`test`.`alias`.`b`,<exists>(select `test`.`t1`.`a` from `test`.`t1` where ((`test`.`t1`.`a` > `test`.`alias`.`a`) and (<cache>(`test`.`alias`.`b`) = `test`.`t1`.`a`))))
+Note 1003 select `test`.`alias`.`a` AS `a`,`test`.`alias`.`b` AS `b` from `test`.`t1` `alias` where <in_optimizer>(`test`.`alias`.`b`,<exists>(select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` > `test`.`alias`.`a` and <cache>(`test`.`alias`.`b`) = `test`.`t1`.`a`))
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 );
@@ -623,7 +623,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.alias.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.alias.b' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`alias`.`a` AS `a`,`test`.`alias`.`b` AS `b` from `test`.`t1` `alias` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`alias`.`b`) and (`test`.`alias`.`b` > `test`.`alias`.`a`))
+Note 1003 select `test`.`alias`.`a` AS `a`,`test`.`alias`.`b` AS `b` from `test`.`t1` `alias` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`alias`.`b` and `test`.`alias`.`b` > `test`.`alias`.`a`
drop table t1;
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
@@ -661,7 +661,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.alias1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.alias2.b' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`alias1`.`a` AS `a`,`test`.`alias2`.`b` AS `b` from `test`.`t1` `alias1` join `test`.`t2` `alias2` where (<expr_cache><`test`.`alias1`.`a`,`test`.`alias2`.`b`>(<in_optimizer>(`test`.`alias1`.`a`,<exists>(select `test`.`t2`.`b` from `test`.`t2` where ((`test`.`t2`.`b` > `test`.`alias2`.`b`) and (<cache>(`test`.`alias1`.`a`) = `test`.`t2`.`b`))))) or (`test`.`alias1`.`a` = 5))
+Note 1003 select `test`.`alias1`.`a` AS `a`,`test`.`alias2`.`b` AS `b` from `test`.`t1` `alias1` join `test`.`t2` `alias2` where <expr_cache><`test`.`alias1`.`a`,`test`.`alias2`.`b`>(<in_optimizer>(`test`.`alias1`.`a`,<exists>(select `test`.`t2`.`b` from `test`.`t2` where `test`.`t2`.`b` > `test`.`alias2`.`b` and <cache>(`test`.`alias1`.`a`) = `test`.`t2`.`b`))) or `test`.`alias1`.`a` = 5
drop table t1, t2;
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
@@ -905,7 +905,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'sq1.pk' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'sq1.f1' of SELECT #3 was resolved in SELECT #1
-Note 1003 select straight_join `test`.`t1`.`f2` AS `f2` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`,`test`.`t1`.`pk`>(exists(select 1 from `test`.`t1` `sq2` semi join (`test`.`t1`) where ((`test`.`sq2`.`f1` = `test`.`t1`.`f1`) and (`test`.`t1`.`pk` = `test`.`t1`.`f1`))))
+Note 1003 select straight_join `test`.`t1`.`f2` AS `f2` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`,`test`.`t1`.`pk`>(exists(select 1 from `test`.`t1` `sq2` semi join (`test`.`t1`) where `test`.`sq2`.`f1` = `test`.`t1`.`f1` and `test`.`t1`.`pk` = `test`.`t1`.`f1`))
SELECT STRAIGHT_JOIN sq1.f2
FROM ( SELECT * FROM t1 ) AS sq1
WHERE EXISTS ( SELECT * FROM t1 AS sq2
@@ -925,7 +925,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'sq1.pk' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'sq1.f1' of SELECT #3 was resolved in SELECT #1
-Note 1003 select straight_join `test`.`t1`.`f2` AS `f2` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`,`test`.`t1`.`pk`>(<in_optimizer>(`test`.`t1`.`f1`,<exists>(select `test`.`sq2`.`f1` from `test`.`t1` `sq2` semi join (`test`.`t1`) where ((`test`.`t1`.`pk` = `test`.`t1`.`f1`) and (<cache>(`test`.`t1`.`f1`) = `test`.`sq2`.`f1`)))))
+Note 1003 select straight_join `test`.`t1`.`f2` AS `f2` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`,`test`.`t1`.`pk`>(<in_optimizer>(`test`.`t1`.`f1`,<exists>(select `test`.`sq2`.`f1` from `test`.`t1` `sq2` semi join (`test`.`t1`) where `test`.`t1`.`pk` = `test`.`t1`.`f1` and <cache>(`test`.`t1`.`f1`) = `test`.`sq2`.`f1`)))
SELECT STRAIGHT_JOIN sq1.f2
FROM ( SELECT * FROM t1 ) AS sq1
WHERE EXISTS ( SELECT * FROM t1 AS sq2
diff --git a/mysql-test/r/subselect_extra.result b/mysql-test/r/subselect_extra.result
index 48b80e02e1a..73642c09324 100644
--- a/mysql-test/r/subselect_extra.result
+++ b/mysql-test/r/subselect_extra.result
@@ -71,7 +71,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY x1 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` semi join (`test`.`t1` `x1`) where ((`test`.`x1`.`id` = `test`.`t1`.`id`) and (`test`.`t1`.`cur_date` = 0))
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` semi join (`test`.`t1` `x1`) where `test`.`x1`.`id` = `test`.`t1`.`id` and `test`.`t1`.`cur_date` = 0
select * from t1
where id in (select id from t1 as x1 where (t1.cur_date is null));
id cur_date
@@ -83,7 +83,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY x1 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t2); Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` semi join (`test`.`t2` `x1`) where ((`test`.`x1`.`id` = `test`.`t2`.`id`) and (`test`.`t2`.`cur_date` = 0))
+Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` semi join (`test`.`t2` `x1`) where `test`.`x1`.`id` = `test`.`t2`.`id` and `test`.`t2`.`cur_date` = 0
select * from t2
where id in (select id from t2 as x1 where (t2.cur_date is null));
id cur_date
diff --git a/mysql-test/r/subselect_extra_no_semijoin.result b/mysql-test/r/subselect_extra_no_semijoin.result
index 79bca388181..8ed260cb31a 100644
--- a/mysql-test/r/subselect_extra_no_semijoin.result
+++ b/mysql-test/r/subselect_extra_no_semijoin.result
@@ -75,7 +75,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY x1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` where <expr_cache><`test`.`t1`.`id`,`test`.`t1`.`cur_date`>(<in_optimizer>(`test`.`t1`.`id`,<exists>(select `test`.`x1`.`id` from `test`.`t1` `x1` where ((`test`.`t1`.`cur_date` = 0) and (<cache>(`test`.`t1`.`id`) = `test`.`x1`.`id`)))))
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` where <expr_cache><`test`.`t1`.`id`,`test`.`t1`.`cur_date`>(<in_optimizer>(`test`.`t1`.`id`,<exists>(select `test`.`x1`.`id` from `test`.`t1` `x1` where `test`.`t1`.`cur_date` = 0 and <cache>(`test`.`t1`.`id`) = `test`.`x1`.`id`)))
select * from t1
where id in (select id from t1 as x1 where (t1.cur_date is null));
id cur_date
@@ -87,7 +87,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY x1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` where <expr_cache><`test`.`t2`.`id`,`test`.`t2`.`cur_date`>(<in_optimizer>(`test`.`t2`.`id`,<exists>(select `test`.`x1`.`id` from `test`.`t2` `x1` where ((`test`.`t2`.`cur_date` = 0) and (<cache>(`test`.`t2`.`id`) = `test`.`x1`.`id`)))))
+Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` where <expr_cache><`test`.`t2`.`id`,`test`.`t2`.`cur_date`>(<in_optimizer>(`test`.`t2`.`id`,<exists>(select `test`.`x1`.`id` from `test`.`t2` `x1` where `test`.`t2`.`cur_date` = 0 and <cache>(`test`.`t2`.`id`) = `test`.`x1`.`id`)))
select * from t2
where id in (select id from t2 as x1 where (t2.cur_date is null));
id cur_date
@@ -351,7 +351,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
3 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <expr_cache><0>(<in_optimizer>(0,<exists>(select 0 from dual where (<cache>(0) = 0))))
+Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <expr_cache><0>(<in_optimizer>(0,<exists>(select 0 from dual where <cache>(0) = 0)))
SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0
WHERE t.a IN (SELECT b FROM t1);
a a b
@@ -364,7 +364,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <expr_cache><0>(<in_optimizer>(0,<exists>(select 0 from dual where (<cache>(0) = 0))))
+Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <expr_cache><0>(<in_optimizer>(0,<exists>(select 0 from dual where <cache>(0) = 0)))
DROP VIEW v1;
DROP TABLE t1,t2;
#
@@ -436,7 +436,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1
2 DEPENDENT SUBQUERY <derived3> ALL NULL NULL NULL NULL 3 Using where
-3 DERIVED t1 ALL NULL NULL NULL NULL 3
+3 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where
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);
@@ -451,7 +451,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1
2 DEPENDENT SUBQUERY <derived3> ref key1 key1 8 const,const 0 Using where
-3 DERIVED t1 ALL NULL NULL NULL NULL 3
+3 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where
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);
diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result
index 240a6ab47e4..ec7f2c0a3d5 100644
--- a/mysql-test/r/subselect_innodb.result
+++ b/mysql-test/r/subselect_innodb.result
@@ -613,5 +613,5 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join)
3 MATERIALIZED t4 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t2`.`f2` AS `f2`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` join `test`.`t2` semi join (`test`.`t4`) join `test`.`t3` where ((`test`.`t4`.`f4` = 1) and (`test`.`t1`.`f1` >= `test`.`t2`.`f2`))
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t2`.`f2` AS `f2`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` join `test`.`t2` semi join (`test`.`t4`) join `test`.`t3` where `test`.`t4`.`f4` = 1 and `test`.`t1`.`f1` >= `test`.`t2`.`f2`
DROP TABLE t1,t2,t3,t4;
diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result
index 924317dbcd1..919b31055d6 100644
--- a/mysql-test/r/subselect_mat.result
+++ b/mysql-test/r/subselect_mat.result
@@ -50,7 +50,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (select `test`.`t2`.`b1` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (select `test`.`t2`.`b1` from `test`.`t2` where `test`.`t2`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1`))))
select * from t1 where a1 in (select b1 from t2 where b1 > '0');
a1 a2
1 - 01 2 - 01
@@ -61,7 +61,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (select `test`.`t2`.`b1` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (select `test`.`t2`.`b1` from `test`.`t2` where `test`.`t2`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1`))))
select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1);
a1 a2
1 - 01 2 - 01
@@ -72,7 +72,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a2` = `<subquery2>`.`b2`))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`b2`))))
select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2);
a1 a2
1 - 01 2 - 01
@@ -83,7 +83,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,min(`test`.`t2`.`b2`) from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a2` = `<subquery2>`.`min(b2)`))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,min(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`b1` > '0' group by `test`.`t2`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`min(b2)`))))
select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1);
a1 a2
1 - 01 2 - 01
@@ -94,7 +94,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1i index NULL _it1_idx # NULL 3 100.00 Using where;
2 MATERIALIZED t2i index it2i1,it2i3 it2i1 # NULL 5 100.00 Using where;
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`>(<in_optimizer>(`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( <materialize> (select `test`.`t2i`.`b1` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery2>`.`b1`))))))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`>(<in_optimizer>(`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( <materialize> (select `test`.`t2i`.`b1` from `test`.`t2i` where `test`.`t2i`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery2>`.`b1`))))
select * from t1i where a1 in (select b1 from t2i where b1 > '0');
a1 a2
1 - 01 2 - 01
@@ -105,7 +105,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1i index NULL # 18 # 3 100.00 #
2 MATERIALIZED t2i range it2i1,it2i3 # 9 # 5 100.00 #
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`>(<in_optimizer>(`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( <materialize> (select max(`test`.`t2i`.`b1`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery2>`.`max(b1)`))))))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`>(<in_optimizer>(`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( <materialize> (select max(`test`.`t2i`.`b1`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery2>`.`max(b1)`))))
select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1);
a1 a2
1 - 01 2 - 01
@@ -116,7 +116,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1i index NULL _it1_idx # NULL 3 100.00 Using where;
2 MATERIALIZED t2i index it2i1,it2i3 it2i3 # NULL 5 100.00 Using where;
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1i`.`a2` = `<subquery2>`.`b2`))))))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery2>`.`b1` and `test`.`t1i`.`a2` = `<subquery2>`.`b2`))))
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
a1 a2
1 - 01 2 - 01
@@ -127,7 +127,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1i index NULL # # # 3 100.00 #
2 MATERIALIZED t2i range it2i1,it2i3 # # # 3 100.00 #
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1i`.`a2` = `<subquery2>`.`max(b2)`))))))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery2>`.`b1` and `test`.`t1i`.`a2` = `<subquery2>`.`max(b2)`))))
select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' group by b1);
a1 a2
1 - 01 2 - 01
@@ -138,7 +138,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1i index NULL # # # 3 100.00 #
2 MATERIALIZED t2i range it2i1,it2i3 # # # 3 100.00 #
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1i`.`a2` = `<subquery2>`.`min(b2)`))))))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery2>`.`b1` and `test`.`t1i`.`a2` = `<subquery2>`.`min(b2)`))))
select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
a1 a2
1 - 01 2 - 01
@@ -149,7 +149,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2i range NULL it2i3 9 NULL 3 100.00 Using index for group-by
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a2` = `<subquery2>`.`max(b2)`))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`max(b2)`))))
select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1);
a1 a2
1 - 01 2 - 01
@@ -178,7 +178,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2i range it2i1,it2i3 it2i3 18 NULL 3 100.00 Using where; Using index for group-by
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a2` = `<subquery2>`.`min(b2)`))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`min(b2)`))))
select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
a1 a2
1 - 01 2 - 01
@@ -225,7 +225,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a2` = `<subquery2>`.`b2`))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`b2`))))
select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2);
a1 a2
1 - 01 2 - 01
@@ -236,7 +236,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1i index NULL it1i3 18 NULL 3 100.00 Using where; Using index
2 MATERIALIZED t2i index NULL it2i3 18 NULL 5 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1i`.`a2` = `<subquery2>`.`b2`))))))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery2>`.`b1` and `test`.`t1i`.`a2` = `<subquery2>`.`b2`))))
select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2);
a1 a2
1 - 01 2 - 01
@@ -291,7 +291,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4 MATERIALIZED t2i index it2i2 it2i3 18 NULL 5 100.00 Using where; Using index
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (`test`.`t2`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a2` = `<subquery2>`.`b2`)))))) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`,`test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `<subquery4>`.`b1`) and (`test`.`t3`.`c2` = `<subquery4>`.`b2`)))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery3>`.`c1`) and (`test`.`t1`.`a2` = `<subquery3>`.`c2`)))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`b2`)))) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`,`test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where `test`.`t3`.`c1` = `<subquery4>`.`b1` and `test`.`t3`.`c2` = `<subquery4>`.`b2`)))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery3>`.`c1` and `test`.`t1`.`a2` = `<subquery3>`.`c2`))))
select * from t1
where (a1, a2) in (select b1, b2 from t2 where b1 > '0') and
(a1, a2) in (select c1, c2 from t3
@@ -310,7 +310,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4 MATERIALIZED t2i index it2i2 # # # 5 100.00 #
2 MATERIALIZED t2i index it2i1,it2i3 # # # 5 100.00 #
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where (<expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1i`.`a2` = `<subquery2>`.`b2`)))))) and <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t3i`.`c1`,`test`.`t3i`.`c2` from `test`.`t3i` where <expr_cache><`test`.`t3i`.`c1`,`test`.`t3i`.`c2`>(<in_optimizer>((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3i`.`c1` in <temporary table> on distinct_key where ((`test`.`t3i`.`c1` = `<subquery4>`.`b1`) and (`test`.`t3i`.`c2` = `<subquery4>`.`b2`)))))) ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery3>`.`c1`) and (`test`.`t1i`.`a2` = `<subquery3>`.`c2`)))))))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery2>`.`b1` and `test`.`t1i`.`a2` = `<subquery2>`.`b2`)))) and <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t3i`.`c1`,`test`.`t3i`.`c2` from `test`.`t3i` where <expr_cache><`test`.`t3i`.`c1`,`test`.`t3i`.`c2`>(<in_optimizer>((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), <primary_index_lookup>(`test`.`t3i`.`c1` in <temporary table> on distinct_key where `test`.`t3i`.`c1` = `<subquery4>`.`b1` and `test`.`t3i`.`c2` = `<subquery4>`.`b2`)))) ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery3>`.`c1` and `test`.`t1i`.`a2` = `<subquery3>`.`c2`))))
select * from t1i
where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and
(a1, a2) in (select c1, c2 from t3i
@@ -333,7 +333,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (<expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`)))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a2` = `<subquery2>`.`b2`)))))) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`,`test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `<subquery6>`.`b1`) and (`test`.`t3`.`c2` = `<subquery6>`.`b2`)))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery5>`.`c1`) and (`test`.`t1`.`a2` = `<subquery5>`.`c2`)))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%02' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery3>`.`c2`)))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%03' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery4>`.`c2`)))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`b2`)))) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`,`test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where `test`.`t3`.`c1` = `<subquery6>`.`b1` and `test`.`t3`.`c2` = `<subquery6>`.`b2`)))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery5>`.`c1` and `test`.`t1`.`a2` = `<subquery5>`.`c2`))))
select * from t1
where (a1, a2) in (select b1, b2 from t2
where b2 in (select c2 from t3 where c2 LIKE '%02') or
@@ -358,7 +358,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3c`.`c1`,`test`.`t3c`.`c2` from `test`.`t3` `t3c` where <expr_cache><`test`.`t3c`.`c1`,`test`.`t3c`.`c2`>(<in_optimizer>((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),(`test`.`t3c`.`c1`,`test`.`t3c`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3c`.`c1` in <temporary table> on distinct_key where ((`test`.`t3c`.`c1` = `<subquery6>`.`b1`) and (`test`.`t3c`.`c2` = `<subquery6>`.`b2`)))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery5>`.`c1`) and (`test`.`t1`.`a2` = `<subquery5>`.`c2`)))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where `test`.`t3a`.`c1` = `test`.`t1`.`a1` and <cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where `test`.`t3b`.`c2` like '%03' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery4>`.`c2`))))) and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1` and <cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3c`.`c1`,`test`.`t3c`.`c2` from `test`.`t3` `t3c` where <expr_cache><`test`.`t3c`.`c1`,`test`.`t3c`.`c2`>(<in_optimizer>((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),(`test`.`t3c`.`c1`,`test`.`t3c`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), <primary_index_lookup>(`test`.`t3c`.`c1` in <temporary table> on distinct_key where `test`.`t3c`.`c1` = `<subquery6>`.`b1` and `test`.`t3c`.`c2` = `<subquery6>`.`b2`)))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery5>`.`c1` and `test`.`t1`.`a2` = `<subquery5>`.`c2`))))
select * from t1
where (a1, a2) in (select b1, b2 from t2
where b2 in (select c2 from t3 t3a where c1 = a1) or
@@ -394,7 +394,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
8 MATERIALIZED t2i index it2i1,it2i3 # # # 5 100.00 #
NULL UNION RESULT <union1,7> ALL NULL # # # NULL NULL #
Warnings:
-Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (<expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`)))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a2` = `<subquery2>`.`b2`)))))) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`,`test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `<subquery6>`.`b1`) and (`test`.`t3`.`c2` = `<subquery6>`.`b2`)))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery5>`.`c1`) and (`test`.`t1`.`a2` = `<subquery5>`.`c2`)))))))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where (<expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery8>`.`b1`) and (`test`.`t1i`.`a2` = `<subquery8>`.`b2`)))))) and <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t3i`.`c1`,`test`.`t3i`.`c2` from `test`.`t3i` where <expr_cache><`test`.`t3i`.`c1`,`test`.`t3i`.`c2`>(<in_optimizer>((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3i`.`c1` in <temporary table> on distinct_key where ((`test`.`t3i`.`c1` = `<subquery10>`.`b1`) and (`test`.`t3i`.`c2` = `<subquery10>`.`b2`)))))) ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery9>`.`c1`) and (`test`.`t1i`.`a2` = `<subquery9>`.`c2`))))))))
+Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%02' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery3>`.`c2`)))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%03' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery4>`.`c2`)))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`b2`)))) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`,`test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where `test`.`t3`.`c1` = `<subquery6>`.`b1` and `test`.`t3`.`c2` = `<subquery6>`.`b2`)))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery5>`.`c1` and `test`.`t1`.`a2` = `<subquery5>`.`c2`))))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery8>`.`b1` and `test`.`t1i`.`a2` = `<subquery8>`.`b2`)))) and <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (select `test`.`t3i`.`c1`,`test`.`t3i`.`c2` from `test`.`t3i` where <expr_cache><`test`.`t3i`.`c1`,`test`.`t3i`.`c2`>(<in_optimizer>((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), <primary_index_lookup>(`test`.`t3i`.`c1` in <temporary table> on distinct_key where `test`.`t3i`.`c1` = `<subquery10>`.`b1` and `test`.`t3i`.`c2` = `<subquery10>`.`b2`)))) ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery9>`.`c1` and `test`.`t1i`.`a2` = `<subquery9>`.`c2`)))))
(select * from t1
where (a1, a2) in (select b1, b2 from t2
where b2 in (select c2 from t3 where c2 LIKE '%02') or
@@ -423,7 +423,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`,`test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `<subquery5>`.`b1`) and (`test`.`t3`.`c2` = `<subquery5>`.`b2`)))))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery4>`.`c1`) and (`test`.`t1`.`a2` = `<subquery4>`.`c2`)))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where `test`.`t1`.`a1` > '0' and <cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1` and <cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2` union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` < '9' and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1` and <cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`,`test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where `test`.`t3`.`c1` = `<subquery5>`.`b1` and `test`.`t3`.`c2` = `<subquery5>`.`b2`)))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery4>`.`c1` and `test`.`t1`.`a2` = `<subquery4>`.`c2`))))
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
@@ -446,7 +446,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`c1` = `test`.`t1`.`a1`) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and <expr_cache><`test`.`t3`.`c1`,`test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`,`test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where (`test`.`t2i`.`b2` > '0') ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `<subquery5>`.`b1`) and (`test`.`t3`.`c2` = `<subquery5>`.`b2`)))))) ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where ((`test`.`t3`.`c1` = `<subquery4>`.`c1`) and (`test`.`t3`.`c2` = `<subquery4>`.`c2`)))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` join `test`.`t3` where `test`.`t3`.`c1` = `test`.`t1`.`a1` and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where `test`.`t1`.`a1` > '0' and <cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1` and <cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2` union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` < '9' and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1` and <cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and <expr_cache><`test`.`t3`.`c1`,`test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`,`test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where `test`.`t3`.`c1` = `<subquery5>`.`b1` and `test`.`t3`.`c2` = `<subquery5>`.`b2`)))) ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where `test`.`t3`.`c1` = `<subquery4>`.`c1` and `test`.`t3`.`c2` = `<subquery4>`.`c2`))))
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
@@ -468,7 +468,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`>(<in_optimizer>(`test`.`t3`.`c1`,<exists>(select `test`.`t1`.`a1` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t3`.`c1`) = `test`.`t1`.`a1`)) union select `test`.`t2`.`b1` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t3`.`c1`) = `test`.`t2`.`b1`)))))
+Note 1003 select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`>(<in_optimizer>(`test`.`t3`.`c1`,<exists>(select `test`.`t1`.`a1` from `test`.`t1` where `test`.`t1`.`a1` > '0' and <cache>(`test`.`t3`.`c1`) = `test`.`t1`.`a1` union select `test`.`t2`.`b1` from `test`.`t2` where `test`.`t2`.`b1` < '9' and <cache>(`test`.`t3`.`c1`) = `test`.`t2`.`b1`)))
select * from t3
where c1 in (select a1 from t1 where a1 > '0' UNION select b1 from t2 where b1 < '9');
c1 c2
@@ -492,14 +492,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a2' of SELECT #6 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (<expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t3c`.`c1`,`test`.`t3c`.`c2` from `test`.`t3` `t3c` where (<expr_cache><`test`.`t3c`.`c1`,`test`.`t3c`.`c2`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),<exists>(<index_lookup>(<cache>(`test`.`t3c`.`c1`) in t2i on it2i3 where (((`test`.`t2i`.`b2` > '0') or (`test`.`t2i`.`b2` = `test`.`t1`.`a2`)) and (<cache>(`test`.`t3c`.`c1`) = `test`.`t2i`.`b1`) and (<cache>(`test`.`t3c`.`c2`) = `test`.`t2i`.`b2`)))))) and (<cache>(`test`.`t1`.`a1`) = `test`.`t3c`.`c1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t3c`.`c2`))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where `test`.`t3a`.`c1` = `test`.`t1`.`a1` and <cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where `test`.`t3b`.`c2` like '%03' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery4>`.`c2`))))) and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1` and <cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t3c`.`c1`,`test`.`t3c`.`c2` from `test`.`t3` `t3c` where <expr_cache><`test`.`t3c`.`c1`,`test`.`t3c`.`c2`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),<exists>(<index_lookup>(<cache>(`test`.`t3c`.`c1`) in t2i on it2i3 where (`test`.`t2i`.`b2` > '0' or `test`.`t2i`.`b2` = `test`.`t1`.`a2`) and <cache>(`test`.`t3c`.`c1`) = `test`.`t2i`.`b1` and <cache>(`test`.`t3c`.`c2`) = `test`.`t2i`.`b2`)))) and <cache>(`test`.`t1`.`a1`) = `test`.`t3c`.`c1` and <cache>(`test`.`t1`.`a2`) = `test`.`t3c`.`c2`)))
explain extended
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having (((<cache>(`test`.`t1`.`a1`) = '1 - 01') or isnull('1 - 01')) and ((<cache>(`test`.`t1`.`a2`) = '2 - 01') or isnull('2 - 01')) and <is_not_null_test>('1 - 01') and <is_not_null_test>('2 - 01')))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having (<cache>(`test`.`t1`.`a1`) = '1 - 01' or '1 - 01' is null) and (<cache>(`test`.`t1`.`a2`) = '2 - 01' or '2 - 01' is null) and '1 - 01' is null and '2 - 01' is null)))
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01');
a1 a2
1 - 01 2 - 01
@@ -509,7 +509,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having (((<cache>(`test`.`t1`.`a1`) = '1 - 01') or isnull('1 - 01')) and ((<cache>(`test`.`t1`.`a2`) = '2 - 01') or isnull('2 - 01')) and <is_not_null_test>('1 - 01') and <is_not_null_test>('2 - 01')))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having (<cache>(`test`.`t1`.`a1`) = '1 - 01' or '1 - 01' is null) and (<cache>(`test`.`t1`.`a2`) = '2 - 01' or '2 - 01' is null) and '1 - 01' is null and '2 - 01' is null)))
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01' from dual);
a1 a2
1 - 01 2 - 01
@@ -541,7 +541,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using temporary; Using filesort
2 DEPENDENT SUBQUERY columns unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by <expr_cache><`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t1`.`a1`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`a1`) in columns on PRIMARY where trigcond((<cache>(`test`.`t1`.`a1`) = `test`.`columns`.`col`))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by <expr_cache><`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t1`.`a1`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`a1`) in columns on PRIMARY where trigcond(<cache>(`test`.`t1`.`a1`) = `test`.`columns`.`col`)))))
select * from t1 group by (a1 in (select col from columns));
a1 a2
1 - 00 2 - 00
@@ -602,7 +602,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`>(<in_optimizer>(`test`.`t1_16`.`a1`,<exists>(select `test`.`t2_16`.`b1` from `test`.`t2_16` where ((`test`.`t2_16`.`b1` > '0') and (<cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`)))))
+Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`>(<in_optimizer>(`test`.`t1_16`.`a1`,<exists>(select `test`.`t2_16`.`b1` from `test`.`t2_16` where `test`.`t2_16`.`b1` > '0' and <cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`)))
select left(a1,7), left(a2,7)
from t1_16
where a1 in (select b1 from t2_16 where b1 > '0');
@@ -616,7 +616,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`>(<in_optimizer>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),<exists>(select `test`.`t2_16`.`b1`,`test`.`t2_16`.`b2` from `test`.`t2_16` where ((`test`.`t2_16`.`b1` > '0') and (<cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`) and (<cache>(`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`)))))
+Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`>(<in_optimizer>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),<exists>(select `test`.`t2_16`.`b1`,`test`.`t2_16`.`b2` from `test`.`t2_16` where `test`.`t2_16`.`b1` > '0' and <cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1` and <cache>(`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`)))
select left(a1,7), left(a2,7)
from t1_16
where (a1,a2) in (select b1, b2 from t2_16 where b1 > '0');
@@ -630,7 +630,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`>(<in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( <materialize> (select substr(`test`.`t2_16`.`b1`,1,16) from `test`.`t2_16` where (`test`.`t2_16`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1_16`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_16`.`a1` = `<subquery2>`.`substring(b1,1,16)`))))))
+Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`>(<in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( <materialize> (select substr(`test`.`t2_16`.`b1`,1,16) from `test`.`t2_16` where `test`.`t2_16`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1_16`.`a1` in <temporary table> on distinct_key where `test`.`t1_16`.`a1` = `<subquery2>`.`substring(b1,1,16)`))))
select left(a1,7), left(a2,7)
from t1_16
where a1 in (select substring(b1,1,16) from t2_16 where b1 > '0');
@@ -644,7 +644,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using filesort
Warnings:
-Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`>(<in_optimizer>(`test`.`t1_16`.`a1`,<exists>(select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2` having (<cache>(`test`.`t1_16`.`a1`) = <ref_null_helper>(group_concat(`test`.`t2_16`.`b1` separator ','))))))
+Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`>(<in_optimizer>(`test`.`t1_16`.`a1`,<exists>(select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2` having <cache>(`test`.`t1_16`.`a1`) = <ref_null_helper>(group_concat(`test`.`t2_16`.`b1` separator ',')))))
select left(a1,7), left(a2,7)
from t1_16
where a1 in (select group_concat(b1) from t2_16 group by b2);
@@ -659,7 +659,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2_16 ALL NULL NULL NULL NULL 3 100.00 Using filesort
Warnings:
-Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`>(<in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( <materialize> (select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2` ), <primary_index_lookup>(`test`.`t1_16`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_16`.`a1` = `<subquery2>`.`group_concat(b1)`))))))
+Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`>(<in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( <materialize> (select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2` ), <primary_index_lookup>(`test`.`t1_16`.`a1` in <temporary table> on distinct_key where `test`.`t1_16`.`a1` = `<subquery2>`.`group_concat(b1)`))))
select left(a1,7), left(a2,7)
from t1_16
where a1 in (select group_concat(b1) from t2_16 group by b2);
@@ -681,7 +681,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><concat(`test`.`t1`.`a1`,'x')>(<in_optimizer>(concat(`test`.`t1`.`a1`,'x'),<exists>(select left(`test`.`t1_16`.`a1`,8) from `test`.`t1_16` where (<expr_cache><`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`>(<in_optimizer>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),<exists>(select `test`.`t2_16`.`b1`,`test`.`t2_16`.`b2` from `test`.`t2_16` join `test`.`t2` where ((`test`.`t2`.`b2` = substr(`test`.`t2_16`.`b2`,1,6)) and <expr_cache><`test`.`t2`.`b1`>(<in_optimizer>(`test`.`t2`.`b1`,`test`.`t2`.`b1` in ( <materialize> (select `test`.`t3`.`c1` from `test`.`t3` where (`test`.`t3`.`c2` > '0') ), <primary_index_lookup>(`test`.`t2`.`b1` in <temporary table> on distinct_key where ((`test`.`t2`.`b1` = `<subquery4>`.`c1`)))))) and (<cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`) and (<cache>(`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`))))) and (<cache>(concat(`test`.`t1`.`a1`,'x')) = left(`test`.`t1_16`.`a1`,8))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><concat(`test`.`t1`.`a1`,'x')>(<in_optimizer>(concat(`test`.`t1`.`a1`,'x'),<exists>(select left(`test`.`t1_16`.`a1`,8) from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`>(<in_optimizer>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),<exists>(select `test`.`t2_16`.`b1`,`test`.`t2_16`.`b2` from `test`.`t2_16` join `test`.`t2` where `test`.`t2`.`b2` = substr(`test`.`t2_16`.`b2`,1,6) and <expr_cache><`test`.`t2`.`b1`>(<in_optimizer>(`test`.`t2`.`b1`,`test`.`t2`.`b1` in ( <materialize> (select `test`.`t3`.`c1` from `test`.`t3` where `test`.`t3`.`c2` > '0' ), <primary_index_lookup>(`test`.`t2`.`b1` in <temporary table> on distinct_key where `test`.`t2`.`b1` = `<subquery4>`.`c1`)))) and <cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1` and <cache>(`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`))) and <cache>(concat(`test`.`t1`.`a1`,'x')) = left(`test`.`t1_16`.`a1`,8))))
drop table t1_16, t2_16, t3_16;
set @blob_len = 512;
set @suffix_len = @blob_len - @prefix_len;
@@ -715,7 +715,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <expr_cache><`test`.`t1_512`.`a1`>(<in_optimizer>(`test`.`t1_512`.`a1`,<exists>(select `test`.`t2_512`.`b1` from `test`.`t2_512` where ((`test`.`t2_512`.`b1` > '0') and (<cache>(`test`.`t1_512`.`a1`) = `test`.`t2_512`.`b1`)))))
+Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <expr_cache><`test`.`t1_512`.`a1`>(<in_optimizer>(`test`.`t1_512`.`a1`,<exists>(select `test`.`t2_512`.`b1` from `test`.`t2_512` where `test`.`t2_512`.`b1` > '0' and <cache>(`test`.`t1_512`.`a1`) = `test`.`t2_512`.`b1`)))
select left(a1,7), left(a2,7)
from t1_512
where a1 in (select b1 from t2_512 where b1 > '0');
@@ -729,7 +729,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <expr_cache><`test`.`t1_512`.`a1`,`test`.`t1_512`.`a2`>(<in_optimizer>((`test`.`t1_512`.`a1`,`test`.`t1_512`.`a2`),<exists>(select `test`.`t2_512`.`b1`,`test`.`t2_512`.`b2` from `test`.`t2_512` where ((`test`.`t2_512`.`b1` > '0') and (<cache>(`test`.`t1_512`.`a1`) = `test`.`t2_512`.`b1`) and (<cache>(`test`.`t1_512`.`a2`) = `test`.`t2_512`.`b2`)))))
+Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <expr_cache><`test`.`t1_512`.`a1`,`test`.`t1_512`.`a2`>(<in_optimizer>((`test`.`t1_512`.`a1`,`test`.`t1_512`.`a2`),<exists>(select `test`.`t2_512`.`b1`,`test`.`t2_512`.`b2` from `test`.`t2_512` where `test`.`t2_512`.`b1` > '0' and <cache>(`test`.`t1_512`.`a1`) = `test`.`t2_512`.`b1` and <cache>(`test`.`t1_512`.`a2`) = `test`.`t2_512`.`b2`)))
select left(a1,7), left(a2,7)
from t1_512
where (a1,a2) in (select b1, b2 from t2_512 where b1 > '0');
@@ -743,7 +743,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <expr_cache><`test`.`t1_512`.`a1`>(<in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select substr(`test`.`t2_512`.`b1`,1,512) from `test`.`t2_512` where (`test`.`t2_512`.`b1` > '0') ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_512`.`a1` = `<subquery2>`.`substring(b1,1,512)`))))))
+Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <expr_cache><`test`.`t1_512`.`a1`>(<in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select substr(`test`.`t2_512`.`b1`,1,512) from `test`.`t2_512` where `test`.`t2_512`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where `test`.`t1_512`.`a1` = `<subquery2>`.`substring(b1,1,512)`))))
select left(a1,7), left(a2,7)
from t1_512
where a1 in (select substring(b1,1,512) from t2_512 where b1 > '0');
@@ -757,7 +757,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort
Warnings:
-Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <expr_cache><`test`.`t1_512`.`a1`>(<in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_512`.`a1` = `<subquery2>`.`group_concat(b1)`))))))
+Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <expr_cache><`test`.`t1_512`.`a1`>(<in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where `test`.`t1_512`.`a1` = `<subquery2>`.`group_concat(b1)`))))
select left(a1,7), left(a2,7)
from t1_512
where a1 in (select group_concat(b1) from t2_512 group by b2);
@@ -774,7 +774,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort
Warnings:
-Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <expr_cache><`test`.`t1_512`.`a1`>(<in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_512`.`a1` = `<subquery2>`.`group_concat(b1)`))))))
+Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <expr_cache><`test`.`t1_512`.`a1`>(<in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where `test`.`t1_512`.`a1` = `<subquery2>`.`group_concat(b1)`))))
select left(a1,7), left(a2,7)
from t1_512
where a1 in (select group_concat(b1) from t2_512 group by b2);
@@ -816,7 +816,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <expr_cache><`test`.`t1_1024`.`a1`>(<in_optimizer>(`test`.`t1_1024`.`a1`,<exists>(select `test`.`t2_1024`.`b1` from `test`.`t2_1024` where ((`test`.`t2_1024`.`b1` > '0') and (<cache>(`test`.`t1_1024`.`a1`) = `test`.`t2_1024`.`b1`)))))
+Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <expr_cache><`test`.`t1_1024`.`a1`>(<in_optimizer>(`test`.`t1_1024`.`a1`,<exists>(select `test`.`t2_1024`.`b1` from `test`.`t2_1024` where `test`.`t2_1024`.`b1` > '0' and <cache>(`test`.`t1_1024`.`a1`) = `test`.`t2_1024`.`b1`)))
select left(a1,7), left(a2,7)
from t1_1024
where a1 in (select b1 from t2_1024 where b1 > '0');
@@ -830,7 +830,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <expr_cache><`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a2`>(<in_optimizer>((`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a2`),<exists>(select `test`.`t2_1024`.`b1`,`test`.`t2_1024`.`b2` from `test`.`t2_1024` where ((`test`.`t2_1024`.`b1` > '0') and (<cache>(`test`.`t1_1024`.`a1`) = `test`.`t2_1024`.`b1`) and (<cache>(`test`.`t1_1024`.`a2`) = `test`.`t2_1024`.`b2`)))))
+Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <expr_cache><`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a2`>(<in_optimizer>((`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a2`),<exists>(select `test`.`t2_1024`.`b1`,`test`.`t2_1024`.`b2` from `test`.`t2_1024` where `test`.`t2_1024`.`b1` > '0' and <cache>(`test`.`t1_1024`.`a1`) = `test`.`t2_1024`.`b1` and <cache>(`test`.`t1_1024`.`a2`) = `test`.`t2_1024`.`b2`)))
select left(a1,7), left(a2,7)
from t1_1024
where (a1,a2) in (select b1, b2 from t2_1024 where b1 > '0');
@@ -844,7 +844,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <expr_cache><`test`.`t1_1024`.`a1`>(<in_optimizer>(`test`.`t1_1024`.`a1`,<exists>(select substr(`test`.`t2_1024`.`b1`,1,1024) from `test`.`t2_1024` where ((`test`.`t2_1024`.`b1` > '0') and (<cache>(`test`.`t1_1024`.`a1`) = substr(`test`.`t2_1024`.`b1`,1,1024))))))
+Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <expr_cache><`test`.`t1_1024`.`a1`>(<in_optimizer>(`test`.`t1_1024`.`a1`,<exists>(select substr(`test`.`t2_1024`.`b1`,1,1024) from `test`.`t2_1024` where `test`.`t2_1024`.`b1` > '0' and <cache>(`test`.`t1_1024`.`a1`) = substr(`test`.`t2_1024`.`b1`,1,1024))))
select left(a1,7), left(a2,7)
from t1_1024
where a1 in (select substring(b1,1,1024) from t2_1024 where b1 > '0');
@@ -858,7 +858,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort
Warnings:
-Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <expr_cache><`test`.`t1_1024`.`a1`>(<in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), <primary_index_lookup>(`test`.`t1_1024`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1024`.`a1` = `<subquery2>`.`group_concat(b1)`))))))
+Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <expr_cache><`test`.`t1_1024`.`a1`>(<in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), <primary_index_lookup>(`test`.`t1_1024`.`a1` in <temporary table> on distinct_key where `test`.`t1_1024`.`a1` = `<subquery2>`.`group_concat(b1)`))))
select left(a1,7), left(a2,7)
from t1_1024
where a1 in (select group_concat(b1) from t2_1024 group by b2);
@@ -875,7 +875,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort
Warnings:
-Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <expr_cache><`test`.`t1_1024`.`a1`>(<in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), <primary_index_lookup>(`test`.`t1_1024`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1024`.`a1` = `<subquery2>`.`group_concat(b1)`))))))
+Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <expr_cache><`test`.`t1_1024`.`a1`>(<in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), <primary_index_lookup>(`test`.`t1_1024`.`a1` in <temporary table> on distinct_key where `test`.`t1_1024`.`a1` = `<subquery2>`.`group_concat(b1)`))))
select left(a1,7), left(a2,7)
from t1_1024
where a1 in (select group_concat(b1) from t2_1024 group by b2);
@@ -917,7 +917,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <expr_cache><`test`.`t1_1025`.`a1`>(<in_optimizer>(`test`.`t1_1025`.`a1`,<exists>(select `test`.`t2_1025`.`b1` from `test`.`t2_1025` where ((`test`.`t2_1025`.`b1` > '0') and (<cache>(`test`.`t1_1025`.`a1`) = `test`.`t2_1025`.`b1`)))))
+Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <expr_cache><`test`.`t1_1025`.`a1`>(<in_optimizer>(`test`.`t1_1025`.`a1`,<exists>(select `test`.`t2_1025`.`b1` from `test`.`t2_1025` where `test`.`t2_1025`.`b1` > '0' and <cache>(`test`.`t1_1025`.`a1`) = `test`.`t2_1025`.`b1`)))
select left(a1,7), left(a2,7)
from t1_1025
where a1 in (select b1 from t2_1025 where b1 > '0');
@@ -931,7 +931,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <expr_cache><`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a2`>(<in_optimizer>((`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a2`),<exists>(select `test`.`t2_1025`.`b1`,`test`.`t2_1025`.`b2` from `test`.`t2_1025` where ((`test`.`t2_1025`.`b1` > '0') and (<cache>(`test`.`t1_1025`.`a1`) = `test`.`t2_1025`.`b1`) and (<cache>(`test`.`t1_1025`.`a2`) = `test`.`t2_1025`.`b2`)))))
+Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <expr_cache><`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a2`>(<in_optimizer>((`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a2`),<exists>(select `test`.`t2_1025`.`b1`,`test`.`t2_1025`.`b2` from `test`.`t2_1025` where `test`.`t2_1025`.`b1` > '0' and <cache>(`test`.`t1_1025`.`a1`) = `test`.`t2_1025`.`b1` and <cache>(`test`.`t1_1025`.`a2`) = `test`.`t2_1025`.`b2`)))
select left(a1,7), left(a2,7)
from t1_1025
where (a1,a2) in (select b1, b2 from t2_1025 where b1 > '0');
@@ -945,7 +945,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <expr_cache><`test`.`t1_1025`.`a1`>(<in_optimizer>(`test`.`t1_1025`.`a1`,<exists>(select substr(`test`.`t2_1025`.`b1`,1,1025) from `test`.`t2_1025` where ((`test`.`t2_1025`.`b1` > '0') and (<cache>(`test`.`t1_1025`.`a1`) = substr(`test`.`t2_1025`.`b1`,1,1025))))))
+Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <expr_cache><`test`.`t1_1025`.`a1`>(<in_optimizer>(`test`.`t1_1025`.`a1`,<exists>(select substr(`test`.`t2_1025`.`b1`,1,1025) from `test`.`t2_1025` where `test`.`t2_1025`.`b1` > '0' and <cache>(`test`.`t1_1025`.`a1`) = substr(`test`.`t2_1025`.`b1`,1,1025))))
select left(a1,7), left(a2,7)
from t1_1025
where a1 in (select substring(b1,1,1025) from t2_1025 where b1 > '0');
@@ -959,7 +959,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort
Warnings:
-Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <expr_cache><`test`.`t1_1025`.`a1`>(<in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), <primary_index_lookup>(`test`.`t1_1025`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1025`.`a1` = `<subquery2>`.`group_concat(b1)`))))))
+Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <expr_cache><`test`.`t1_1025`.`a1`>(<in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), <primary_index_lookup>(`test`.`t1_1025`.`a1` in <temporary table> on distinct_key where `test`.`t1_1025`.`a1` = `<subquery2>`.`group_concat(b1)`))))
select left(a1,7), left(a2,7)
from t1_1025
where a1 in (select group_concat(b1) from t2_1025 group by b2);
@@ -976,7 +976,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort
Warnings:
-Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <expr_cache><`test`.`t1_1025`.`a1`>(<in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), <primary_index_lookup>(`test`.`t1_1025`.`a1` in <temporary table> on distinct_key where ((`test`.`t1_1025`.`a1` = `<subquery2>`.`group_concat(b1)`))))))
+Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <expr_cache><`test`.`t1_1025`.`a1`>(<in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), <primary_index_lookup>(`test`.`t1_1025`.`a1` in <temporary table> on distinct_key where `test`.`t1_1025`.`a1` = `<subquery2>`.`group_concat(b1)`))))
select left(a1,7), left(a2,7)
from t1_1025
where a1 in (select group_concat(b1) from t2_1025 group by b2);
@@ -1001,7 +1001,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1bit ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t2bit ALL NULL NULL NULL NULL 3 100.00
Warnings:
-Note 1003 select conv(`test`.`t1bit`.`a1`,10,2) AS `bin(a1)`,conv(`test`.`t1bit`.`a2`,10,2) AS `bin(a2)` from `test`.`t1bit` where <expr_cache><`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`>(<in_optimizer>((`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`),(`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`) in ( <materialize> (select `test`.`t2bit`.`b1`,`test`.`t2bit`.`b2` from `test`.`t2bit` ), <primary_index_lookup>(`test`.`t1bit`.`a1` in <temporary table> on distinct_key where ((`test`.`t1bit`.`a1` = `<subquery2>`.`b1`) and (`test`.`t1bit`.`a2` = `<subquery2>`.`b2`))))))
+Note 1003 select conv(`test`.`t1bit`.`a1`,10,2) AS `bin(a1)`,conv(`test`.`t1bit`.`a2`,10,2) AS `bin(a2)` from `test`.`t1bit` where <expr_cache><`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`>(<in_optimizer>((`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`),(`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`) in ( <materialize> (select `test`.`t2bit`.`b1`,`test`.`t2bit`.`b2` from `test`.`t2bit` ), <primary_index_lookup>(`test`.`t1bit`.`a1` in <temporary table> on distinct_key where `test`.`t1bit`.`a1` = `<subquery2>`.`b1` and `test`.`t1bit`.`a2` = `<subquery2>`.`b2`))))
select bin(a1), bin(a2)
from t1bit
where (a1, a2) in (select b1, b2 from t2bit);
@@ -1024,7 +1024,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1bb ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY t2bb ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select conv(`test`.`t1bb`.`a1`,10,2) AS `bin(a1)`,`test`.`t1bb`.`a2` AS `a2` from `test`.`t1bb` where <expr_cache><`test`.`t1bb`.`a1`,`test`.`t1bb`.`a2`>(<in_optimizer>((`test`.`t1bb`.`a1`,`test`.`t1bb`.`a2`),<exists>(select `test`.`t2bb`.`b1`,`test`.`t2bb`.`b2` from `test`.`t2bb` where ((<cache>(`test`.`t1bb`.`a1`) = `test`.`t2bb`.`b1`) and (<cache>(`test`.`t1bb`.`a2`) = `test`.`t2bb`.`b2`)))))
+Note 1003 select conv(`test`.`t1bb`.`a1`,10,2) AS `bin(a1)`,`test`.`t1bb`.`a2` AS `a2` from `test`.`t1bb` where <expr_cache><`test`.`t1bb`.`a1`,`test`.`t1bb`.`a2`>(<in_optimizer>((`test`.`t1bb`.`a1`,`test`.`t1bb`.`a2`),<exists>(select `test`.`t2bb`.`b1`,`test`.`t2bb`.`b2` from `test`.`t2bb` where <cache>(`test`.`t1bb`.`a1`) = `test`.`t2bb`.`b1` and <cache>(`test`.`t1bb`.`a2`) = `test`.`t2bb`.`b2`)))
select bin(a1), a2
from t1bb
where (a1, a2) in (select b1, b2 from t2bb);
@@ -1072,7 +1072,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00 Using where
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`c`))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`c`))))
select a from t1 where a in (select c from t2 where d >= 20);
a
2
@@ -1086,7 +1086,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using where; Using index
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`c`))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`c`))))
select a from t1 where a in (select c from t2 where d >= 20);
a
2
@@ -1100,7 +1100,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using where; Using index
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`c`))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`c`))))
select a from t1 where a in (select c from t2 where d >= 20);
a
2
@@ -1113,7 +1113,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using index
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`c`))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`c`))))
select a from t1 group by a having a in (select c from t2 where d >= 20);
a
2
@@ -1125,7 +1125,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using index
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`c`))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`c`))))
select a from t1 group by a having a in (select c from t2 where d >= 20);
a
2
@@ -1140,7 +1140,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
Note 1981 Aggregate function 'max()' of SELECT #3 belongs to SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`c` from `test`.`t2` where (<nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where (max(`test`.`t1`.`b`) = `test`.`t3`.`e`) having (<cache>(`test`.`t2`.`d`) >= <ref_null_helper>(`test`.`t3`.`e`)))))) and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`c`)))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`c` from `test`.`t2` where <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where max(`test`.`t1`.`b`) = `test`.`t3`.`e` having <cache>(`test`.`t2`.`d`) >= <ref_null_helper>(`test`.`t3`.`e`))))) and <cache>(`test`.`t1`.`a`) = `test`.`t2`.`c`)))
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));
a
@@ -1155,7 +1155,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`c` from `test`.`t2` where (<nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`)))))) and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`c`)))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`c` from `test`.`t2` where <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and <cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`)))) and <cache>(`test`.`t1`.`a`) = `test`.`t2`.`c`)))
select a from t1
where a in (select c from t2 where d >= some(select e from t3 where b=e));
a
@@ -1665,7 +1665,7 @@ DROP TABLE t1,t2,t3,t4,t5;
# BUG#836532: Crash in Item_equal_fields_iterator::get_curr_field with semijoin+materialization
#
CREATE TABLE t2 (a int);
-INSERT INTO t2 VALUES ('a'),('a');
+INSERT IGNORE INTO t2 VALUES ('a'),('a');
Warnings:
Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1
Warning 1366 Incorrect integer value: 'a' for column 'a' at row 2
@@ -1824,7 +1824,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select 8 AS `a` from dual where <expr_cache><8>(<in_optimizer>(8,<exists>(select min(`test`.`t1`.`a`) from `test`.`t1` having (<cache>(8) = <ref_null_helper>(min(`test`.`t1`.`a`))))))
+Note 1003 select 8 AS `a` from dual where <expr_cache><8>(<in_optimizer>(8,<exists>(select min(`test`.`t1`.`a`) from `test`.`t1` having <cache>(8) = <ref_null_helper>(min(`test`.`t1`.`a`)))))
DROP TABLE t1;
#
# BUG#904432: Wrong result with LEFT JOIN, constant table, semijoin=ON,materialization=ON
@@ -1925,7 +1925,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where ((`test`.`t1`.`b` = 7) and (`test`.`t1`.`a` = `<subquery2>`.`MAX(c)`) and (<cache>(isnull(`<subquery2>`.`MAX(c)`)) or (`<subquery2>`.`MAX(c)` = 7)))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where `test`.`t1`.`b` = 7 and `test`.`t1`.`a` = `<subquery2>`.`MAX(c)` and (<cache>(`<subquery2>`.`MAX(c)` is null) or `<subquery2>`.`MAX(c)` = 7)
SELECT * FROM t1
WHERE a IN (SELECT MAX(c) FROM t2) AND b=7 AND (a IS NULL OR a=b);
a b
@@ -2168,7 +2168,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 eq_ref db db 764 information_schema.schemata.SCHEMA_NAME 1 100.00 Using where; Using index
2 MATERIALIZED schemata ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select `test`.`t1`.`db` AS `db` from `test`.`t1` semi join (`information_schema`.`schemata`) where (`test`.`t1`.`db` = `information_schema`.`schemata`.`SCHEMA_NAME`) order by `test`.`t1`.`db` desc
+Note 1003 select `test`.`t1`.`db` AS `db` from `test`.`t1` semi join (`information_schema`.`schemata`) where `test`.`t1`.`db` = `information_schema`.`schemata`.`SCHEMA_NAME` order by `test`.`t1`.`db` desc
drop table t1;
drop database mysqltest1;
drop database mysqltest2;
@@ -2251,7 +2251,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 8 100.00
Warnings:
Note 1276 Field or reference 'test.t1.f1' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`f1` AS `f1` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`>(exists(select 1 from `test`.`t2` semi join (`test`.`t3`) join `test`.`t3` where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`f1` = `test`.`t3`.`f3`))))
+Note 1003 select `test`.`t1`.`f1` AS `f1` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`>(exists(select 1 from `test`.`t2` semi join (`test`.`t3`) join `test`.`t3` where `test`.`t3`.`i3` = `test`.`t2`.`i2` and `test`.`t1`.`f1` = `test`.`t3`.`f3`))
# this checks the result set above
set optimizer_switch= 'materialization=off,semijoin=off';
SELECT * FROM t1
@@ -2289,7 +2289,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00
Warnings:
Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`f1` AS `f1`,<expr_cache><`test`.`t1`.`pk`>((select count(0) from `test`.`t2` semi join (`test`.`t2`) where (`test`.`t1`.`pk` = `test`.`t2`.`f2`))) AS `sq` from `test`.`t1`
+Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`f1` AS `f1`,<expr_cache><`test`.`t1`.`pk`>((select count(0) from `test`.`t2` semi join (`test`.`t2`) where `test`.`t1`.`pk` = `test`.`t2`.`f2`)) AS `sq` from `test`.`t1`
# this checks the result set above
set @save_optimizer_switch= @@optimizer_switch;
set optimizer_switch= 'materialization=off,semijoin=off';
diff --git a/mysql-test/r/subselect_mat_cost_bugs.result b/mysql-test/r/subselect_mat_cost_bugs.result
index df6b543bab8..ffd93c125ed 100644
--- a/mysql-test/r/subselect_mat_cost_bugs.result
+++ b/mysql-test/r/subselect_mat_cost_bugs.result
@@ -100,7 +100,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 index c3 c3 9 NULL 2 100.00 Using where; Using index; Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` where <expr_cache><`test`.`t1`.`c1`,`test`.`t1`.`pk`>(<in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t1a`.`c1` from `test`.`t1b` join `test`.`t2` left join `test`.`t1a` on(((`test`.`t1a`.`c2` = `test`.`t1b`.`pk`) and 2)) where ((`test`.`t1`.`pk` <> 0) and (<cache>(`test`.`t1`.`c1`) = `test`.`t1a`.`c1`) and (`test`.`t2`.`c3` = `test`.`t1b`.`c4`)))))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` where <expr_cache><`test`.`t1`.`c1`,`test`.`t1`.`pk`>(<in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t1a`.`c1` from `test`.`t1b` join `test`.`t2` left join `test`.`t1a` on(`test`.`t1a`.`c2` = `test`.`t1b`.`pk` and 2) where `test`.`t1`.`pk` <> 0 and <cache>(`test`.`t1`.`c1`) = `test`.`t1a`.`c1` and `test`.`t2`.`c3` = `test`.`t1b`.`c4`)))
SELECT pk
FROM t1
WHERE c1 IN
@@ -460,7 +460,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 MATERIALIZED t1 index NULL a 5 NULL 2 100.00 Using index
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (not(<expr_cache><`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`b`,`test`.`t2`.`b` in ( <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`c` = `test`.`t2`.`b`) ), <primary_index_lookup>(`test`.`t2`.`b` in <temporary table> on distinct_key where ((`test`.`t2`.`b` = `<subquery2>`.`MIN(a)`))))))))
+Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where !<expr_cache><`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`b`,`test`.`t2`.`b` in ( <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t2`.`b` ), <primary_index_lookup>(`test`.`t2`.`b` in <temporary table> on distinct_key where `test`.`t2`.`b` = `<subquery2>`.`MIN(a)`))))
set optimizer_switch= 'materialization=off';
SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b);
b c
@@ -470,7 +470,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 index NULL a 5 NULL 2 100.00 Using index
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (not(<expr_cache><`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`b`,<exists>(select min(`test`.`t1`.`a`) from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`c` = `test`.`t2`.`b`) having trigcond((<cache>(`test`.`t2`.`b`) = <ref_null_helper>(min(`test`.`t1`.`a`)))))))))
+Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where !<expr_cache><`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`b`,<exists>(select min(`test`.`t1`.`a`) from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t2`.`b` having trigcond(<cache>(`test`.`t2`.`b`) = <ref_null_helper>(min(`test`.`t1`.`a`))))))
set optimizer_switch= @optimizer_switch_save;
DROP TABLE t1,t2;
CREATE TABLE t1 (f1 varchar(10)) ENGINE=MyISAM;
diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result
index a23820820ef..6306cfff89d 100644
--- a/mysql-test/r/subselect_no_exists_to_in.result
+++ b/mysql-test/r/subselect_no_exists_to_in.result
@@ -4,6 +4,7 @@ select @@optimizer_switch like '%exists_to_in=off%';
set optimizer_switch='exists_to_in=off';
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
drop view if exists v2;
+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");
@@ -60,7 +61,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 1 AS `1` from dual having ((select 1) = 1)
+Note 1003 select 1 AS `1` from dual having (select 1) = 1
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
@@ -83,7 +84,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
1
1
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
-ERROR HY000: Incorrect usage of PROCEDURE and subquery
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE(1))' at line 1
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
@@ -201,7 +202,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`)))
+Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (select max(`test`.`t2`.`a`) * 4 from `test`.`t2`))
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
3 1
@@ -219,7 +220,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
Warnings:
-Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
+Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt`
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);
a
@@ -241,7 +242,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
+Note 1003 select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((select avg(`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
select * from t3 where exists (select * from t2 where t2.b=t3.a);
a
7
@@ -287,7 +288,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2);
a
7
@@ -331,7 +332,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select <expr_cache><`test`.`t2`.`a`>((select 2 from dual where (2 = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`))) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
+Note 1003 select <expr_cache><`test`.`t2`.`a`>((select 2 from dual where 2 = `test`.`t2`.`a` union select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -349,7 +350,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`)))
+Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(exists(select 1 from `test`.`t7` where `test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous
drop table t1,t2,t3;
@@ -410,13 +411,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
Warnings:
-Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
+Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03'
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
Warnings:
-Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
+Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
date
2002-08-03
@@ -563,7 +564,7 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
+Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1'
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
@@ -745,7 +746,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref id id 5 const 1 100.00 Using index
Warnings:
Note 1249 Select 2 was reduced during optimization
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 1)
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1
SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id
1
@@ -758,7 +759,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1249 Select 3 was reduced during optimization
Note 1249 Select 2 was reduced during optimization
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = <cache>((1 + 1)))
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = <cache>(1 + 1)
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index
@@ -766,7 +767,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <expr_cache><`test`.`t2`.`id`>(<in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3)))))
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <expr_cache><`test`.`t2`.`id`>(<in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(1) union select 3 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
id
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
@@ -892,7 +893,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1249 Select 2 was reduced during optimization
-Note 1003 select (`test`.`t1`.`a` + 1) AS `(select a+1)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
select (select a+1) from t1;
(select a+1)
2.5
@@ -914,7 +915,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having <is_not_null_test>(`test`.`t2`.`a`))))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having `test`.`t2`.`a` is null)))) AS `t1.a in (select t2.a from t2)` from `test`.`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;
@@ -929,7 +930,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`)))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a` or `test`.`t2`.`a` is null) having `test`.`t2`.`a` is null))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
drop table t1,t2,t3;
# check correct NULL Processing for normal IN/ALL/ANY
# and 2 ways of max/min optimization
@@ -1060,7 +1061,7 @@ create table t1 (a float);
select 10.5 IN (SELECT * from t1 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1.5)' at line 1
select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
drop table t1;
@@ -1206,11 +1207,11 @@ CREATE TABLE `t3` (
PRIMARY KEY (`numeropost`),
UNIQUE KEY `maxnumrep` (`maxnumrep`)
) ENGINE=MyISAM CHARSET=latin1;
-INSERT INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
+INSERT IGNORE INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
Warnings:
Warning 1265 Data truncated for column 'date' at row 1
Warning 1265 Data truncated for column 'date' at row 2
-INSERT INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
+INSERT IGNORE INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
Warnings:
Warning 1265 Data truncated for column 'date' at row 1
Warning 1265 Data truncated for column 'date' at row 2
@@ -1236,24 +1237,24 @@ CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT 1)` int(1) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT 1)` int(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT a)` int(1) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT a)` int(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT a+0)` int(3) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT a+0)` int(3) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
@@ -1329,7 +1330,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)`
INSERT INTO t1 (pseudo) VALUES ('test1');
SELECT 0 IN (SELECT 1 FROM t1 a);
0 IN (SELECT 1 FROM t1 a)
@@ -1339,7 +1340,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)`
drop table t1;
CREATE TABLE `t1` (
`i` int(11) NOT NULL default '0',
@@ -1384,7 +1385,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
+Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`)
drop table t1;
CREATE TABLE t1 (
ID int(10) unsigned NOT NULL auto_increment,
@@ -1446,7 +1447,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1456,7 +1457,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1467,7 +1468,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = `test`.`t2`.`a`))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`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));
@@ -1489,7 +1490,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index
1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where (`test`.`t1`.`a` = `test`.`t2`.`a`)
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1499,7 +1500,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index
1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1510,7 +1511,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 index a a 5 NULL 3 100.00 Using where; Using index
1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where `test`.`t1`.`b` = `test`.`t3`.`a` and `test`.`t1`.`a` = `test`.`t2`.`a`
insert into t1 values (3,31);
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
@@ -1526,7 +1527,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index
1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
drop table t0, t1, t2, t3;
create table t1 (a int, b int);
create table t2 (a int, b int);
@@ -1617,25 +1618,25 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
create table t2 (a int, b int not null);
create table t3 (a int);
@@ -1650,7 +1651,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2);
a
explain extended select * from t3 where a >= some (select b from t2);
@@ -1658,7 +1659,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2 group by 1);
a
6
@@ -1669,7 +1670,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2 group by 1);
a
explain extended select * from t3 where a >= some (select b from t2 group by 1);
@@ -1677,7 +1678,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where NULL >= any (select b from t2);
a
explain extended select * from t3 where NULL >= any (select b from t2);
@@ -1720,7 +1721,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`)))
drop table t2, t3;
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());
@@ -1890,14 +1891,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where
Warnings:
-Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not(<expr_cache><`test`.`t1`.`id`>(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where ((`test`.`t1`.`id` < 8) and (<cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`))))))))
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !<expr_cache><`test`.`t1`.`id`>(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where `test`.`t1`.`id` < 8 and <cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`))))
explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null)))))
+Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`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');
@@ -1923,7 +1924,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00
1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition
Warnings:
-Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`b`.`id` = `test`.`a`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`)
+Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id`
drop table t1,t2;
create table t1 (a int);
insert into t1 values (1);
@@ -2433,7 +2434,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <expr_cache><`test`.`up`.`a`>(exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`)))
+Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <expr_cache><`test`.`up`.`a`>(exists(select 1 from `test`.`t1` where `test`.`t1`.`a` = `test`.`up`.`a`))
drop table t1;
CREATE TABLE t1 (t1_a int);
INSERT INTO t1 VALUES (1);
@@ -2614,7 +2615,11 @@ explain select a from t1 where c=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
drop table t1;
+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;
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);
@@ -2976,20 +2981,20 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`)))))) AS `test` from `test`.`t1`
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1`
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where (`test`.`t2`.`flag` = 'N')
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`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;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`)))))) AS `test` from `test`.`t1`
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1`
DROP TABLE t1,t2;
set optimizer_switch=@tmp11867_optimizer_switch;
CREATE TABLE t1 (a char(5), b char(5));
@@ -4442,7 +4447,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))
+Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`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));
@@ -4454,14 +4459,14 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))))
+Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)))
DROP TABLE t1,t2;
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);
-insert into t2
+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;
set session sort_buffer_size= 33*1024;
@@ -4535,14 +4540,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
Warnings:
-Note 1003 select 1 AS `1` from <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where (`<subquery2>`.`min(a)` = 1)
+Note 1003 select 1 AS `1` from <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
Warnings:
-Note 1003 select 1 AS `1` from <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a`) join `test`.`t1` where (`<subquery2>`.`min(a)` = 1)
+Note 1003 select 1 AS `1` from <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` where `test`.`t1`.`a` > 3 group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1
SET join_cache_level=@save_join_cache_level;
DROP TABLE t1;
#
@@ -4999,7 +5004,7 @@ 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;
INSERT INTO v2(a,b) VALUES (2,2);
-ERROR HY000: CHECK OPTION failed 'test.v2'
+ERROR 44000: CHECK OPTION failed `test`.`v2`
SELECT * FROM v1;
c
1
@@ -5186,9 +5191,9 @@ a 1
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
ERROR 42000: Every derived table must have its own alias
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ON 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1) ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) ON 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1)) ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't1a ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
@@ -6007,26 +6012,26 @@ 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);
f1 f1_key
-v j
+s c
+s d
+s d
+s d
s j
-v v
+s m
+s s
+s t
s v
+s y
v c
-s c
-v m
-s m
v d
-s d
v d
-s d
-v y
-s y
-v t
-s t
v d
-s d
+v j
+v m
v s
-s s
+v t
+v v
+v y
DROP TABLE t1,t2;
#
# LP bug 919427: EXPLAIN for a query over a single-row table
@@ -6357,26 +6362,26 @@ SELECT DISTINCT f1_key
FROM t2
WHERE f1_key != table2.f1_key AND f1_key >= table1.f1 );
f1 f1_key
-v j
+s c
+s d
+s d
+s d
s j
-v v
+s m
+s s
+s t
s v
+s y
v c
-s c
-v m
-s m
v d
-s d
v d
-s d
-v y
-s y
-v t
-s t
v d
-s d
+v j
+v m
v s
-s s
+v t
+v v
+v y
explain SELECT table1.f1, table2.f1_key
FROM t1 AS table1, t2 AS table2
WHERE EXISTS
@@ -7265,6 +7270,20 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
# End of 10.1 tests
+#
+# MDEV-12564: IN TO EXISTS transformation for rows after
+# conversion an outer join to inner join
+#
+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';
+pk i c pk i c
+1 10 foo 1 10 foo
+DROP TABLE t;
+# End of 10.2 tests
set optimizer_switch=default;
select @@optimizer_switch like '%exists_to_in=off%';
@@optimizer_switch like '%exists_to_in=off%'
diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result
index baa74307f89..0db1b031133 100644
--- a/mysql-test/r/subselect_no_mat.result
+++ b/mysql-test/r/subselect_no_mat.result
@@ -7,6 +7,7 @@ set join_cache_level=1;
set @join_cache_level_for_subselect_test=@@join_cache_level;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
drop view if exists v2;
+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");
@@ -63,7 +64,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 1 AS `1` from dual having ((select 1) = 1)
+Note 1003 select 1 AS `1` from dual having (select 1) = 1
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
@@ -86,7 +87,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
1
1
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
-ERROR HY000: Incorrect usage of PROCEDURE and subquery
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE(1))' at line 1
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
@@ -204,7 +205,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`)))
+Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (select max(`test`.`t2`.`a`) * 4 from `test`.`t2`))
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
3 1
@@ -222,7 +223,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
Warnings:
-Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
+Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt`
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);
a
@@ -244,7 +245,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
+Note 1003 select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((select avg(`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
select * from t3 where exists (select * from t2 where t2.b=t3.a);
a
7
@@ -290,7 +291,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2);
a
7
@@ -334,7 +335,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select <expr_cache><`test`.`t2`.`a`>((select 2 from dual where (2 = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`))) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
+Note 1003 select <expr_cache><`test`.`t2`.`a`>((select 2 from dual where 2 = `test`.`t2`.`a` union select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -352,7 +353,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t6 ALL i1 NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where (`test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`)
+Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous
drop table t1,t2,t3;
@@ -413,13 +414,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
Warnings:
-Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
+Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03'
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
Warnings:
-Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
+Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
date
2002-08-03
@@ -566,7 +567,7 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
+Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1'
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
@@ -748,7 +749,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref id id 5 const 1 100.00 Using index
Warnings:
Note 1249 Select 2 was reduced during optimization
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 1)
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1
SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id
1
@@ -761,7 +762,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1249 Select 3 was reduced during optimization
Note 1249 Select 2 was reduced during optimization
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = <cache>((1 + 1)))
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = <cache>(1 + 1)
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index
@@ -769,7 +770,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <expr_cache><`test`.`t2`.`id`>(<in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3)))))
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <expr_cache><`test`.`t2`.`id`>(<in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(1) union select 3 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
id
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
@@ -895,7 +896,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1249 Select 2 was reduced during optimization
-Note 1003 select (`test`.`t1`.`a` + 1) AS `(select a+1)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
select (select a+1) from t1;
(select a+1)
2.5
@@ -917,7 +918,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having <is_not_null_test>(`test`.`t2`.`a`))))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having `test`.`t2`.`a` is null)))) AS `t1.a in (select t2.a from t2)` from `test`.`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;
@@ -932,7 +933,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`)))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a` or `test`.`t2`.`a` is null) having `test`.`t2`.`a` is null))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
drop table t1,t2,t3;
# check correct NULL Processing for normal IN/ALL/ANY
# and 2 ways of max/min optimization
@@ -1063,7 +1064,7 @@ create table t1 (a float);
select 10.5 IN (SELECT * from t1 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1.5)' at line 1
select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
drop table t1;
@@ -1209,11 +1210,11 @@ CREATE TABLE `t3` (
PRIMARY KEY (`numeropost`),
UNIQUE KEY `maxnumrep` (`maxnumrep`)
) ENGINE=MyISAM CHARSET=latin1;
-INSERT INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
+INSERT IGNORE INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
Warnings:
Warning 1265 Data truncated for column 'date' at row 1
Warning 1265 Data truncated for column 'date' at row 2
-INSERT INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
+INSERT IGNORE INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
Warnings:
Warning 1265 Data truncated for column 'date' at row 1
Warning 1265 Data truncated for column 'date' at row 2
@@ -1239,24 +1240,24 @@ CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT 1)` int(1) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT 1)` int(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT a)` int(1) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT a)` int(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT a+0)` int(3) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT a+0)` int(3) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
@@ -1332,7 +1333,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)`
INSERT INTO t1 (pseudo) VALUES ('test1');
SELECT 0 IN (SELECT 1 FROM t1 a);
0 IN (SELECT 1 FROM t1 a)
@@ -1342,7 +1343,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)`
drop table t1;
CREATE TABLE `t1` (
`i` int(11) NOT NULL default '0',
@@ -1387,7 +1388,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
+Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`)
drop table t1;
CREATE TABLE t1 (
ID int(10) unsigned NOT NULL auto_increment,
@@ -1449,7 +1450,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1459,7 +1460,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1470,7 +1471,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = `test`.`t2`.`a`))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`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));
@@ -1492,7 +1493,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index
1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where (`test`.`t1`.`a` = `test`.`t2`.`a`)
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1502,7 +1503,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index
1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1513,7 +1514,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 index a a 5 NULL 3 100.00 Using where; Using index
1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where `test`.`t1`.`b` = `test`.`t3`.`a` and `test`.`t1`.`a` = `test`.`t2`.`a`
insert into t1 values (3,31);
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
@@ -1529,7 +1530,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index
1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
drop table t0, t1, t2, t3;
create table t1 (a int, b int);
create table t2 (a int, b int);
@@ -1620,25 +1621,25 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
create table t2 (a int, b int not null);
create table t3 (a int);
@@ -1653,7 +1654,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2);
a
explain extended select * from t3 where a >= some (select b from t2);
@@ -1661,7 +1662,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2 group by 1);
a
6
@@ -1672,7 +1673,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2 group by 1);
a
explain extended select * from t3 where a >= some (select b from t2 group by 1);
@@ -1680,7 +1681,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where NULL >= any (select b from t2);
a
explain extended select * from t3 where NULL >= any (select b from t2);
@@ -1723,7 +1724,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`)))
drop table t2, t3;
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());
@@ -1893,14 +1894,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where
Warnings:
-Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not(<expr_cache><`test`.`t1`.`id`>(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where ((`test`.`t1`.`id` < 8) and (<cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`))))))))
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !<expr_cache><`test`.`t1`.`id`>(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where `test`.`t1`.`id` < 8 and <cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`))))
explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))))
+Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`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');
@@ -1926,7 +1927,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00
1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition
Warnings:
-Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`b`.`id` = `test`.`a`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`)
+Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id`
drop table t1,t2;
create table t1 (a int);
insert into t1 values (1);
@@ -2436,7 +2437,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(up); Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` semi join (`test`.`t1`) where (`test`.`t1`.`a` = `test`.`up`.`a`)
+Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`up`.`a`
drop table t1;
CREATE TABLE t1 (t1_a int);
INSERT INTO t1 VALUES (1);
@@ -2617,7 +2618,11 @@ explain select a from t1 where c=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
drop table t1;
+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;
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);
@@ -2979,19 +2984,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`)))))) AS `test` from `test`.`t1`
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1`
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
1 PRIMARY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`flag` = 'N') and (`test`.`t2`.`one` = `test`.`t1`.`one`) and (`test`.`t2`.`two` = `test`.`t1`.`two`))
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`flag` = 'N' and `test`.`t2`.`one` = `test`.`t1`.`one` and `test`.`t2`.`two` = `test`.`t1`.`two`
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`)))))) AS `test` from `test`.`t1`
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1`
DROP TABLE t1,t2;
set optimizer_switch=@tmp11867_optimizer_switch;
CREATE TABLE t1 (a char(5), b char(5));
@@ -4442,7 +4447,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select 2 AS `2` from `test`.`t1` semi join (`test`.`t2`) where (`test`.`t2`.`a` = `test`.`t1`.`a`)
+Note 1003 select 2 AS `2` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`a` = `test`.`t1`.`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));
@@ -4454,14 +4459,14 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))))
+Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)))
DROP TABLE t1,t2;
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);
-insert into t2
+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;
set session sort_buffer_size= 33*1024;
@@ -4997,7 +5002,7 @@ 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;
INSERT INTO v2(a,b) VALUES (2,2);
-ERROR HY000: CHECK OPTION failed 'test.v2'
+ERROR 44000: CHECK OPTION failed `test`.`v2`
SELECT * FROM v1;
c
1
@@ -5184,9 +5189,9 @@ a 1
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
ERROR 42000: Every derived table must have its own alias
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ON 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1) ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) ON 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1)) ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't1a ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
@@ -6004,26 +6009,26 @@ 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);
f1 f1_key
-v j
+s c
+s d
+s d
+s d
s j
-v v
+s m
+s s
+s t
s v
+s y
v c
-s c
-v m
-s m
v d
-s d
v d
-s d
-v y
-s y
-v t
-s t
v d
-s d
+v j
+v m
v s
-s s
+v t
+v v
+v y
DROP TABLE t1,t2;
#
# LP bug 919427: EXPLAIN for a query over a single-row table
@@ -6352,26 +6357,26 @@ SELECT DISTINCT f1_key
FROM t2
WHERE f1_key != table2.f1_key AND f1_key >= table1.f1 );
f1 f1_key
-v j
+s c
+s d
+s d
+s d
s j
-v v
+s m
+s s
+s t
s v
+s y
v c
-s c
-v m
-s m
v d
-s d
v d
-s d
-v y
-s y
-v t
-s t
v d
-s d
+v j
+v m
v s
-s s
+v t
+v v
+v y
explain SELECT table1.f1, table2.f1_key
FROM t1 AS table1, t2 AS table2
WHERE EXISTS
@@ -7258,6 +7263,20 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
# End of 10.1 tests
+#
+# MDEV-12564: IN TO EXISTS transformation for rows after
+# conversion an outer join to inner join
+#
+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';
+pk i c pk i c
+1 10 foo 1 10 foo
+DROP TABLE t;
+# End of 10.2 tests
set optimizer_switch=default;
select @@optimizer_switch like '%materialization=on%';
@@optimizer_switch like '%materialization=on%'
diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result
index 039f2fe1a9e..1fa6f385b2b 100644
--- a/mysql-test/r/subselect_no_opts.result
+++ b/mysql-test/r/subselect_no_opts.result
@@ -3,6 +3,7 @@ set join_cache_level=1;
set @join_cache_level_for_subselect_test=@@join_cache_level;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
drop view if exists v2;
+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");
@@ -59,7 +60,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 1 AS `1` from dual having ((select 1) = 1)
+Note 1003 select 1 AS `1` from dual having (select 1) = 1
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
@@ -82,7 +83,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
1
1
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
-ERROR HY000: Incorrect usage of PROCEDURE and subquery
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE(1))' at line 1
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
@@ -200,7 +201,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`)))
+Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (select max(`test`.`t2`.`a`) * 4 from `test`.`t2`))
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
3 1
@@ -218,7 +219,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
Warnings:
-Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
+Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt`
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);
a
@@ -240,7 +241,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t4`.`b` AS `b`,(select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
+Note 1003 select `test`.`t4`.`b` AS `b`,(select avg(`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
select * from t3 where exists (select * from t2 where t2.b=t3.a);
a
7
@@ -286,7 +287,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2);
a
7
@@ -330,7 +331,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select (select 2 from dual where (2 = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
+Note 1003 select (select 2 from dual where 2 = `test`.`t2`.`a` union select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -409,13 +410,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
Warnings:
-Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
+Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03'
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
Warnings:
-Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
+Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
date
2002-08-03
@@ -562,7 +563,7 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
+Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1'
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
@@ -744,7 +745,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref id id 5 const 1 100.00 Using index
Warnings:
Note 1249 Select 2 was reduced during optimization
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 1)
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1
SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id
1
@@ -757,7 +758,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1249 Select 3 was reduced during optimization
Note 1249 Select 2 was reduced during optimization
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = <cache>((1 + 1)))
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = <cache>(1 + 1)
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index
@@ -765,7 +766,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(1) union select 3 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(3)))
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
id
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
@@ -891,7 +892,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1249 Select 2 was reduced during optimization
-Note 1003 select (`test`.`t1`.`a` + 1) AS `(select a+1)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
select (select a+1) from t1;
(select a+1)
2.5
@@ -913,7 +914,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having <is_not_null_test>(`test`.`t2`.`a`)))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having `test`.`t2`.`a` is null))) AS `t1.a in (select t2.a from t2)` from `test`.`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;
@@ -928,7 +929,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a` or `test`.`t2`.`a` is null) having `test`.`t2`.`a` is null)) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
drop table t1,t2,t3;
# check correct NULL Processing for normal IN/ALL/ANY
# and 2 ways of max/min optimization
@@ -1059,7 +1060,7 @@ create table t1 (a float);
select 10.5 IN (SELECT * from t1 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1.5)' at line 1
select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
drop table t1;
@@ -1205,11 +1206,11 @@ CREATE TABLE `t3` (
PRIMARY KEY (`numeropost`),
UNIQUE KEY `maxnumrep` (`maxnumrep`)
) ENGINE=MyISAM CHARSET=latin1;
-INSERT INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
+INSERT IGNORE INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
Warnings:
Warning 1265 Data truncated for column 'date' at row 1
Warning 1265 Data truncated for column 'date' at row 2
-INSERT INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
+INSERT IGNORE INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
Warnings:
Warning 1265 Data truncated for column 'date' at row 1
Warning 1265 Data truncated for column 'date' at row 2
@@ -1235,24 +1236,24 @@ CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT 1)` int(1) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT 1)` int(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT a)` int(1) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT a)` int(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT a+0)` int(3) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT a+0)` int(3) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
@@ -1328,7 +1329,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)`
INSERT INTO t1 (pseudo) VALUES ('test1');
SELECT 0 IN (SELECT 1 FROM t1 a);
0 IN (SELECT 1 FROM t1 a)
@@ -1338,7 +1339,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)`
drop table t1;
CREATE TABLE `t1` (
`i` int(11) NOT NULL default '0',
@@ -1383,7 +1384,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
+Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`)
drop table t1;
CREATE TABLE t1 (
ID int(10) unsigned NOT NULL auto_increment,
@@ -1455,7 +1456,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY where ((`test`.`t1`.`b` <> 30) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY where `test`.`t1`.`b` <> 30 and <cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1466,7 +1467,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where
2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t1`.`b` and <cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))
drop table t1, t2, t3;
create table t1 (a int, b int, index a (a,b));
create table t2 (a int, index a (a));
@@ -1498,7 +1499,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where ((`test`.`t1`.`b` <> 30) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where `test`.`t1`.`b` <> 30 and <cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1509,7 +1510,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 ref a a 10 func,test.t3.a 1167 100.00 Using index
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`a` and <cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))
insert into t1 values (3,31);
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
@@ -1525,7 +1526,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where ((`test`.`t1`.`b` <> 30) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where `test`.`t1`.`b` <> 30 and <cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))
drop table t0, t1, t2, t3;
create table t1 (a int, b int);
create table t2 (a int, b int);
@@ -1616,25 +1617,25 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
create table t2 (a int, b int not null);
create table t3 (a int);
@@ -1649,7 +1650,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2);
a
explain extended select * from t3 where a >= some (select b from t2);
@@ -1657,7 +1658,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2 group by 1);
a
6
@@ -1668,7 +1669,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2 group by 1);
a
explain extended select * from t3 where a >= some (select b from t2 group by 1);
@@ -1676,7 +1677,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where NULL >= any (select b from t2);
a
explain extended select * from t3 where NULL >= any (select b from t2);
@@ -1719,7 +1720,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`)))
drop table t2, t3;
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());
@@ -1889,14 +1890,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where
Warnings:
-Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where ((`test`.`t1`.`id` < 8) and (<cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`)))))))
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where `test`.`t1`.`id` < 8 and <cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`)))
explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<in_optimizer>(1,exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null)))))
+Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,exists(select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`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');
@@ -1922,7 +1923,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00
1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition
Warnings:
-Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`b`.`id` = `test`.`a`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`)
+Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id`
drop table t1,t2;
create table t1 (a int);
insert into t1 values (1);
@@ -2432,7 +2433,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <in_optimizer>(`test`.`up`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` where (<cache>(`test`.`up`.`a`) = `test`.`t1`.`a`)))
+Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <in_optimizer>(`test`.`up`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` where <cache>(`test`.`up`.`a`) = `test`.`t1`.`a`))
drop table t1;
CREATE TABLE t1 (t1_a int);
INSERT INTO t1 VALUES (1);
@@ -2613,7 +2614,11 @@ explain select a from t1 where c=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
drop table t1;
+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;
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);
@@ -2975,19 +2980,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null))) AS `test` from `test`.`t1`
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = 'N') and (<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) and (<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`))))
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = 'N' and <cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` and <cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`))
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null))) AS `test` from `test`.`t1`
DROP TABLE t1,t2;
set optimizer_switch=@tmp11867_optimizer_switch;
CREATE TABLE t1 (a char(5), b char(5));
@@ -4438,7 +4443,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select 2 AS `2` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`a` from `test`.`t2` where (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`)))
+Note 1003 select 2 AS `2` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`a` from `test`.`t2` where <cache>(`test`.`t1`.`a`) = `test`.`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));
@@ -4450,14 +4455,14 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 2 AS `2` from `test`.`t1` where exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))
+Note 1003 select 2 AS `2` from `test`.`t1` where exists((select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`))
DROP TABLE t1,t2;
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);
-insert into t2
+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;
set session sort_buffer_size= 33*1024;
@@ -4993,7 +4998,7 @@ 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;
INSERT INTO v2(a,b) VALUES (2,2);
-ERROR HY000: CHECK OPTION failed 'test.v2'
+ERROR 44000: CHECK OPTION failed `test`.`v2`
SELECT * FROM v1;
c
1
@@ -5180,9 +5185,9 @@ a 1
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
ERROR 42000: Every derived table must have its own alias
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ON 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1) ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) ON 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1)) ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't1a ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
@@ -6000,26 +6005,26 @@ 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);
f1 f1_key
-v j
+s c
+s d
+s d
+s d
s j
-v v
+s m
+s s
+s t
s v
+s y
v c
-s c
-v m
-s m
v d
-s d
v d
-s d
-v y
-s y
-v t
-s t
v d
-s d
+v j
+v m
v s
-s s
+v t
+v v
+v y
DROP TABLE t1,t2;
#
# LP bug 919427: EXPLAIN for a query over a single-row table
@@ -6348,26 +6353,26 @@ SELECT DISTINCT f1_key
FROM t2
WHERE f1_key != table2.f1_key AND f1_key >= table1.f1 );
f1 f1_key
-v j
+s c
+s d
+s d
+s d
s j
-v v
+s m
+s s
+s t
s v
+s y
v c
-s c
-v m
-s m
v d
-s d
v d
-s d
-v y
-s y
-v t
-s t
v d
-s d
+v j
+v m
v s
-s s
+v t
+v v
+v y
explain SELECT table1.f1, table2.f1_key
FROM t1 AS table1, t2 AS table2
WHERE EXISTS
@@ -7256,4 +7261,18 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
# End of 10.1 tests
+#
+# MDEV-12564: IN TO EXISTS transformation for rows after
+# conversion an outer join to inner join
+#
+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';
+pk i c pk i c
+1 10 foo 1 10 foo
+DROP TABLE t;
+# End of 10.2 tests
set @optimizer_switch_for_subselect_test=null;
diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result
index 0ce77bbb376..986542bd0bf 100644
--- a/mysql-test/r/subselect_no_scache.result
+++ b/mysql-test/r/subselect_no_scache.result
@@ -6,6 +6,7 @@ set join_cache_level=1;
set @join_cache_level_for_subselect_test=@@join_cache_level;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
drop view if exists v2;
+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");
@@ -62,7 +63,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 1 AS `1` from dual having ((select 1) = 1)
+Note 1003 select 1 AS `1` from dual having (select 1) = 1
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
@@ -85,7 +86,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
1
1
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
-ERROR HY000: Incorrect usage of PROCEDURE and subquery
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE(1))' at line 1
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
@@ -203,7 +204,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`)))
+Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (select max(`test`.`t2`.`a`) * 4 from `test`.`t2`))
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
3 1
@@ -221,7 +222,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
Warnings:
-Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
+Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt`
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);
a
@@ -243,7 +244,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t4`.`b` AS `b`,(select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
+Note 1003 select `test`.`t4`.`b` AS `b`,(select avg(`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
select * from t3 where exists (select * from t2 where t2.b=t3.a);
a
7
@@ -289,7 +290,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2);
a
7
@@ -333,7 +334,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select (select 2 from dual where (2 = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
+Note 1003 select (select 2 from dual where 2 = `test`.`t2`.`a` union select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -351,7 +352,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t6 ALL i1 NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where (`test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`)
+Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous
drop table t1,t2,t3;
@@ -412,13 +413,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
Warnings:
-Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
+Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03'
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
Warnings:
-Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
+Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
date
2002-08-03
@@ -565,7 +566,7 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
+Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1'
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
@@ -747,7 +748,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref id id 5 const 1 100.00 Using index
Warnings:
Note 1249 Select 2 was reduced during optimization
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 1)
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1
SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id
1
@@ -760,7 +761,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1249 Select 3 was reduced during optimization
Note 1249 Select 2 was reduced during optimization
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = <cache>((1 + 1)))
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = <cache>(1 + 1)
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index
@@ -768,7 +769,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(1) union select 3 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(3)))
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
id
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
@@ -894,7 +895,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1249 Select 2 was reduced during optimization
-Note 1003 select (`test`.`t1`.`a` + 1) AS `(select a+1)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
select (select a+1) from t1;
(select a+1)
2.5
@@ -916,7 +917,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having <is_not_null_test>(`test`.`t2`.`a`)))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having `test`.`t2`.`a` is null))) AS `t1.a in (select t2.a from t2)` from `test`.`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;
@@ -931,7 +932,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a` or `test`.`t2`.`a` is null) having `test`.`t2`.`a` is null)) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
drop table t1,t2,t3;
# check correct NULL Processing for normal IN/ALL/ANY
# and 2 ways of max/min optimization
@@ -1062,7 +1063,7 @@ create table t1 (a float);
select 10.5 IN (SELECT * from t1 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1.5)' at line 1
select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
drop table t1;
@@ -1208,11 +1209,11 @@ CREATE TABLE `t3` (
PRIMARY KEY (`numeropost`),
UNIQUE KEY `maxnumrep` (`maxnumrep`)
) ENGINE=MyISAM CHARSET=latin1;
-INSERT INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
+INSERT IGNORE INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
Warnings:
Warning 1265 Data truncated for column 'date' at row 1
Warning 1265 Data truncated for column 'date' at row 2
-INSERT INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
+INSERT IGNORE INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
Warnings:
Warning 1265 Data truncated for column 'date' at row 1
Warning 1265 Data truncated for column 'date' at row 2
@@ -1238,24 +1239,24 @@ CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT 1)` int(1) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT 1)` int(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT a)` int(1) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT a)` int(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT a+0)` int(3) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT a+0)` int(3) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
@@ -1331,7 +1332,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)`
INSERT INTO t1 (pseudo) VALUES ('test1');
SELECT 0 IN (SELECT 1 FROM t1 a);
0 IN (SELECT 1 FROM t1 a)
@@ -1341,7 +1342,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)`
drop table t1;
CREATE TABLE `t1` (
`i` int(11) NOT NULL default '0',
@@ -1386,7 +1387,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
+Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`)
drop table t1;
CREATE TABLE t1 (
ID int(10) unsigned NOT NULL auto_increment,
@@ -1448,7 +1449,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1458,7 +1459,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1469,7 +1470,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = `test`.`t2`.`a`))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`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));
@@ -1491,7 +1492,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index
1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where (`test`.`t1`.`a` = `test`.`t2`.`a`)
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1501,7 +1502,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index
1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1512,7 +1513,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 index a a 5 NULL 3 100.00 Using where; Using index
1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where `test`.`t1`.`b` = `test`.`t3`.`a` and `test`.`t1`.`a` = `test`.`t2`.`a`
insert into t1 values (3,31);
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
@@ -1528,7 +1529,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index
1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30
drop table t0, t1, t2, t3;
create table t1 (a int, b int);
create table t2 (a int, b int);
@@ -1619,25 +1620,25 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
create table t2 (a int, b int not null);
create table t3 (a int);
@@ -1652,7 +1653,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2);
a
explain extended select * from t3 where a >= some (select b from t2);
@@ -1660,7 +1661,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2 group by 1);
a
6
@@ -1671,7 +1672,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2 group by 1);
a
explain extended select * from t3 where a >= some (select b from t2 group by 1);
@@ -1679,7 +1680,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where NULL >= any (select b from t2);
a
explain extended select * from t3 where NULL >= any (select b from t2);
@@ -1722,7 +1723,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`)))
drop table t2, t3;
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());
@@ -1892,14 +1893,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where
Warnings:
-Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where ((`test`.`t1`.`id` < 8) and (<cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`)))))))
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where `test`.`t1`.`id` < 8 and <cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`)))
explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<in_optimizer>(1,exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null)))))
+Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,exists(select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`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');
@@ -1925,7 +1926,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00
1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition
Warnings:
-Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`b`.`id` = `test`.`a`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`)
+Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id`
drop table t1,t2;
create table t1 (a int);
insert into t1 values (1);
@@ -2617,7 +2618,11 @@ explain select a from t1 where c=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
drop table t1;
+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;
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);
@@ -2979,20 +2984,20 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null))) AS `test` from `test`.`t1`
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where (`test`.`t2`.`flag` = 'N')
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`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;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null))) AS `test` from `test`.`t1`
DROP TABLE t1,t2;
set optimizer_switch=@tmp11867_optimizer_switch;
CREATE TABLE t1 (a char(5), b char(5));
@@ -4458,14 +4463,14 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 2 AS `2` from `test`.`t1` where exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))
+Note 1003 select 2 AS `2` from `test`.`t1` where exists((select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`))
DROP TABLE t1,t2;
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);
-insert into t2
+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;
set session sort_buffer_size= 33*1024;
@@ -4539,14 +4544,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
Warnings:
-Note 1003 select 1 AS `1` from <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where (`<subquery2>`.`min(a)` = 1)
+Note 1003 select 1 AS `1` from <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
Warnings:
-Note 1003 select 1 AS `1` from <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a`) join `test`.`t1` where (`<subquery2>`.`min(a)` = 1)
+Note 1003 select 1 AS `1` from <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` where `test`.`t1`.`a` > 3 group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1
SET join_cache_level=@save_join_cache_level;
DROP TABLE t1;
#
@@ -5003,7 +5008,7 @@ 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;
INSERT INTO v2(a,b) VALUES (2,2);
-ERROR HY000: CHECK OPTION failed 'test.v2'
+ERROR 44000: CHECK OPTION failed `test`.`v2`
SELECT * FROM v1;
c
1
@@ -5190,9 +5195,9 @@ a 1
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
ERROR 42000: Every derived table must have its own alias
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ON 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1) ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) ON 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1)) ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't1a ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
@@ -6013,26 +6018,26 @@ 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);
f1 f1_key
-v j
+s c
+s d
+s d
+s d
s j
-v v
+s m
+s s
+s t
s v
+s y
v c
-s c
-v m
-s m
v d
-s d
v d
-s d
-v y
-s y
-v t
-s t
v d
-s d
+v j
+v m
v s
-s s
+v t
+v v
+v y
DROP TABLE t1,t2;
#
# LP bug 919427: EXPLAIN for a query over a single-row table
@@ -6363,26 +6368,26 @@ SELECT DISTINCT f1_key
FROM t2
WHERE f1_key != table2.f1_key AND f1_key >= table1.f1 );
f1 f1_key
-v j
+s c
+s d
+s d
+s d
s j
-v v
+s m
+s s
+s t
s v
+s y
v c
-s c
-v m
-s m
v d
-s d
v d
-s d
-v y
-s y
-v t
-s t
v d
-s d
+v j
+v m
v s
-s s
+v t
+v v
+v y
explain SELECT table1.f1, table2.f1_key
FROM t1 AS table1, t2 AS table2
WHERE EXISTS
@@ -7271,6 +7276,20 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
# End of 10.1 tests
+#
+# MDEV-12564: IN TO EXISTS transformation for rows after
+# conversion an outer join to inner join
+#
+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';
+pk i c pk i c
+1 10 foo 1 10 foo
+DROP TABLE t;
+# End of 10.2 tests
set optimizer_switch=default;
select @@optimizer_switch like '%subquery_cache=on%';
@@optimizer_switch like '%subquery_cache=on%'
diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result
index 574e78122f1..d5fcc17f08c 100644
--- a/mysql-test/r/subselect_no_semijoin.result
+++ b/mysql-test/r/subselect_no_semijoin.result
@@ -3,6 +3,7 @@ set join_cache_level=1;
set @join_cache_level_for_subselect_test=@@join_cache_level;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
drop view if exists v2;
+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");
@@ -59,7 +60,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 1 AS `1` from dual having ((select 1) = 1)
+Note 1003 select 1 AS `1` from dual having (select 1) = 1
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
@@ -82,7 +83,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
1
1
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
-ERROR HY000: Incorrect usage of PROCEDURE and subquery
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE(1))' at line 1
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
@@ -200,7 +201,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`)))
+Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (select max(`test`.`t2`.`a`) * 4 from `test`.`t2`))
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
3 1
@@ -218,7 +219,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
Warnings:
-Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
+Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt`
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);
a
@@ -240,7 +241,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
+Note 1003 select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((select avg(`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
select * from t3 where exists (select * from t2 where t2.b=t3.a);
a
7
@@ -286,7 +287,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2);
a
7
@@ -330,7 +331,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select <expr_cache><`test`.`t2`.`a`>((select 2 from dual where (2 = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`))) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
+Note 1003 select <expr_cache><`test`.`t2`.`a`>((select 2 from dual where 2 = `test`.`t2`.`a` union select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -348,7 +349,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 MATERIALIZED t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index
Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(<in_optimizer>(`test`.`t6`.`clinic_uq`,`test`.`t6`.`clinic_uq` in ( <materialize> (select `test`.`t7`.`uq` from `test`.`t7` where 1 ), <primary_index_lookup>(`test`.`t6`.`clinic_uq` in <temporary table> on distinct_key where ((`test`.`t6`.`clinic_uq` = `<subquery2>`.`uq`))))))
+Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(<in_optimizer>(`test`.`t6`.`clinic_uq`,`test`.`t6`.`clinic_uq` in ( <materialize> (select `test`.`t7`.`uq` from `test`.`t7` where 1 ), <primary_index_lookup>(`test`.`t6`.`clinic_uq` in <temporary table> on distinct_key where `test`.`t6`.`clinic_uq` = `<subquery2>`.`uq`))))
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous
drop table t1,t2,t3;
@@ -409,13 +410,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
Warnings:
-Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
+Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03'
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
Warnings:
-Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
+Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
date
2002-08-03
@@ -562,7 +563,7 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
+Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1'
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
@@ -744,7 +745,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref id id 5 const 1 100.00 Using index
Warnings:
Note 1249 Select 2 was reduced during optimization
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 1)
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1
SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id
1
@@ -757,7 +758,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1249 Select 3 was reduced during optimization
Note 1249 Select 2 was reduced during optimization
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = <cache>((1 + 1)))
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = <cache>(1 + 1)
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index
@@ -765,7 +766,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <expr_cache><`test`.`t2`.`id`>(<in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3)))))
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <expr_cache><`test`.`t2`.`id`>(<in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(1) union select 3 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))))
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
id
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
@@ -891,7 +892,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1249 Select 2 was reduced during optimization
-Note 1003 select (`test`.`t1`.`a` + 1) AS `(select a+1)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
select (select a+1) from t1;
(select a+1)
2.5
@@ -913,7 +914,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
2 MATERIALIZED t2 index a a 5 NULL 3 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`a` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`a`)))))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`a` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`a`)))) AS `t1.a in (select t2.a from t2)` from `test`.`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;
@@ -928,7 +929,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 MATERIALIZED t2 index a a 5 NULL 3 100.00 Using index
2 MATERIALIZED t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where (`test`.`t3`.`a` = `test`.`t2`.`a`) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`a`)))))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`a`)))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
drop table t1,t2,t3;
# check correct NULL Processing for normal IN/ALL/ANY
# and 2 ways of max/min optimization
@@ -1059,7 +1060,7 @@ create table t1 (a float);
select 10.5 IN (SELECT * from t1 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1.5)' at line 1
select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1);
ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
drop table t1;
@@ -1205,11 +1206,11 @@ CREATE TABLE `t3` (
PRIMARY KEY (`numeropost`),
UNIQUE KEY `maxnumrep` (`maxnumrep`)
) ENGINE=MyISAM CHARSET=latin1;
-INSERT INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
+INSERT IGNORE INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
Warnings:
Warning 1265 Data truncated for column 'date' at row 1
Warning 1265 Data truncated for column 'date' at row 2
-INSERT INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
+INSERT IGNORE INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
Warnings:
Warning 1265 Data truncated for column 'date' at row 1
Warning 1265 Data truncated for column 'date' at row 2
@@ -1235,24 +1236,24 @@ CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT 1)` int(1) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT 1)` int(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT a)` int(1) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT a)` int(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(1) NOT NULL DEFAULT '0',
- `(SELECT a+0)` int(3) NOT NULL DEFAULT '0'
+ `a` int(1) NOT NULL DEFAULT 0,
+ `(SELECT a+0)` int(3) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
@@ -1328,7 +1329,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)`
INSERT INTO t1 (pseudo) VALUES ('test1');
SELECT 0 IN (SELECT 1 FROM t1 a);
0 IN (SELECT 1 FROM t1 a)
@@ -1338,7 +1339,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)`
drop table t1;
CREATE TABLE `t1` (
`i` int(11) NOT NULL default '0',
@@ -1383,7 +1384,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
+Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`)
drop table t1;
CREATE TABLE t1 (
ID int(10) unsigned NOT NULL auto_increment,
@@ -1445,7 +1446,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
2 MATERIALIZED t1 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `<subquery2>`.`a`))))))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where `test`.`t2`.`a` = `<subquery2>`.`a`))))
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1455,7 +1456,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
2 MATERIALIZED t1 ALL PRIMARY NULL NULL NULL 4 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` where (`test`.`t1`.`b` <> 30) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `<subquery2>`.`a`))))))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`b` <> 30 ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where `test`.`t2`.`a` = `<subquery2>`.`a`))))
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1466,7 +1467,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 MATERIALIZED t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using index
2 MATERIALIZED t1 ALL PRIMARY NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where (`test`.`t1`.`b` = `test`.`t3`.`a`) ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where ((`test`.`t2`.`a` = `<subquery2>`.`a`))))))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`a` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where `test`.`t2`.`a` = `<subquery2>`.`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));
@@ -1498,7 +1499,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where ((`test`.`t1`.`b` <> 30) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where `test`.`t1`.`b` <> 30 and <cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1509,7 +1510,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 ref a a 10 func,test.t3.a 1167 100.00 Using index
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`a` and <cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))
insert into t1 values (3,31);
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
@@ -1525,7 +1526,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where ((`test`.`t1`.`b` <> 30) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where `test`.`t1`.`b` <> 30 and <cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
drop table t0, t1, t2, t3;
create table t1 (a int, b int);
create table t2 (a int, b int);
@@ -1616,25 +1617,25 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 MATERIALIZED t2 index s1 s1 6 NULL 2 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( <materialize> (select `test`.`t2`.`s1` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`s1` in <temporary table> on distinct_key where ((`test`.`t1`.`s1` = `<subquery2>`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( <materialize> (select `test`.`t2`.`s1` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`s1` in <temporary table> on distinct_key where `test`.`t1`.`s1` = `<subquery2>`.`s1`)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 MATERIALIZED t2 index s1 s1 6 NULL 2 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( <materialize> (select `test`.`t2`.`s1` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`s1` in <temporary table> on distinct_key where ((`test`.`t1`.`s1` = `<subquery2>`.`s1`)))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( <materialize> (select `test`.`t2`.`s1` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`s1` in <temporary table> on distinct_key where `test`.`t1`.`s1` = `<subquery2>`.`s1`)))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 MATERIALIZED t2 index s1 s1 6 NULL 2 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( <materialize> (select `test`.`t2`.`s1` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`s1` in <temporary table> on distinct_key where ((`test`.`t1`.`s1` = `<subquery2>`.`s1`)))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( <materialize> (select `test`.`t2`.`s1` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`s1` in <temporary table> on distinct_key where `test`.`t1`.`s1` = `<subquery2>`.`s1`)))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
2 MATERIALIZED t2 index s1 s1 6 NULL 2 50.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( <materialize> (select `test`.`t2`.`s1` from `test`.`t2` where (`test`.`t2`.`s1` < 'a2') ), <primary_index_lookup>(`test`.`t1`.`s1` in <temporary table> on distinct_key where ((`test`.`t1`.`s1` = `<subquery2>`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
+Note 1003 select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( <materialize> (select `test`.`t2`.`s1` from `test`.`t2` where `test`.`t2`.`s1` < 'a2' ), <primary_index_lookup>(`test`.`t1`.`s1` in <temporary table> on distinct_key where `test`.`t1`.`s1` = `<subquery2>`.`s1`)))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
create table t2 (a int, b int not null);
create table t3 (a int);
@@ -1649,7 +1650,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2);
a
explain extended select * from t3 where a >= some (select b from t2);
@@ -1657,7 +1658,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= all (select b from t2 group by 1);
a
6
@@ -1668,7 +1669,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`)))
select * from t3 where a >= some (select b from t2 group by 1);
a
explain extended select * from t3 where a >= some (select b from t2 group by 1);
@@ -1676,7 +1677,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`)))
select * from t3 where NULL >= any (select b from t2);
a
explain extended select * from t3 where NULL >= any (select b from t2);
@@ -1719,7 +1720,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))))
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`)))
drop table t2, t3;
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());
@@ -1889,14 +1890,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where
2 MATERIALIZED t1 range PRIMARY PRIMARY 4 NULL 7 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not(<expr_cache><`test`.`t1`.`id`>(<in_optimizer>(`test`.`t1`.`id`,`test`.`t1`.`id` in ( <materialize> (select `test`.`t1`.`id` from `test`.`t1` where (`test`.`t1`.`id` < 8) ), <primary_index_lookup>(`test`.`t1`.`id` in <temporary table> on distinct_key where ((`test`.`t1`.`id` = `<subquery2>`.`id`))))))))
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !<expr_cache><`test`.`t1`.`id`>(<in_optimizer>(`test`.`t1`.`id`,`test`.`t1`.`id` in ( <materialize> (select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 ), <primary_index_lookup>(`test`.`t1`.`id` in <temporary table> on distinct_key where `test`.`t1`.`id` = `<subquery2>`.`id`))))
explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))))
+Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`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');
@@ -1922,7 +1923,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00
1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition
Warnings:
-Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`b`.`id` = `test`.`a`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`)
+Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id`
drop table t1,t2;
create table t1 (a int);
insert into t1 values (1);
@@ -2432,7 +2433,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <expr_cache><`test`.`up`.`a`>(<in_optimizer>(`test`.`up`.`a`,`test`.`up`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` where 1 ), <primary_index_lookup>(`test`.`up`.`a` in <temporary table> on distinct_key where ((`test`.`up`.`a` = `<subquery2>`.`a`))))))
+Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <expr_cache><`test`.`up`.`a`>(<in_optimizer>(`test`.`up`.`a`,`test`.`up`.`a` in ( <materialize> (select `test`.`t1`.`a` from `test`.`t1` where 1 ), <primary_index_lookup>(`test`.`up`.`a` in <temporary table> on distinct_key where `test`.`up`.`a` = `<subquery2>`.`a`))))
drop table t1;
CREATE TABLE t1 (t1_a int);
INSERT INTO t1 VALUES (1);
@@ -2613,7 +2614,11 @@ explain select a from t1 where c=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
drop table t1;
+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;
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);
@@ -2975,19 +2980,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( <materialize> (select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') ), <primary_index_lookup>(`test`.`t1`.`one` in <temporary table> on distinct_key where ((`test`.`t1`.`one` = `<subquery2>`.`one`) and (`test`.`t1`.`two` = `<subquery2>`.`two`)))))) AS `test` from `test`.`t1`
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( <materialize> (select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' ), <primary_index_lookup>(`test`.`t1`.`one` in <temporary table> on distinct_key where `test`.`t1`.`one` = `<subquery2>`.`one` and `test`.`t1`.`two` = `<subquery2>`.`two`)))) AS `test` from `test`.`t1`
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 Using where
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( <materialize> (select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where (`test`.`t2`.`flag` = 'N') ), <primary_index_lookup>(`test`.`t1`.`one` in <temporary table> on distinct_key where ((`test`.`t1`.`one` = `<subquery2>`.`one`) and (`test`.`t1`.`two` = `<subquery2>`.`two`))))))
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( <materialize> (select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = 'N' ), <primary_index_lookup>(`test`.`t1`.`one` in <temporary table> on distinct_key where `test`.`t1`.`one` = `<subquery2>`.`one` and `test`.`t1`.`two` = `<subquery2>`.`two`))))
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( <materialize> (select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') ), <primary_index_lookup>(`test`.`t1`.`one` in <temporary table> on distinct_key where ((`test`.`t1`.`one` = `<subquery2>`.`one`) and (`test`.`t1`.`two` = `<subquery2>`.`two`)))))) AS `test` from `test`.`t1`
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( <materialize> (select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' ), <primary_index_lookup>(`test`.`t1`.`one` in <temporary table> on distinct_key where `test`.`t1`.`one` = `<subquery2>`.`one` and `test`.`t1`.`two` = `<subquery2>`.`two`)))) AS `test` from `test`.`t1`
DROP TABLE t1,t2;
set optimizer_switch=@tmp11867_optimizer_switch;
CREATE TABLE t1 (a char(5), b char(5));
@@ -4438,7 +4443,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`a` from `test`.`t2` where 1 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`a`))))))
+Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`a` from `test`.`t2` where 1 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`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));
@@ -4450,14 +4455,14 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))))
+Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)))
DROP TABLE t1,t2;
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);
-insert into t2
+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;
set session sort_buffer_size= 33*1024;
@@ -4993,7 +4998,7 @@ 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;
INSERT INTO v2(a,b) VALUES (2,2);
-ERROR HY000: CHECK OPTION failed 'test.v2'
+ERROR 44000: CHECK OPTION failed `test`.`v2`
SELECT * FROM v1;
c
1
@@ -5180,9 +5185,9 @@ a 1
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
ERROR 42000: Every derived table must have its own alias
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ON 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1) ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) ON 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1)) ON 1' at line 1
SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't1a ON 1' at line 1
SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
@@ -6000,26 +6005,26 @@ 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);
f1 f1_key
-v j
+s c
+s d
+s d
+s d
s j
-v v
+s m
+s s
+s t
s v
+s y
v c
-s c
-v m
-s m
v d
-s d
v d
-s d
-v y
-s y
-v t
-s t
v d
-s d
+v j
+v m
v s
-s s
+v t
+v v
+v y
DROP TABLE t1,t2;
#
# LP bug 919427: EXPLAIN for a query over a single-row table
@@ -6348,26 +6353,26 @@ SELECT DISTINCT f1_key
FROM t2
WHERE f1_key != table2.f1_key AND f1_key >= table1.f1 );
f1 f1_key
-v j
+s c
+s d
+s d
+s d
s j
-v v
+s m
+s s
+s t
s v
+s y
v c
-s c
-v m
-s m
v d
-s d
v d
-s d
-v y
-s y
-v t
-s t
v d
-s d
+v j
+v m
v s
-s s
+v t
+v v
+v y
explain SELECT table1.f1, table2.f1_key
FROM t1 AS table1, t2 AS table2
WHERE EXISTS
@@ -7256,5 +7261,19 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
# End of 10.1 tests
+#
+# MDEV-12564: IN TO EXISTS transformation for rows after
+# conversion an outer join to inner join
+#
+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';
+pk i c pk i c
+1 10 foo 1 10 foo
+DROP TABLE t;
+# End of 10.2 tests
set @optimizer_switch_for_subselect_test=null;
set @join_cache_level_for_subselect_test=NULL;
diff --git a/mysql-test/r/subselect_partial_match.result b/mysql-test/r/subselect_partial_match.result
index 9dc2b44fd30..256295cef28 100644
--- a/mysql-test/r/subselect_partial_match.result
+++ b/mysql-test/r/subselect_partial_match.result
@@ -775,7 +775,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using where
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00
Warnings:
-Note 1003 select `table1`.`a1` AS `a1`,`table1`.`a2` AS `a2` from (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where (not(<in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (select `test`.`t2`.`b2` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where ((`test`.`t1`.`a1` = `<subquery3>`.`b2`)))))))) `table1`
+Note 1003 select `table1`.`a1` AS `a1`,`table1`.`a2` AS `a2` from (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where !<in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (select `test`.`t2`.`b2` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery3>`.`b2`)))) `table1`
set optimizer_switch=@tmp_optimizer_switch;
DROP TABLE t1, t2;
#
diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result
index 77dea34e2ab..1d86b2acf72 100644
--- a/mysql-test/r/subselect_sj.result
+++ b/mysql-test/r/subselect_sj.result
@@ -74,7 +74,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where
1 PRIMARY t12 eq_ref PRIMARY PRIMARY 4 test.t10.a 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t12`.`pk` = `test`.`t10`.`a`) and (`test`.`t10`.`pk` = `test`.`t1`.`a`))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where `test`.`t12`.`pk` = `test`.`t10`.`a` and `test`.`t10`.`pk` = `test`.`t1`.`a`
subqueries within outer joins go into ON expr.
explAin extended
select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10));
@@ -84,7 +84,7 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA
1 PRIMARY B ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`A`.`A` = `test`.`t1`.`A`) And <in_optimizer>(`test`.`B`.`A`,`test`.`B`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`B`.`A` in <temporAry tABle> on distinct_key where ((`test`.`B`.`A` = `<suBquery2>`.`pk`))))))) where 1
+Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(`test`.`A`.`A` = `test`.`t1`.`A` And <in_optimizer>(`test`.`B`.`A`,`test`.`B`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`B`.`A` in <temporAry tABle> on distinct_key where `test`.`B`.`A` = `<suBquery2>`.`pk`)))) where 1
t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)"
explAin extended
select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10));
@@ -93,7 +93,7 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(((`test`.`t2`.`A` = `test`.`t1`.`A`) And <in_optimizer>(`test`.`t1`.`A`,`test`.`t1`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`t1`.`A` in <temporAry tABle> on distinct_key where ((`test`.`t1`.`A` = `<suBquery2>`.`pk`))))))) where 1
+Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`A` = `test`.`t1`.`A` And <in_optimizer>(`test`.`t1`.`A`,`test`.`t1`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`t1`.`A` in <temporAry tABle> on distinct_key where `test`.`t1`.`A` = `<suBquery2>`.`pk`)))) where 1
set join_buffer_size=8*1024;
we shouldn't flatten if we're going to get a join of > MAX_TABLES.
explain select * from
@@ -207,7 +207,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t10 range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index
1 PRIMARY t1 ALL NULL NULL NULL NULL 103 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t1` where ((`test`.`t1`.`a` = `test`.`t10`.`pk`) and (`test`.`t10`.`pk` < 3))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t10`.`pk` and `test`.`t10`.`pk` < 3
drop table t0, t1, t2;
drop table t10, t11, t12;
@@ -503,7 +503,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t0.pk 1 100.00 Using where
1 PRIMARY t2 ref vkey vkey 4 test.t1.vnokey 2 100.00 Using index; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where ((`test`.`t1`.`pk` = `test`.`t0`.`pk`) and (`test`.`t2`.`vkey` = `test`.`t1`.`vnokey`))
+Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where `test`.`t1`.`pk` = `test`.`t0`.`pk` and `test`.`t2`.`vkey` = `test`.`t1`.`vnokey`
SELECT vkey FROM t0 WHERE pk IN
(SELECT t1.pk FROM t0 t1 JOIN t0 t2 ON t2.vkey = t1.vnokey);
vkey
@@ -767,11 +767,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`)))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`c` = `test`.`t1`.`a` and <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and <cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))
show warnings;
Level Code Message
Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`)))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`c` = `test`.`t1`.`a` and <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and <cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))
select a from t1
where a in (select c from t2 where d >= some(select e from t3 where b=e));
a
@@ -807,7 +807,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 11 func,func 1 100.00
2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0);
pk
2
@@ -816,7 +816,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`c` = `test`.`t1`.`c`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`c` = `test`.`t1`.`c` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, c) IN (SELECT b, c FROM t2 WHERE pk > 0);
pk
1
@@ -826,7 +826,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`d` = `test`.`t1`.`d`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`d` = `test`.`t1`.`d` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, d) IN (SELECT b, d FROM t2 WHERE pk > 0);
pk
2
@@ -835,7 +835,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`e` = `test`.`t1`.`e`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`e` = `test`.`t1`.`e` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, e) IN (SELECT b, e FROM t2 WHERE pk > 0);
pk
1
@@ -845,7 +845,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`f` = `test`.`t1`.`f`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`f` = `test`.`t1`.`f` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, f) IN (SELECT b, f FROM t2 WHERE pk > 0);
pk
1
@@ -855,7 +855,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`g` = `test`.`t1`.`g`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`g` = `test`.`t1`.`g` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, g) IN (SELECT b, g FROM t2 WHERE pk > 0);
pk
1
@@ -865,7 +865,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`h` = `test`.`t1`.`h`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`h` = `test`.`t1`.`h` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, h) IN (SELECT b, h FROM t2 WHERE pk > 0);
pk
1
@@ -875,7 +875,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`i` = `test`.`t1`.`i`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`i` = `test`.`t1`.`i` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, i) IN (SELECT b, i FROM t2 WHERE pk > 0);
pk
1
@@ -885,7 +885,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`j` = `test`.`t1`.`j`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`j` = `test`.`t1`.`j` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, j) IN (SELECT b, j FROM t2 WHERE pk > 0);
pk
1
@@ -895,7 +895,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`k` = `test`.`t1`.`k`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`k` = `test`.`t1`.`k` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, k) IN (SELECT b, k FROM t2 WHERE pk > 0);
pk
1
@@ -976,7 +976,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join)
2 MATERIALIZED t1 ALL varchar_key NULL NULL NULL 15 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`varchar_nokey` AS `varchar_nokey` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`varchar_nokey` = `test`.`t1`.`varchar_key`) and (`test`.`t2`.`varchar_nokey` = `test`.`t1`.`varchar_key`) and ((`test`.`t1`.`varchar_key` < 'n') xor `test`.`t1`.`pk`))
+Note 1003 select `test`.`t2`.`varchar_nokey` AS `varchar_nokey` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`varchar_nokey` = `test`.`t1`.`varchar_key` and `test`.`t2`.`varchar_nokey` = `test`.`t1`.`varchar_key` and (`test`.`t1`.`varchar_key` < 'n' xor `test`.`t1`.`pk`)
SELECT varchar_nokey
FROM t2
WHERE ( `varchar_nokey` , `varchar_nokey` ) IN (
@@ -1996,7 +1996,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t3 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where ((`test`.`t4`.`f2` = `test`.`t2`.`f3`) and (`test`.`t3`.`f1` = `test`.`t1`.`f1`) and (`test`.`t1`.`f2` = `test`.`t2`.`f2`))
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where `test`.`t4`.`f2` = `test`.`t2`.`f3` and `test`.`t3`.`f1` = `test`.`t1`.`f1` and `test`.`t1`.`f2` = `test`.`t2`.`f2`
SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3) WHERE t2.f3 IN (SELECT * FROM t4);
f1 f2 f3 f3
2 0 0 0
@@ -2880,6 +2880,8 @@ DROP TABLE t1, t2;
# MDEV-389: Wrong result (missing row) with semijoin, join_cache_level>4, LEFT JOIN...
# (testcase only)
#
+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;
@@ -2894,6 +2896,8 @@ a cnt
1 1
4 1
drop table t1, t2;
+connection default;
+disconnect con1;
#
# MDEV-4071: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with ...
#
@@ -2969,7 +2973,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 100.00
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using where; End temporary
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1` AS `c1`,'x' AS `c2` from `test`.`t1` semi join (`test`.`t1` left join `test`.`t3` on((`test`.`t1`.`c1` = `test`.`t3`.`c3`))) where (`test`.`t1`.`pk` = `test`.`t1`.`pk`) order by 'x',`test`.`t1`.`c1`
+Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1` AS `c1`,'x' AS `c2` from `test`.`t1` semi join (`test`.`t1` left join `test`.`t3` on(`test`.`t1`.`c1` = `test`.`t3`.`c3`)) where `test`.`t1`.`pk` = `test`.`t1`.`pk` order by 'x',`test`.`t1`.`c1`
DROP TABLE t1,t2,t3;
#
# MDEV-5059: Wrong result (missing row) wih semijoin, join_cache_level > 2, LEFT JOIN, ORDER BY
@@ -3138,7 +3142,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
2 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t3`.`c3` = `test`.`t1`.`c1`) and <cache>(<in_optimizer>(1,<exists>(select `test`.`t4`.`c4` from `test`.`t4` where (1 = `test`.`t4`.`c4`)))))) where 1
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t3`.`c3` = `test`.`t1`.`c1` and <cache>(<in_optimizer>(1,<exists>(select `test`.`t4`.`c4` from `test`.`t4` where 1 = `test`.`t4`.`c4`)))) where 1
# mdev-12820
SELECT *
FROM t1
@@ -3159,7 +3163,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2`,`test`.`t4`.`c4` AS `c4` from `test`.`t1` left join (`test`.`t2` join `test`.`t4`) on(((`test`.`t2`.`c2` = `test`.`t1`.`c1`) and <in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t3`.`c3` from `test`.`t3` where (<cache>(`test`.`t2`.`c2`) = `test`.`t3`.`c3`))))) where 1
+Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2`,`test`.`t4`.`c4` AS `c4` from `test`.`t1` left join (`test`.`t2` join `test`.`t4`) on(`test`.`t2`.`c2` = `test`.`t1`.`c1` and <in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t3`.`c3` from `test`.`t3` where <cache>(`test`.`t2`.`c2`) = `test`.`t3`.`c3`))) where 1
DROP TABLE t1,t2,t3,t4;
#
# MDEV-13699: Assertion `!new_field->field_name.str ||
diff --git a/mysql-test/r/subselect_sj2.result b/mysql-test/r/subselect_sj2.result
index 21d97b3faea..948be5766a2 100644
--- a/mysql-test/r/subselect_sj2.result
+++ b/mysql-test/r/subselect_sj2.result
@@ -456,7 +456,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2)
Warnings:
Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`b` = `test`.`t2`.`b`))
+Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b`
update t1 set a=3, b=11 where a=4;
update t2 set b=11 where a=3;
select * from t0 where t0.a in
@@ -937,6 +937,8 @@ SELECT d FROM t2, t1
WHERE a = d AND ( pk < 2 OR d = 'z' )
);
a b c
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'x'
DROP TABLE t1, t2;
#
# BUG#951937: Wrong result (missing rows) with semijoin+materialization, IN subquery, InnoDB, TEMPTABLE view
@@ -1316,5 +1318,18 @@ id
1
2
drop table t1,t2,t3;
+#
+# MDEV-11108: Assertion `uniq_tuple_length_arg <= table->file->max_key_length()' failed in SJ_TMP_TABLE::create_sj_weedout_tmp_table
+#
+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 ) ) ;
+a pk b
+DROP TABLE t1,t2,t3;
+DROP VIEW v3;
# This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
diff --git a/mysql-test/r/subselect_sj2_jcl6.result b/mysql-test/r/subselect_sj2_jcl6.result
index eb91fe6d61b..2955307eb86 100644
--- a/mysql-test/r/subselect_sj2_jcl6.result
+++ b/mysql-test/r/subselect_sj2_jcl6.result
@@ -468,7 +468,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2); Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
Warnings:
Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`b` = `test`.`t2`.`b`))
+Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b`
update t1 set a=3, b=11 where a=4;
update t2 set b=11 where a=3;
# Not anymore:
@@ -952,6 +952,8 @@ SELECT d FROM t2, t1
WHERE a = d AND ( pk < 2 OR d = 'z' )
);
a b c
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'x'
DROP TABLE t1, t2;
#
# BUG#951937: Wrong result (missing rows) with semijoin+materialization, IN subquery, InnoDB, TEMPTABLE view
@@ -1182,7 +1184,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ref PRIMARY PRIMARY 5 const 1 Using where; Using index
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Start temporary; Using join buffer (flat, BNL join)
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
-1 PRIMARY t4 hash_index NULL #hash#$hj:PRIMARY 54:59 test.t3.t3_c 2 Using where; End temporary; Using join buffer (incremental, BNLH join)
+1 PRIMARY t4 hash_index NULL #hash#$hj:PRIMARY 54:59 test.t3.t3_c 2 Using where; Using index; End temporary; Using join buffer (incremental, BNLH join)
DROP TABLE t1,t2,t3,t4;
#
# MDEV-6263: Wrong result when using IN subquery with order by
@@ -1331,6 +1333,19 @@ id
1
2
drop table t1,t2,t3;
+#
+# MDEV-11108: Assertion `uniq_tuple_length_arg <= table->file->max_key_length()' failed in SJ_TMP_TABLE::create_sj_weedout_tmp_table
+#
+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 ) ) ;
+a pk b
+DROP TABLE t1,t2,t3;
+DROP VIEW v3;
# This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
#
diff --git a/mysql-test/r/subselect_sj2_mat.result b/mysql-test/r/subselect_sj2_mat.result
index c8ee451c62f..3ff0e619188 100644
--- a/mysql-test/r/subselect_sj2_mat.result
+++ b/mysql-test/r/subselect_sj2_mat.result
@@ -458,7 +458,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2)
Warnings:
Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`b` = `test`.`t2`.`b`))
+Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b`
update t1 set a=3, b=11 where a=4;
update t2 set b=11 where a=3;
select * from t0 where t0.a in
@@ -939,6 +939,8 @@ SELECT d FROM t2, t1
WHERE a = d AND ( pk < 2 OR d = 'z' )
);
a b c
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'x'
DROP TABLE t1, t2;
#
# BUG#951937: Wrong result (missing rows) with semijoin+materialization, IN subquery, InnoDB, TEMPTABLE view
@@ -1318,6 +1320,19 @@ id
1
2
drop table t1,t2,t3;
+#
+# MDEV-11108: Assertion `uniq_tuple_length_arg <= table->file->max_key_length()' failed in SJ_TMP_TABLE::create_sj_weedout_tmp_table
+#
+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 ) ) ;
+a pk b
+DROP TABLE t1,t2,t3;
+DROP VIEW v3;
# This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
set optimizer_switch=default;
@@ -1471,7 +1486,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref idx idx 2 test.t4.a4 1 100.00 Using index; End temporary
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on((`test`.`t2`.`a2` = `test`.`t4`.`a4`)) where ((`test`.`t4`.`b4` = `test`.`t4`.`a4`) and (`test`.`t1`.`b1` = `test`.`t4`.`a4`))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(`test`.`t2`.`a2` = `test`.`t4`.`a4`) where `test`.`t4`.`b4` = `test`.`t4`.`a4` and `test`.`t1`.`b1` = `test`.`t4`.`a4`
SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 )
WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4);
a1 b1 a2 b2
@@ -1490,7 +1505,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00
2 MATERIALIZED t4 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(((`test`.`t1`.`b1` = `test`.`t4`.`a4`) and (`test`.`t2`.`a2` = `test`.`t4`.`a4`))) where ((`test`.`t4`.`b4` = `test`.`t4`.`a4`) and (`test`.`t1`.`b1` = `test`.`t4`.`a4`))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(`test`.`t1`.`b1` = `test`.`t4`.`a4` and `test`.`t2`.`a2` = `test`.`t4`.`a4`) where `test`.`t4`.`b4` = `test`.`t4`.`a4` and `test`.`t1`.`b1` = `test`.`t4`.`a4`
SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 )
WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4);
a1 b1 a2 b2
@@ -1525,7 +1540,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 10 100.00 Using where; End temporary; Using join buffer (flat, BNL join)
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(((`test`.`t2`.`c2` = `test`.`t1`.`c1`) or (`test`.`t1`.`c1` > 'z'))) where ((`test`.`t4`.`c4` = `test`.`t1`.`c1`) and (`test`.`t3`.`c3` = `test`.`t1`.`c1`))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(`test`.`t2`.`c2` = `test`.`t1`.`c1` or `test`.`t1`.`c1` > 'z') where `test`.`t4`.`c4` = `test`.`t1`.`c1` and `test`.`t3`.`c3` = `test`.`t1`.`c1`
SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z')
WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4);
a1 c1 c2
@@ -1543,7 +1558,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 MATERIALIZED t4 ALL NULL NULL NULL NULL 2 100.00
2 MATERIALIZED t3 ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(((`test`.`t2`.`c2` = `test`.`t1`.`c1`) or (`test`.`t1`.`c1` > 'z'))) where (`test`.`t3`.`c3` = `test`.`t4`.`c4`)
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(`test`.`t2`.`c2` = `test`.`t1`.`c1` or `test`.`t1`.`c1` > 'z') where `test`.`t3`.`c3` = `test`.`t4`.`c4`
SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z')
WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4);
a1 c1 c2
@@ -1573,7 +1588,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
2 DEPENDENT SUBQUERY t3 hash_ALL NULL #hash#$hj 5 func 3 100.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
-Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` where <expr_cache><`test`.`t1`.`i1`>(<in_optimizer>(`test`.`t1`.`i1`,<exists>(select `test`.`t3`.`i3` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (<cache>(`test`.`t1`.`i1`) = `test`.`t3`.`i3`)))))
+Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` where <expr_cache><`test`.`t1`.`i1`>(<in_optimizer>(`test`.`t1`.`i1`,<exists>(select `test`.`t3`.`i3` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`i3` = `test`.`t2`.`i2` and <cache>(`test`.`t1`.`i1`) = `test`.`t3`.`i3`)))
SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
i1
7
@@ -1586,7 +1601,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 MATERIALIZED t3 hash_ALL NULL #hash#$hj 5 test.t2.i2 3 100.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
-Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`i1` = `test`.`t2`.`i2`))
+Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where `test`.`t3`.`i3` = `test`.`t2`.`i2` and `test`.`t1`.`i1` = `test`.`t2`.`i2`
SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
i1
7
@@ -1599,7 +1614,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 MATERIALIZED t3 hash_ALL NULL #hash#$hj 5 test.t2.i2 3 100.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
-Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`i1` = `test`.`t2`.`i2`) and (`test`.`t3`.`i3` > 0))
+Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where `test`.`t3`.`i3` = `test`.`t2`.`i2` and `test`.`t1`.`i1` = `test`.`t2`.`i2` and `test`.`t3`.`i3` > 0
SELECT * FROM t1
WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 0 AND i3 = i2 OR 1=2);
i1
@@ -1630,7 +1645,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10 100.00
Warnings:
-Note 1003 select `test`.`t1`.`i` AS `i` from `test`.`t1` semi join (`test`.`t2`) where ((rand() < 0))
+Note 1003 select `test`.`t1`.`i` AS `i` from `test`.`t1` semi join (`test`.`t2`) where rand() < 0
drop table t1,t2;
set optimizer_switch=@save_optimizer_switch;
#
@@ -1651,7 +1666,7 @@ WHERE f1 IN ( SELECT f2 FROM t2 WHERE f2 > 'bar' )
HAVING f1 != 'foo'
ORDER BY f1;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 index f1 f1 11 NULL 2 Using index
+1 PRIMARY t1 index f1 f1 11 NULL 2 Using where; Using index
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 11 func 1
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where
DROP TABLE t1,t2;
diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result
index 0741eb236ea..234ea6884bd 100644
--- a/mysql-test/r/subselect_sj_jcl6.result
+++ b/mysql-test/r/subselect_sj_jcl6.result
@@ -87,7 +87,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
1 PRIMARY t12 eq_ref PRIMARY PRIMARY 4 test.t10.a 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t12`.`pk` = `test`.`t10`.`a`) and (`test`.`t10`.`pk` = `test`.`t1`.`a`))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where `test`.`t12`.`pk` = `test`.`t10`.`a` and `test`.`t10`.`pk` = `test`.`t1`.`a`
subqueries within outer joins go into ON expr.
explAin extended
select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10));
@@ -97,7 +97,7 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA
1 PRIMARY B ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (incrementAl, BNL join)
2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`A`.`A` = `test`.`t1`.`A`) And <in_optimizer>(`test`.`B`.`A`,`test`.`B`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`B`.`A` in <temporAry tABle> on distinct_key where ((`test`.`B`.`A` = `<suBquery2>`.`pk`))))))) where 1
+Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(`test`.`A`.`A` = `test`.`t1`.`A` And <in_optimizer>(`test`.`B`.`A`,`test`.`B`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`B`.`A` in <temporAry tABle> on distinct_key where `test`.`B`.`A` = `<suBquery2>`.`pk`)))) where 1
t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)"
explAin extended
select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10));
@@ -106,7 +106,7 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (flAt, BNL join)
2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(((`test`.`t2`.`A` = `test`.`t1`.`A`) And <in_optimizer>(`test`.`t1`.`A`,`test`.`t1`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`t1`.`A` in <temporAry tABle> on distinct_key where ((`test`.`t1`.`A` = `<suBquery2>`.`pk`))))))) where 1
+Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`A` = `test`.`t1`.`A` And <in_optimizer>(`test`.`t1`.`A`,`test`.`t1`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`t1`.`A` in <temporAry tABle> on distinct_key where `test`.`t1`.`A` = `<suBquery2>`.`pk`)))) where 1
set join_buffer_size=8*1024;
we shouldn't flatten if we're going to get a join of > MAX_TABLES.
explain select * from
@@ -220,7 +220,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t10 range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index
1 PRIMARY t1 ALL NULL NULL NULL NULL 103 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t1` where ((`test`.`t1`.`a` = `test`.`t10`.`pk`) and (`test`.`t10`.`pk` < 3))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t10`.`pk` and `test`.`t10`.`pk` < 3
drop table t0, t1, t2;
drop table t10, t11, t12;
@@ -516,7 +516,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t0.pk 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
1 PRIMARY t2 ref vkey vkey 4 test.t1.vnokey 2 100.00 Using index; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where ((`test`.`t1`.`pk` = `test`.`t0`.`pk`) and (`test`.`t2`.`vkey` = `test`.`t1`.`vnokey`))
+Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where `test`.`t1`.`pk` = `test`.`t0`.`pk` and `test`.`t2`.`vkey` = `test`.`t1`.`vnokey`
SELECT vkey FROM t0 WHERE pk IN
(SELECT t1.pk FROM t0 t1 JOIN t0 t2 ON t2.vkey = t1.vnokey);
vkey
@@ -780,11 +780,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`)))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`c` = `test`.`t1`.`a` and <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and <cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))
show warnings;
Level Code Message
Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`)))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`c` = `test`.`t1`.`a` and <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and <cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))
select a from t1
where a in (select c from t2 where d >= some(select e from t3 where b=e));
a
@@ -820,7 +820,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 11 func,func 1 100.00
2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0);
pk
2
@@ -829,7 +829,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`c` = `test`.`t1`.`c`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`c` = `test`.`t1`.`c` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, c) IN (SELECT b, c FROM t2 WHERE pk > 0);
pk
1
@@ -839,7 +839,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`d` = `test`.`t1`.`d`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`d` = `test`.`t1`.`d` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, d) IN (SELECT b, d FROM t2 WHERE pk > 0);
pk
2
@@ -848,7 +848,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`e` = `test`.`t1`.`e`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`e` = `test`.`t1`.`e` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, e) IN (SELECT b, e FROM t2 WHERE pk > 0);
pk
1
@@ -858,7 +858,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`f` = `test`.`t1`.`f`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`f` = `test`.`t1`.`f` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, f) IN (SELECT b, f FROM t2 WHERE pk > 0);
pk
1
@@ -868,7 +868,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`g` = `test`.`t1`.`g`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`g` = `test`.`t1`.`g` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, g) IN (SELECT b, g FROM t2 WHERE pk > 0);
pk
1
@@ -878,7 +878,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`h` = `test`.`t1`.`h`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`h` = `test`.`t1`.`h` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, h) IN (SELECT b, h FROM t2 WHERE pk > 0);
pk
1
@@ -888,7 +888,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`i` = `test`.`t1`.`i`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`i` = `test`.`t1`.`i` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, i) IN (SELECT b, i FROM t2 WHERE pk > 0);
pk
1
@@ -898,7 +898,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`j` = `test`.`t1`.`j`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`j` = `test`.`t1`.`j` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, j) IN (SELECT b, j FROM t2 WHERE pk > 0);
pk
1
@@ -908,7 +908,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`k` = `test`.`t1`.`k`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`k` = `test`.`t1`.`k` and `test`.`t2`.`pk` > 0
SELECT pk FROM t1 WHERE (b, k) IN (SELECT b, k FROM t2 WHERE pk > 0);
pk
1
@@ -989,7 +989,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join)
2 MATERIALIZED t1 ALL varchar_key NULL NULL NULL 15 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`varchar_nokey` AS `varchar_nokey` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`varchar_nokey` = `test`.`t1`.`varchar_key`) and (`test`.`t2`.`varchar_nokey` = `test`.`t1`.`varchar_key`) and ((`test`.`t1`.`varchar_key` < 'n') xor `test`.`t1`.`pk`))
+Note 1003 select `test`.`t2`.`varchar_nokey` AS `varchar_nokey` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`varchar_nokey` = `test`.`t1`.`varchar_key` and `test`.`t2`.`varchar_nokey` = `test`.`t1`.`varchar_key` and (`test`.`t1`.`varchar_key` < 'n' xor `test`.`t1`.`pk`)
SELECT varchar_nokey
FROM t2
WHERE ( `varchar_nokey` , `varchar_nokey` ) IN (
@@ -2010,7 +2010,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (incremental, BNL join)
2 MATERIALIZED t4 index f2 f2 5 NULL 2 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`f1` = `test`.`t1`.`f1`) and (`test`.`t1`.`f2` = `test`.`t2`.`f2`))
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where `test`.`t3`.`f1` = `test`.`t1`.`f1` and `test`.`t1`.`f2` = `test`.`t2`.`f2`
SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3) WHERE t2.f3 IN (SELECT * FROM t4);
f1 f2 f3 f3
2 0 0 0
@@ -2894,6 +2894,8 @@ DROP TABLE t1, t2;
# MDEV-389: Wrong result (missing row) with semijoin, join_cache_level>4, LEFT JOIN...
# (testcase only)
#
+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;
@@ -2908,6 +2910,8 @@ a cnt
1 1
4 1
drop table t1, t2;
+connection default;
+disconnect con1;
#
# MDEV-4071: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with ...
#
@@ -2983,7 +2987,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using where; End temporary; Using join buffer (incremental, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1` AS `c1`,'x' AS `c2` from `test`.`t1` semi join (`test`.`t1` left join `test`.`t3` on((`test`.`t1`.`c1` = `test`.`t3`.`c3`))) where (`test`.`t1`.`pk` = `test`.`t1`.`pk`) order by 'x',`test`.`t1`.`c1`
+Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1` AS `c1`,'x' AS `c2` from `test`.`t1` semi join (`test`.`t1` left join `test`.`t3` on(`test`.`t1`.`c1` = `test`.`t3`.`c3`)) where `test`.`t1`.`pk` = `test`.`t1`.`pk` order by 'x',`test`.`t1`.`c1`
DROP TABLE t1,t2,t3;
#
# MDEV-5059: Wrong result (missing row) wih semijoin, join_cache_level > 2, LEFT JOIN, ORDER BY
@@ -3152,7 +3156,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
2 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t3`.`c3` = `test`.`t1`.`c1`) and <cache>(<in_optimizer>(1,<exists>(select `test`.`t4`.`c4` from `test`.`t4` where (1 = `test`.`t4`.`c4`)))))) where 1
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t3`.`c3` = `test`.`t1`.`c1` and <cache>(<in_optimizer>(1,<exists>(select `test`.`t4`.`c4` from `test`.`t4` where 1 = `test`.`t4`.`c4`)))) where 1
# mdev-12820
SELECT *
FROM t1
@@ -3173,7 +3177,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join)
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2`,`test`.`t4`.`c4` AS `c4` from `test`.`t1` left join (`test`.`t2` join `test`.`t4`) on(((`test`.`t2`.`c2` = `test`.`t1`.`c1`) and <in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t3`.`c3` from `test`.`t3` where (<cache>(`test`.`t2`.`c2`) = `test`.`t3`.`c3`))))) where 1
+Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2`,`test`.`t4`.`c4` AS `c4` from `test`.`t1` left join (`test`.`t2` join `test`.`t4`) on(`test`.`t2`.`c2` = `test`.`t1`.`c1` and <in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t3`.`c3` from `test`.`t3` where <cache>(`test`.`t2`.`c2`) = `test`.`t3`.`c3`))) where 1
DROP TABLE t1,t2,t3,t4;
#
# MDEV-13699: Assertion `!new_field->field_name.str ||
diff --git a/mysql-test/r/subselect_sj_mat.result b/mysql-test/r/subselect_sj_mat.result
index 3147c3dc0d9..8109c36441e 100644
--- a/mysql-test/r/subselect_sj_mat.result
+++ b/mysql-test/r/subselect_sj_mat.result
@@ -50,7 +50,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b1` > '0'))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b1` > '0'
select * from t1 where a1 in (select b1 from t2 where b1 > '0');
a1 a2
1 - 01 2 - 01
@@ -62,7 +62,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b1` > '0'))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b1` > '0'
select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1);
a1 a2
1 - 01 2 - 01
@@ -74,7 +74,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 func,func 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b1` > '0'))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b1` > '0'
select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2);
a1 a2
1 - 01 2 - 01
@@ -86,7 +86,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1`,min(`test`.`t2`.`b2`) from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1`) join `test`.`t1` where ((`<subquery2>`.`b1` = `test`.`t1`.`a1`) and (`<subquery2>`.`min(b2)` = `test`.`t1`.`a2`))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1`,min(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`b1` > '0' group by `test`.`t2`.`b1`) join `test`.`t1` where `<subquery2>`.`b1` = `test`.`t1`.`a1` and `<subquery2>`.`min(b2)` = `test`.`t1`.`a2`
select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1);
a1 a2
1 - 01 2 - 01
@@ -97,7 +97,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2i index it2i1,it2i3 it2i1 # NULL 5 50.00 Using where; Using index; LooseScan
1 PRIMARY t1i ref _it1_idx _it1_idx # _ref_ 1 100.00
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where ((`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` > '0'))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where `test`.`t1i`.`a1` = `test`.`t2i`.`b1` and `test`.`t2i`.`b1` > '0'
select * from t1i where a1 in (select b1 from t2i where b1 > '0');
a1 a2
1 - 01 2 - 01
@@ -109,7 +109,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key # 8 # 1 100.00 #
2 MATERIALIZED t2i range it2i1,it2i3 # 9 # 5 100.00 #
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select max(`test`.`t2i`.`b1`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where (`<subquery2>`.`max(b1)` = `test`.`t1i`.`a1`)
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select max(`test`.`t2i`.`b1`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1`) join `test`.`t1i` where `<subquery2>`.`max(b1)` = `test`.`t1i`.`a1`
select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1);
a1 a2
1 - 01 2 - 01
@@ -120,7 +120,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2i index it2i1,it2i2,it2i3 it2i3 # NULL 5 50.00 Using where; Using index; LooseScan
1 PRIMARY t1i ref _it1_idx _it1_idx # _ref_ 1 100.00
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where ((`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b1` > '0'))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where `test`.`t1i`.`a1` = `test`.`t2i`.`b1` and `test`.`t1i`.`a2` = `test`.`t2i`.`b2` and `test`.`t2i`.`b1` > '0'
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
a1 a2
1 - 01 2 - 01
@@ -132,7 +132,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key # # # 1 100.00 #
2 MATERIALIZED t2i range it2i1,it2i3 # # # 3 100.00 #
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where ((`<subquery2>`.`b1` = `test`.`t1i`.`a1`) and (`<subquery2>`.`max(b2)` = `test`.`t1i`.`a2`))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1`) join `test`.`t1i` where `<subquery2>`.`b1` = `test`.`t1i`.`a1` and `<subquery2>`.`max(b2)` = `test`.`t1i`.`a2`
select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' group by b1);
a1 a2
1 - 01 2 - 01
@@ -144,7 +144,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key # # # 1 100.00 #
2 MATERIALIZED t2i range it2i1,it2i3 # # # 3 100.00 #
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where ((`<subquery2>`.`b1` = `test`.`t1i`.`a1`) and (`<subquery2>`.`min(b2)` = `test`.`t1i`.`a2`))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1`) join `test`.`t1i` where `<subquery2>`.`b1` = `test`.`t1i`.`a1` and `<subquery2>`.`min(b2)` = `test`.`t1i`.`a2`
select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
a1 a2
1 - 01 2 - 01
@@ -156,7 +156,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00
2 MATERIALIZED t2i range NULL it2i3 9 NULL 3 100.00 Using index for group-by
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` group by `test`.`t2i`.`b1`) join `test`.`t1` where ((`<subquery2>`.`b1` = `test`.`t1`.`a1`) and (`<subquery2>`.`max(b2)` = `test`.`t1`.`a2`))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` group by `test`.`t2i`.`b1`) join `test`.`t1` where `<subquery2>`.`b1` = `test`.`t1`.`a1` and `<subquery2>`.`max(b2)` = `test`.`t1`.`a2`
select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1);
a1 a2
1 - 01 2 - 01
@@ -188,7 +188,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00
2 MATERIALIZED t2i range it2i1,it2i3 it2i3 18 NULL 3 100.00 Using where; Using index for group-by
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1` where ((`<subquery2>`.`b1` = `test`.`t1`.`a1`) and (`<subquery2>`.`min(b2)` = `test`.`t1`.`a2`))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1`) join `test`.`t1` where `<subquery2>`.`b1` = `test`.`t1`.`a1` and `<subquery2>`.`min(b2)` = `test`.`t1`.`a2`
select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
a1 a2
1 - 01 2 - 01
@@ -236,7 +236,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2`) join `test`.`t1` where ((`<subquery2>`.`b1` = `test`.`t1`.`a1`) and (`<subquery2>`.`b2` = `test`.`t1`.`a2`))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2`) join `test`.`t1` where `<subquery2>`.`b1` = `test`.`t1`.`a1` and `<subquery2>`.`b2` = `test`.`t1`.`a2`
select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2);
a1 a2
1 - 01 2 - 01
@@ -248,7 +248,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1i.a1,test.t1i.a2 1 100.00
2 MATERIALIZED t2i index NULL it2i3 18 NULL 5 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2`) join `test`.`t1i` where ((`<subquery2>`.`b1` = `test`.`t1i`.`a1`) and (`<subquery2>`.`b2` = `test`.`t1i`.`a2`))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2`) join `test`.`t1i` where `<subquery2>`.`b1` = `test`.`t1i`.`a1` and `<subquery2>`.`b2` = `test`.`t1i`.`a2`
select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2);
a1 a2
1 - 01 2 - 01
@@ -305,7 +305,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (`test`.`t2`.`b1` > '0') and (`test`.`t3`.`c2` > '0'))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and `test`.`t2`.`b1` > '0' and `test`.`t3`.`c2` > '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
@@ -324,7 +324,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3i ref it3i1,it3i2,it3i3 # # # 1 100.00 #
1 PRIMARY t2i ref it2i1,it2i2,it2i3 # # # 2 100.00 #
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t3i`.`c1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` = `test`.`t2i`.`b1`) and (`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t3i`.`c2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t2i`.`b2` > '0'))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where `test`.`t1i`.`a1` = `test`.`t2i`.`b1` and `test`.`t3i`.`c1` = `test`.`t2i`.`b1` and `test`.`t2i`.`b1` = `test`.`t2i`.`b1` and `test`.`t1i`.`a2` = `test`.`t2i`.`b2` and `test`.`t3i`.`c2` = `test`.`t2i`.`b2` and `test`.`t2i`.`b2` = `test`.`t2i`.`b2` and `test`.`t2i`.`b1` > '0' and `test`.`t2i`.`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
@@ -349,7 +349,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (<expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`)))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) and (`test`.`t3`.`c2` > '0'))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and (<expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%02' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery3>`.`c2`)))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%03' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery4>`.`c2`))))) and `test`.`t3`.`c2` > '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
@@ -375,7 +375,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where ((`test`.`t2i`.`b1` = `test`.`t3c`.`c1`) and (`test`.`t2`.`b1` = `test`.`t1`.`a1`) and (`test`.`t2i`.`b2` = `test`.`t3c`.`c2`) and (`test`.`t2`.`b2` = `test`.`t1`.`a2`) and (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) and (`test`.`t3c`.`c2` > '0'))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where `test`.`t2i`.`b1` = `test`.`t3c`.`c1` and `test`.`t2`.`b1` = `test`.`t1`.`a1` and `test`.`t2i`.`b2` = `test`.`t3c`.`c2` and `test`.`t2`.`b2` = `test`.`t1`.`a2` and (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where `test`.`t3a`.`c1` = `test`.`t1`.`a1` and <cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where `test`.`t3b`.`c2` like '%03' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery4>`.`c2`))))) and `test`.`t3c`.`c2` > '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
@@ -413,7 +413,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
7 UNION t2i ref it2i1,it2i2,it2i3 # # # 2 100.00 #
NULL UNION RESULT <union1,7> ALL NULL # # # NULL NULL #
Warnings:
-Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (<expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`)))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) and (`test`.`t3`.`c2` > '0'))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t3i`.`c1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` = `test`.`t2i`.`b1`) and (`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t3i`.`c2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t2i`.`b2` > '0')))
+Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and (<expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%02' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery3>`.`c2`)))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%03' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery4>`.`c2`))))) and `test`.`t3`.`c2` > '0') union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where `test`.`t1i`.`a1` = `test`.`t2i`.`b1` and `test`.`t3i`.`c1` = `test`.`t2i`.`b1` and `test`.`t2i`.`b1` = `test`.`t2i`.`b1` and `test`.`t1i`.`a2` = `test`.`t2i`.`b2` and `test`.`t3i`.`c2` = `test`.`t2i`.`b2` and `test`.`t2i`.`b2` = `test`.`t2i`.`b2` and `test`.`t2i`.`b1` > '0' and `test`.`t2i`.`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
@@ -443,7 +443,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and (`test`.`t3`.`c2` > '0'))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) where `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where `test`.`t1`.`a1` > '0' and <cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1` and <cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2` union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` < '9' and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1` and <cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and `test`.`t3`.`c2` > '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
@@ -467,7 +467,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) join `test`.`t3` where ((`test`.`t3`.`c1` = `test`.`t1`.`a1`) and (`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and (`test`.`t3`.`c2` > '0'))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) join `test`.`t3` where `test`.`t3`.`c1` = `test`.`t1`.`a1` and `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where `test`.`t1`.`a1` > '0' and <cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1` and <cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2` union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` < '9' and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1` and <cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and `test`.`t3`.`c2` > '0'
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
@@ -489,7 +489,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`>(<in_optimizer>(`test`.`t3`.`c1`,<exists>(select `test`.`t1`.`a1` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t3`.`c1`) = `test`.`t1`.`a1`)) union select `test`.`t2`.`b1` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t3`.`c1`) = `test`.`t2`.`b1`)))))
+Note 1003 select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`>(<in_optimizer>(`test`.`t3`.`c1`,<exists>(select `test`.`t1`.`a1` from `test`.`t1` where `test`.`t1`.`a1` > '0' and <cache>(`test`.`t3`.`c1`) = `test`.`t1`.`a1` union select `test`.`t2`.`b1` from `test`.`t2` where `test`.`t2`.`b1` < '9' and <cache>(`test`.`t3`.`c1`) = `test`.`t2`.`b1`)))
select * from t3
where c1 in (select a1 from t1 where a1 > '0' UNION select b1 from t2 where b1 < '9');
c1 c2
@@ -513,14 +513,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a2' of SELECT #6 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where ((`test`.`t2i`.`b1` = `test`.`t1`.`a1`) and (`test`.`t3c`.`c1` = `test`.`t1`.`a1`) and (`test`.`t2`.`b1` = `test`.`t1`.`a1`) and (`test`.`t2i`.`b2` = `test`.`t1`.`a2`) and (`test`.`t3c`.`c2` = `test`.`t1`.`a2`) and (`test`.`t2`.`b2` = `test`.`t1`.`a2`) and (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where `test`.`t2i`.`b1` = `test`.`t1`.`a1` and `test`.`t3c`.`c1` = `test`.`t1`.`a1` and `test`.`t2`.`b1` = `test`.`t1`.`a1` and `test`.`t2i`.`b2` = `test`.`t1`.`a2` and `test`.`t3c`.`c2` = `test`.`t1`.`a2` and `test`.`t2`.`b2` = `test`.`t1`.`a2` and (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where `test`.`t3a`.`c1` = `test`.`t1`.`a1` and <cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where `test`.`t3b`.`c2` like '%03' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery4>`.`c2`)))))
explain extended
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having (((<cache>(`test`.`t1`.`a1`) = '1 - 01') or isnull('1 - 01')) and ((<cache>(`test`.`t1`.`a2`) = '2 - 01') or isnull('2 - 01')) and <is_not_null_test>('1 - 01') and <is_not_null_test>('2 - 01')))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having (<cache>(`test`.`t1`.`a1`) = '1 - 01' or '1 - 01' is null) and (<cache>(`test`.`t1`.`a2`) = '2 - 01' or '2 - 01' is null) and '1 - 01' is null and '2 - 01' is null)))
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01');
a1 a2
1 - 01 2 - 01
@@ -530,7 +530,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having (((<cache>(`test`.`t1`.`a1`) = '1 - 01') or isnull('1 - 01')) and ((<cache>(`test`.`t1`.`a2`) = '2 - 01') or isnull('2 - 01')) and <is_not_null_test>('1 - 01') and <is_not_null_test>('2 - 01')))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select '1 - 01','2 - 01' having (<cache>(`test`.`t1`.`a1`) = '1 - 01' or '1 - 01' is null) and (<cache>(`test`.`t1`.`a2`) = '2 - 01' or '2 - 01' is null) and '1 - 01' is null and '2 - 01' is null)))
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01' from dual);
a1 a2
1 - 01 2 - 01
@@ -562,7 +562,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using temporary; Using filesort
2 DEPENDENT SUBQUERY columns unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where; Full scan on NULL key
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by <expr_cache><`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t1`.`a1`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`a1`) in columns on PRIMARY where trigcond((<cache>(`test`.`t1`.`a1`) = `test`.`columns`.`col`))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by <expr_cache><`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t1`.`a1`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`a1`) in columns on PRIMARY where trigcond(<cache>(`test`.`t1`.`a1`) = `test`.`columns`.`col`)))))
select * from t1 group by (a1 in (select col from columns));
a1 a2
1 - 00 2 - 00
@@ -623,7 +623,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where ((`test`.`t2_16`.`b1` = `test`.`t1_16`.`a1`) and (`test`.`t1_16`.`a1` > '0'))
+Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where `test`.`t2_16`.`b1` = `test`.`t1_16`.`a1` and `test`.`t1_16`.`a1` > '0'
select left(a1,7), left(a2,7)
from t1_16
where a1 in (select b1 from t2_16 where b1 > '0');
@@ -637,7 +637,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where ((`test`.`t2_16`.`b1` = `test`.`t1_16`.`a1`) and (`test`.`t2_16`.`b2` = `test`.`t1_16`.`a2`) and (`test`.`t1_16`.`a1` > '0'))
+Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where `test`.`t2_16`.`b1` = `test`.`t1_16`.`a1` and `test`.`t2_16`.`b2` = `test`.`t1_16`.`a2` and `test`.`t1_16`.`a1` > '0'
select left(a1,7), left(a2,7)
from t1_16
where (a1,a2) in (select b1, b2 from t2_16 where b1 > '0');
@@ -652,7 +652,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 19 func 1 100.00 Using where
2 MATERIALIZED t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where ((`test`.`t2_16`.`b1` > '0') and (`test`.`t1_16`.`a1` = substr(`test`.`t2_16`.`b1`,1,16)))
+Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where `test`.`t2_16`.`b1` > '0' and `test`.`t1_16`.`a1` = substr(`test`.`t2_16`.`b1`,1,16)
select left(a1,7), left(a2,7)
from t1_16
where a1 in (select substring(b1,1,16) from t2_16 where b1 > '0');
@@ -666,7 +666,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using filesort
Warnings:
-Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`>(<in_optimizer>(`test`.`t1_16`.`a1`,<exists>(select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2` having (<cache>(`test`.`t1_16`.`a1`) = <ref_null_helper>(group_concat(`test`.`t2_16`.`b1` separator ','))))))
+Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`>(<in_optimizer>(`test`.`t1_16`.`a1`,<exists>(select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2` having <cache>(`test`.`t1_16`.`a1`) = <ref_null_helper>(group_concat(`test`.`t2_16`.`b1` separator ',')))))
select left(a1,7), left(a2,7)
from t1_16
where a1 in (select group_concat(b1) from t2_16 group by b2);
@@ -682,7 +682,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 260 test.t1_16.a1 1 100.00 Using where
2 MATERIALIZED t2_16 ALL NULL NULL NULL NULL 3 100.00 Using filesort
Warnings:
-Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2`) join `test`.`t1_16` where (`test`.`t1_16`.`a1` = `<subquery2>`.`group_concat(b1)`)
+Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2`) join `test`.`t1_16` where `test`.`t1_16`.`a1` = `<subquery2>`.`group_concat(b1)`
select left(a1,7), left(a2,7)
from t1_16
where a1 in (select group_concat(b1) from t2_16 group by b2);
@@ -704,7 +704,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t2_16` join `test`.`t2` join `test`.`t1_16`) where ((`test`.`t2`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2_16`.`b1` = `test`.`t1_16`.`a1`) and (`test`.`t2_16`.`b2` = `test`.`t1_16`.`a2`) and (`test`.`t2`.`b2` = substr(`test`.`t1_16`.`a2`,1,6)) and (`test`.`t3`.`c2` > '0') and (concat(`test`.`t1`.`a1`,'x') = left(`test`.`t1_16`.`a1`,8)))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t2_16` join `test`.`t2` join `test`.`t1_16`) where `test`.`t2`.`b1` = `test`.`t3`.`c1` and `test`.`t2_16`.`b1` = `test`.`t1_16`.`a1` and `test`.`t2_16`.`b2` = `test`.`t1_16`.`a2` and `test`.`t2`.`b2` = substr(`test`.`t1_16`.`a2`,1,6) and `test`.`t3`.`c2` > '0' and concat(`test`.`t1`.`a1`,'x') = left(`test`.`t1_16`.`a1`,8)
drop table t1_16, t2_16, t3_16;
set @blob_len = 512;
set @suffix_len = @blob_len - @prefix_len;
@@ -738,7 +738,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where ((`test`.`t2_512`.`b1` = `test`.`t1_512`.`a1`) and (`test`.`t1_512`.`a1` > '0'))
+Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where `test`.`t2_512`.`b1` = `test`.`t1_512`.`a1` and `test`.`t1_512`.`a1` > '0'
select left(a1,7), left(a2,7)
from t1_512
where a1 in (select b1 from t2_512 where b1 > '0');
@@ -752,7 +752,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where ((`test`.`t2_512`.`b1` = `test`.`t1_512`.`a1`) and (`test`.`t2_512`.`b2` = `test`.`t1_512`.`a2`) and (`test`.`t1_512`.`a1` > '0'))
+Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where `test`.`t2_512`.`b1` = `test`.`t1_512`.`a1` and `test`.`t2_512`.`b2` = `test`.`t1_512`.`a2` and `test`.`t1_512`.`a1` > '0'
select left(a1,7), left(a2,7)
from t1_512
where (a1,a2) in (select b1, b2 from t2_512 where b1 > '0');
@@ -767,7 +767,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 516 func 1 100.00 Using where
2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where ((`test`.`t2_512`.`b1` > '0') and (`test`.`t1_512`.`a1` = substr(`test`.`t2_512`.`b1`,1,512)))
+Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where `test`.`t2_512`.`b1` > '0' and `test`.`t1_512`.`a1` = substr(`test`.`t2_512`.`b1`,1,512)
select left(a1,7), left(a2,7)
from t1_512
where a1 in (select substring(b1,1,512) from t2_512 where b1 > '0');
@@ -782,7 +782,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 260 test.t1_512.a1 1 100.00 Using where
2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort
Warnings:
-Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2`) join `test`.`t1_512` where (`test`.`t1_512`.`a1` = `<subquery2>`.`group_concat(b1)`)
+Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2`) join `test`.`t1_512` where `test`.`t1_512`.`a1` = `<subquery2>`.`group_concat(b1)`
select left(a1,7), left(a2,7)
from t1_512
where a1 in (select group_concat(b1) from t2_512 group by b2);
@@ -800,7 +800,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 260 test.t1_512.a1 1 100.00 Using where
2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort
Warnings:
-Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2`) join `test`.`t1_512` where (`test`.`t1_512`.`a1` = `<subquery2>`.`group_concat(b1)`)
+Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2`) join `test`.`t1_512` where `test`.`t1_512`.`a1` = `<subquery2>`.`group_concat(b1)`
select left(a1,7), left(a2,7)
from t1_512
where a1 in (select group_concat(b1) from t2_512 group by b2);
@@ -842,7 +842,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where ((`test`.`t2_1024`.`b1` = `test`.`t1_1024`.`a1`) and (`test`.`t1_1024`.`a1` > '0'))
+Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where `test`.`t2_1024`.`b1` = `test`.`t1_1024`.`a1` and `test`.`t1_1024`.`a1` > '0'
select left(a1,7), left(a2,7)
from t1_1024
where a1 in (select b1 from t2_1024 where b1 > '0');
@@ -856,7 +856,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where ((`test`.`t2_1024`.`b1` = `test`.`t1_1024`.`a1`) and (`test`.`t2_1024`.`b2` = `test`.`t1_1024`.`a2`) and (`test`.`t1_1024`.`a1` > '0'))
+Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where `test`.`t2_1024`.`b1` = `test`.`t1_1024`.`a1` and `test`.`t2_1024`.`b2` = `test`.`t1_1024`.`a2` and `test`.`t1_1024`.`a1` > '0'
select left(a1,7), left(a2,7)
from t1_1024
where (a1,a2) in (select b1, b2 from t2_1024 where b1 > '0');
@@ -870,7 +870,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where ((`test`.`t2_1024`.`b1` > '0') and (`test`.`t1_1024`.`a1` = substr(`test`.`t2_1024`.`b1`,1,1024)))
+Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where `test`.`t2_1024`.`b1` > '0' and `test`.`t1_1024`.`a1` = substr(`test`.`t2_1024`.`b1`,1,1024)
select left(a1,7), left(a2,7)
from t1_1024
where a1 in (select substring(b1,1,1024) from t2_1024 where b1 > '0');
@@ -885,7 +885,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 260 test.t1_1024.a1 1 100.00 Using where
2 MATERIALIZED t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort
Warnings:
-Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2`) join `test`.`t1_1024` where (`test`.`t1_1024`.`a1` = `<subquery2>`.`group_concat(b1)`)
+Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2`) join `test`.`t1_1024` where `test`.`t1_1024`.`a1` = `<subquery2>`.`group_concat(b1)`
select left(a1,7), left(a2,7)
from t1_1024
where a1 in (select group_concat(b1) from t2_1024 group by b2);
@@ -903,7 +903,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 260 test.t1_1024.a1 1 100.00 Using where
2 MATERIALIZED t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort
Warnings:
-Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2`) join `test`.`t1_1024` where (`test`.`t1_1024`.`a1` = `<subquery2>`.`group_concat(b1)`)
+Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2`) join `test`.`t1_1024` where `test`.`t1_1024`.`a1` = `<subquery2>`.`group_concat(b1)`
select left(a1,7), left(a2,7)
from t1_1024
where a1 in (select group_concat(b1) from t2_1024 group by b2);
@@ -945,7 +945,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where ((`test`.`t2_1025`.`b1` = `test`.`t1_1025`.`a1`) and (`test`.`t1_1025`.`a1` > '0'))
+Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where `test`.`t2_1025`.`b1` = `test`.`t1_1025`.`a1` and `test`.`t1_1025`.`a1` > '0'
select left(a1,7), left(a2,7)
from t1_1025
where a1 in (select b1 from t2_1025 where b1 > '0');
@@ -959,7 +959,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where ((`test`.`t2_1025`.`b1` = `test`.`t1_1025`.`a1`) and (`test`.`t2_1025`.`b2` = `test`.`t1_1025`.`a2`) and (`test`.`t1_1025`.`a1` > '0'))
+Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where `test`.`t2_1025`.`b1` = `test`.`t1_1025`.`a1` and `test`.`t2_1025`.`b2` = `test`.`t1_1025`.`a2` and `test`.`t1_1025`.`a1` > '0'
select left(a1,7), left(a2,7)
from t1_1025
where (a1,a2) in (select b1, b2 from t2_1025 where b1 > '0');
@@ -973,7 +973,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where ((`test`.`t2_1025`.`b1` > '0') and (`test`.`t1_1025`.`a1` = substr(`test`.`t2_1025`.`b1`,1,1025)))
+Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where `test`.`t2_1025`.`b1` > '0' and `test`.`t1_1025`.`a1` = substr(`test`.`t2_1025`.`b1`,1,1025)
select left(a1,7), left(a2,7)
from t1_1025
where a1 in (select substring(b1,1,1025) from t2_1025 where b1 > '0');
@@ -988,7 +988,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 260 test.t1_1025.a1 1 100.00 Using where
2 MATERIALIZED t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort
Warnings:
-Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2`) join `test`.`t1_1025` where (`test`.`t1_1025`.`a1` = `<subquery2>`.`group_concat(b1)`)
+Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2`) join `test`.`t1_1025` where `test`.`t1_1025`.`a1` = `<subquery2>`.`group_concat(b1)`
select left(a1,7), left(a2,7)
from t1_1025
where a1 in (select group_concat(b1) from t2_1025 group by b2);
@@ -1006,7 +1006,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 260 test.t1_1025.a1 1 100.00 Using where
2 MATERIALIZED t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort
Warnings:
-Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2`) join `test`.`t1_1025` where (`test`.`t1_1025`.`a1` = `<subquery2>`.`group_concat(b1)`)
+Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from <materialize> (select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2`) join `test`.`t1_1025` where `test`.`t1_1025`.`a1` = `<subquery2>`.`group_concat(b1)`
select left(a1,7), left(a2,7)
from t1_1025
where a1 in (select group_concat(b1) from t2_1025 group by b2);
@@ -1055,7 +1055,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1bb ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY t2bb ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select conv(`test`.`t1bb`.`a1`,10,2) AS `bin(a1)`,`test`.`t1bb`.`a2` AS `a2` from `test`.`t1bb` semi join (`test`.`t2bb`) where ((`test`.`t2bb`.`b1` = `test`.`t1bb`.`a1`) and (`test`.`t2bb`.`b2` = `test`.`t1bb`.`a2`))
+Note 1003 select conv(`test`.`t1bb`.`a1`,10,2) AS `bin(a1)`,`test`.`t1bb`.`a2` AS `a2` from `test`.`t1bb` semi join (`test`.`t2bb`) where `test`.`t2bb`.`b1` = `test`.`t1bb`.`a1` and `test`.`t2bb`.`b2` = `test`.`t1bb`.`a2`
select bin(a1), a2
from t1bb
where (a1, a2) in (select b1, b2 from t2bb);
@@ -1104,7 +1104,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00 Using where; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t1`.`a` = `test`.`t2`.`c`) and (`test`.`t2`.`d` >= 20))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t1`.`a` = `test`.`t2`.`c` and `test`.`t2`.`d` >= 20
select a from t1 where a in (select c from t2 where d >= 20);
a
2
@@ -1119,7 +1119,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`d` >= 20))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`d` >= 20
select a from t1 where a in (select c from t2 where d >= 20);
a
2
@@ -1134,7 +1134,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`d` >= 20))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`d` >= 20
select a from t1 where a in (select c from t2 where d >= 20);
a
2
@@ -1147,7 +1147,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using index
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`c`))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`c`))))
select a from t1 group by a having a in (select c from t2 where d >= 20);
a
2
@@ -1159,7 +1159,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using index
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where (`test`.`t2`.`d` >= 20) ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`c`))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`c`))))
select a from t1 group by a having a in (select c from t2 where d >= 20);
a
2
@@ -1174,7 +1174,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
Note 1981 Aggregate function 'max()' of SELECT #3 belongs to SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`c` from `test`.`t2` where (<nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where (max(`test`.`t1`.`b`) = `test`.`t3`.`e`) having (<cache>(`test`.`t2`.`d`) >= <ref_null_helper>(`test`.`t3`.`e`)))))) and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`c`)))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`c` from `test`.`t2` where <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where max(`test`.`t1`.`b`) = `test`.`t3`.`e` having <cache>(`test`.`t2`.`d`) >= <ref_null_helper>(`test`.`t3`.`e`))))) and <cache>(`test`.`t1`.`a`) = `test`.`t2`.`c`)))
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));
a
@@ -1189,7 +1189,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t1`.`a` = `test`.`t2`.`c`) and <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where ((`test`.`t1`.`b` = `test`.`t3`.`e`) and (<cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`)))))))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t1`.`a` = `test`.`t2`.`c` and <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and <cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`))))
select a from t1
where a in (select c from t2 where d >= some(select e from t3 where b=e));
a
@@ -1702,7 +1702,7 @@ DROP TABLE t1,t2,t3,t4,t5;
# BUG#836532: Crash in Item_equal_fields_iterator::get_curr_field with semijoin+materialization
#
CREATE TABLE t2 (a int);
-INSERT INTO t2 VALUES ('a'),('a');
+INSERT IGNORE INTO t2 VALUES ('a'),('a');
Warnings:
Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1
Warning 1366 Incorrect integer value: 'a' for column 'a' at row 2
@@ -1963,7 +1963,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where ((`test`.`t1`.`b` = 7) and (`test`.`t1`.`a` = `<subquery2>`.`MAX(c)`) and (<cache>(isnull(`<subquery2>`.`MAX(c)`)) or (`<subquery2>`.`MAX(c)` = 7)))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where `test`.`t1`.`b` = 7 and `test`.`t1`.`a` = `<subquery2>`.`MAX(c)` and (<cache>(`<subquery2>`.`MAX(c)` is null) or `<subquery2>`.`MAX(c)` = 7)
SELECT * FROM t1
WHERE a IN (SELECT MAX(c) FROM t2) AND b=7 AND (a IS NULL OR a=b);
a b
@@ -2208,7 +2208,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 eq_ref db db 764 information_schema.schemata.SCHEMA_NAME 1 100.00 Using where; Using index
2 MATERIALIZED schemata ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select `test`.`t1`.`db` AS `db` from `test`.`t1` semi join (`information_schema`.`schemata`) where (`test`.`t1`.`db` = `information_schema`.`schemata`.`SCHEMA_NAME`) order by `test`.`t1`.`db` desc
+Note 1003 select `test`.`t1`.`db` AS `db` from `test`.`t1` semi join (`information_schema`.`schemata`) where `test`.`t1`.`db` = `information_schema`.`schemata`.`SCHEMA_NAME` order by `test`.`t1`.`db` desc
drop table t1;
drop database mysqltest1;
drop database mysqltest2;
@@ -2291,7 +2291,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 8 100.00
Warnings:
Note 1276 Field or reference 'test.t1.f1' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`f1` AS `f1` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`>(exists(select 1 from `test`.`t2` semi join (`test`.`t3`) join `test`.`t3` where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`f1` = `test`.`t3`.`f3`))))
+Note 1003 select `test`.`t1`.`f1` AS `f1` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`>(exists(select 1 from `test`.`t2` semi join (`test`.`t3`) join `test`.`t3` where `test`.`t3`.`i3` = `test`.`t2`.`i2` and `test`.`t1`.`f1` = `test`.`t3`.`f3`))
# this checks the result set above
set optimizer_switch= 'materialization=off,semijoin=off';
SELECT * FROM t1
@@ -2329,7 +2329,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00
Warnings:
Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`f1` AS `f1`,<expr_cache><`test`.`t1`.`pk`>((select count(0) from `test`.`t2` semi join (`test`.`t2`) where (`test`.`t1`.`pk` = `test`.`t2`.`f2`))) AS `sq` from `test`.`t1`
+Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`f1` AS `f1`,<expr_cache><`test`.`t1`.`pk`>((select count(0) from `test`.`t2` semi join (`test`.`t2`) where `test`.`t1`.`pk` = `test`.`t2`.`f2`)) AS `sq` from `test`.`t1`
# this checks the result set above
set @save_optimizer_switch= @@optimizer_switch;
set optimizer_switch= 'materialization=off,semijoin=off';
diff --git a/mysql-test/r/symlink-aria-11902.result b/mysql-test/r/symlink-aria-11902.result
index e563780b3ec..4d8f179dac9 100644
--- a/mysql-test/r/symlink-aria-11902.result
+++ b/mysql-test/r/symlink-aria-11902.result
@@ -12,8 +12,10 @@ a b
flush tables;
set debug_sync='mi_open_datafile SIGNAL ok WAIT_FOR go';
select * from t1;
+connect con1, localhost, root;
set debug_sync='now WAIT_FOR ok';
set debug_sync='now SIGNAL go';
+connection default;
ERROR HY000: File 'MYSQLTEST_VARDIR/tmp/foo/t1.MAD' not found (Errcode: 20 <errmsg>)
flush tables;
drop table if exists t1;
@@ -30,8 +32,10 @@ a
flush tables;
set debug_sync='mi_open_kfile SIGNAL waiting WAIT_FOR run';
select a from t1;
+connection con1;
set debug_sync='now WAIT_FOR waiting';
set debug_sync='now SIGNAL run';
+connection default;
ERROR HY000: Can't find file: './test/t1.MAI' (errno: 20 <errmsg>)
flush tables;
drop table if exists t1;
diff --git a/mysql-test/r/symlink-myisam-11902.result b/mysql-test/r/symlink-myisam-11902.result
index 33357a80700..bc9a0316bab 100644
--- a/mysql-test/r/symlink-myisam-11902.result
+++ b/mysql-test/r/symlink-myisam-11902.result
@@ -11,8 +11,10 @@ a b
flush tables;
set debug_sync='mi_open_datafile SIGNAL ok WAIT_FOR go';
select * from t1;
+connect con1, localhost, root;
set debug_sync='now WAIT_FOR ok';
set debug_sync='now SIGNAL go';
+connection default;
ERROR HY000: File 'MYSQLTEST_VARDIR/tmp/foo/t1.MYD' not found (Errcode: 20 <errmsg>)
flush tables;
drop table if exists t1;
@@ -29,8 +31,10 @@ a
flush tables;
set debug_sync='mi_open_kfile SIGNAL waiting WAIT_FOR run';
select a from t1;
+connection con1;
set debug_sync='now WAIT_FOR waiting';
set debug_sync='now SIGNAL run';
+connection default;
ERROR HY000: Can't find file: './test/t1.MYI' (errno: 20 <errmsg>)
flush tables;
drop table if exists t1;
diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result
index 63fc37300b2..e8063ee736c 100644
--- a/mysql-test/r/symlink.result
+++ b/mysql-test/r/symlink.result
@@ -122,25 +122,35 @@ INDEX DIRECTORY='TEST_DIR/tmp';
RENAME TABLE t2 TO t1;
ERROR HY000: Can't create/write to file 'TEST_DIR/tmp/t1.MYI' (Errcode: 17 "File exists")
DROP TABLE t2;
+connect session1,localhost,root,,;
+connect session2,localhost,root,,;
+connection session1;
create temporary table t1 (a int) engine=myisam data directory="MYSQLTEST_VARDIR/log" select 9 a;
show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/log/'
+connection session2;
create temporary table t1 (a int) engine=myisam data directory="MYSQLTEST_VARDIR/log" select 99 a;
show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/log/'
+connection default;
create table t1 (a int) engine=myisam select 42 a;
+connection session1;
select * from t1;
a
9
+disconnect session1;
+connection session2;
select * from t1;
a
99
+disconnect session2;
+connection default;
select * from t1;
a
42
diff --git a/mysql-test/r/synchronization.result b/mysql-test/r/synchronization.result
index 3f6d16178dd..ee8195820b0 100644
--- a/mysql-test/r/synchronization.result
+++ b/mysql-test/r/synchronization.result
@@ -1,6 +1,10 @@
DROP TABLE IF EXISTS t1,t2;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
CREATE TABLE t1 (x1 INT);
+connection con1;
ALTER TABLE t1 CHANGE x1 x2 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -8,7 +12,9 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
ALTER TABLE t1 CHANGE x2 x1 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -16,7 +22,10 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
+connection con1;
ALTER TABLE t1 CHANGE x1 x2 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -24,7 +33,9 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
ALTER TABLE t1 CHANGE x2 x1 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -32,7 +43,10 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
+connection con1;
ALTER TABLE t1 CHANGE x1 x2 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -40,7 +54,9 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
ALTER TABLE t1 CHANGE x2 x1 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -48,7 +64,10 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
+connection con1;
ALTER TABLE t1 CHANGE x1 x2 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -56,7 +75,9 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
ALTER TABLE t1 CHANGE x2 x1 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -64,7 +85,10 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
+connection con1;
ALTER TABLE t1 CHANGE x1 x2 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -72,7 +96,9 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
ALTER TABLE t1 CHANGE x2 x1 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -80,7 +106,10 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
+connection con1;
ALTER TABLE t1 CHANGE x1 x2 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -88,7 +117,9 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
ALTER TABLE t1 CHANGE x2 x1 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -96,7 +127,10 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
+connection con1;
ALTER TABLE t1 CHANGE x1 x2 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -104,7 +138,9 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
ALTER TABLE t1 CHANGE x2 x1 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -112,7 +148,10 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
+connection con1;
ALTER TABLE t1 CHANGE x1 x2 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -120,7 +159,9 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
ALTER TABLE t1 CHANGE x2 x1 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -128,7 +169,10 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
+connection con1;
ALTER TABLE t1 CHANGE x1 x2 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -136,7 +180,9 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
ALTER TABLE t1 CHANGE x2 x1 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -144,7 +190,10 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
+connection con1;
ALTER TABLE t1 CHANGE x1 x2 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -152,7 +201,9 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
ALTER TABLE t1 CHANGE x2 x1 INT;
+connection con2;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -160,4 +211,8 @@ t2 CREATE TABLE `t2` (
`xx` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+connection con1;
DROP TABLE t1;
+connection default;
+disconnect con1;
+disconnect con2;
diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result
index bc4de8b4171..b88497dbd9b 100644
--- a/mysql-test/r/system_mysql_db.result
+++ b/mysql-test/r/system_mysql_db.result
@@ -122,23 +122,23 @@ user CREATE TABLE `user` (
`ssl_cipher` blob NOT NULL,
`x509_issuer` blob NOT NULL,
`x509_subject` blob NOT NULL,
- `max_questions` int(11) unsigned NOT NULL DEFAULT '0',
- `max_updates` int(11) unsigned NOT NULL DEFAULT '0',
- `max_connections` int(11) unsigned NOT NULL DEFAULT '0',
- `max_user_connections` int(11) NOT NULL DEFAULT '0',
+ `max_questions` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_updates` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_connections` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_user_connections` int(11) NOT NULL DEFAULT 0,
`plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '',
`authentication_string` text COLLATE utf8_bin NOT NULL,
`password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
- `max_statement_time` decimal(12,6) NOT NULL DEFAULT '0.000000',
+ `max_statement_time` decimal(12,6) NOT NULL DEFAULT 0.000000,
PRIMARY KEY (`Host`,`User`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
show create table func;
Table Create Table
func CREATE TABLE `func` (
`name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
- `ret` tinyint(1) NOT NULL DEFAULT '0',
+ `ret` tinyint(1) NOT NULL DEFAULT 0,
`dl` char(128) COLLATE utf8_bin NOT NULL DEFAULT '',
`type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`name`)
@@ -151,7 +151,7 @@ tables_priv CREATE TABLE `tables_priv` (
`User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
`Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '',
- `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '',
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
@@ -165,7 +165,7 @@ columns_priv CREATE TABLE `columns_priv` (
`User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
`Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
- `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges'
@@ -179,7 +179,7 @@ procs_priv CREATE TABLE `procs_priv` (
`Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL,
`Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '',
`Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '',
- `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`),
KEY `Grantor` (`Grantor`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges'
@@ -191,7 +191,7 @@ servers CREATE TABLE `servers` (
`Db` char(64) NOT NULL DEFAULT '',
`Username` char(80) NOT NULL DEFAULT '',
`Password` char(64) NOT NULL DEFAULT '',
- `Port` int(4) NOT NULL DEFAULT '0',
+ `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 '',
@@ -212,14 +212,14 @@ proc CREATE TABLE `proc` (
`returns` longblob NOT NULL,
`body` longblob NOT NULL,
`definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
- `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `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','IGNORE_BAD_TABLE_OPTIONS','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') NOT NULL DEFAULT '',
`comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
- `body_utf8` longblob,
+ `body_utf8` longblob DEFAULT NULL,
PRIMARY KEY (`db`,`name`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures'
show create table event;
@@ -232,7 +232,7 @@ event CREATE TABLE `event` (
`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,
+ `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,
@@ -246,13 +246,13 @@ event CREATE TABLE `event` (
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
- `body_utf8` longblob,
+ `body_utf8` longblob DEFAULT NULL,
PRIMARY KEY (`db`,`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'
show create table general_log;
Table Create Table
general_log CREATE TABLE `general_log` (
- `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`thread_id` bigint(21) unsigned NOT NULL,
`server_id` int(10) unsigned NOT NULL,
@@ -262,7 +262,7 @@ general_log CREATE TABLE `general_log` (
show create table slow_log;
Table Create Table
slow_log CREATE TABLE `slow_log` (
- `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`query_time` time(6) NOT NULL,
`lock_time` time(6) NOT NULL,
diff --git a/mysql-test/r/system_mysql_db_fix40123.result b/mysql-test/r/system_mysql_db_fix40123.result
index bc4de8b4171..b88497dbd9b 100644
--- a/mysql-test/r/system_mysql_db_fix40123.result
+++ b/mysql-test/r/system_mysql_db_fix40123.result
@@ -122,23 +122,23 @@ user CREATE TABLE `user` (
`ssl_cipher` blob NOT NULL,
`x509_issuer` blob NOT NULL,
`x509_subject` blob NOT NULL,
- `max_questions` int(11) unsigned NOT NULL DEFAULT '0',
- `max_updates` int(11) unsigned NOT NULL DEFAULT '0',
- `max_connections` int(11) unsigned NOT NULL DEFAULT '0',
- `max_user_connections` int(11) NOT NULL DEFAULT '0',
+ `max_questions` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_updates` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_connections` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_user_connections` int(11) NOT NULL DEFAULT 0,
`plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '',
`authentication_string` text COLLATE utf8_bin NOT NULL,
`password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
- `max_statement_time` decimal(12,6) NOT NULL DEFAULT '0.000000',
+ `max_statement_time` decimal(12,6) NOT NULL DEFAULT 0.000000,
PRIMARY KEY (`Host`,`User`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
show create table func;
Table Create Table
func CREATE TABLE `func` (
`name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
- `ret` tinyint(1) NOT NULL DEFAULT '0',
+ `ret` tinyint(1) NOT NULL DEFAULT 0,
`dl` char(128) COLLATE utf8_bin NOT NULL DEFAULT '',
`type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`name`)
@@ -151,7 +151,7 @@ tables_priv CREATE TABLE `tables_priv` (
`User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
`Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '',
- `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '',
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
@@ -165,7 +165,7 @@ columns_priv CREATE TABLE `columns_priv` (
`User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
`Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
- `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges'
@@ -179,7 +179,7 @@ procs_priv CREATE TABLE `procs_priv` (
`Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL,
`Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '',
`Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '',
- `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`),
KEY `Grantor` (`Grantor`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges'
@@ -191,7 +191,7 @@ servers CREATE TABLE `servers` (
`Db` char(64) NOT NULL DEFAULT '',
`Username` char(80) NOT NULL DEFAULT '',
`Password` char(64) NOT NULL DEFAULT '',
- `Port` int(4) NOT NULL DEFAULT '0',
+ `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 '',
@@ -212,14 +212,14 @@ proc CREATE TABLE `proc` (
`returns` longblob NOT NULL,
`body` longblob NOT NULL,
`definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
- `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `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','IGNORE_BAD_TABLE_OPTIONS','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') NOT NULL DEFAULT '',
`comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
- `body_utf8` longblob,
+ `body_utf8` longblob DEFAULT NULL,
PRIMARY KEY (`db`,`name`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures'
show create table event;
@@ -232,7 +232,7 @@ event CREATE TABLE `event` (
`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,
+ `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,
@@ -246,13 +246,13 @@ event CREATE TABLE `event` (
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
- `body_utf8` longblob,
+ `body_utf8` longblob DEFAULT NULL,
PRIMARY KEY (`db`,`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'
show create table general_log;
Table Create Table
general_log CREATE TABLE `general_log` (
- `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`thread_id` bigint(21) unsigned NOT NULL,
`server_id` int(10) unsigned NOT NULL,
@@ -262,7 +262,7 @@ general_log CREATE TABLE `general_log` (
show create table slow_log;
Table Create Table
slow_log CREATE TABLE `slow_log` (
- `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`query_time` time(6) NOT NULL,
`lock_time` time(6) NOT NULL,
diff --git a/mysql-test/r/system_mysql_db_fix50030.result b/mysql-test/r/system_mysql_db_fix50030.result
index bc4de8b4171..14905ab81a0 100644
--- a/mysql-test/r/system_mysql_db_fix50030.result
+++ b/mysql-test/r/system_mysql_db_fix50030.result
@@ -122,23 +122,23 @@ user CREATE TABLE `user` (
`ssl_cipher` blob NOT NULL,
`x509_issuer` blob NOT NULL,
`x509_subject` blob NOT NULL,
- `max_questions` int(11) unsigned NOT NULL DEFAULT '0',
- `max_updates` int(11) unsigned NOT NULL DEFAULT '0',
- `max_connections` int(11) unsigned NOT NULL DEFAULT '0',
- `max_user_connections` int(11) NOT NULL DEFAULT '0',
+ `max_questions` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_updates` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_connections` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_user_connections` int(11) NOT NULL DEFAULT 0,
`plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '',
`authentication_string` text COLLATE utf8_bin NOT NULL,
`password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
- `max_statement_time` decimal(12,6) NOT NULL DEFAULT '0.000000',
+ `max_statement_time` decimal(12,6) NOT NULL DEFAULT 0.000000,
PRIMARY KEY (`Host`,`User`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
show create table func;
Table Create Table
func CREATE TABLE `func` (
`name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
- `ret` tinyint(1) NOT NULL DEFAULT '0',
+ `ret` tinyint(1) NOT NULL DEFAULT 0,
`dl` char(128) COLLATE utf8_bin NOT NULL DEFAULT '',
`type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`name`)
@@ -151,7 +151,7 @@ tables_priv CREATE TABLE `tables_priv` (
`User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
`Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '',
- `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '',
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
@@ -165,7 +165,7 @@ columns_priv CREATE TABLE `columns_priv` (
`User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
`Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
- `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges'
@@ -179,7 +179,7 @@ procs_priv CREATE TABLE `procs_priv` (
`Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL,
`Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '',
`Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '',
- `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`),
KEY `Grantor` (`Grantor`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges'
@@ -191,7 +191,7 @@ servers CREATE TABLE `servers` (
`Db` char(64) NOT NULL DEFAULT '',
`Username` char(80) NOT NULL DEFAULT '',
`Password` char(64) NOT NULL DEFAULT '',
- `Port` int(4) NOT NULL DEFAULT '0',
+ `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 '',
@@ -208,18 +208,18 @@ proc CREATE TABLE `proc` (
`sql_data_access` enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') NOT NULL DEFAULT 'CONTAINS_SQL',
`is_deterministic` enum('YES','NO') NOT NULL DEFAULT 'NO',
`security_type` enum('INVOKER','DEFINER') NOT NULL DEFAULT 'DEFINER',
- `param_list` blob NOT NULL,
+ `param_list` blob NOT NULL DEFAULT '',
`returns` longblob NOT NULL,
`body` longblob NOT NULL,
`definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
- `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `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','IGNORE_BAD_TABLE_OPTIONS','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') NOT NULL DEFAULT '',
`comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
- `body_utf8` longblob,
+ `body_utf8` longblob DEFAULT NULL,
PRIMARY KEY (`db`,`name`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures'
show create table event;
@@ -232,7 +232,7 @@ event CREATE TABLE `event` (
`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,
+ `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,
@@ -246,13 +246,13 @@ event CREATE TABLE `event` (
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
- `body_utf8` longblob,
+ `body_utf8` longblob DEFAULT NULL,
PRIMARY KEY (`db`,`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'
show create table general_log;
Table Create Table
general_log CREATE TABLE `general_log` (
- `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`thread_id` bigint(21) unsigned NOT NULL,
`server_id` int(10) unsigned NOT NULL,
@@ -262,7 +262,7 @@ general_log CREATE TABLE `general_log` (
show create table slow_log;
Table Create Table
slow_log CREATE TABLE `slow_log` (
- `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`query_time` time(6) NOT NULL,
`lock_time` time(6) NOT NULL,
diff --git a/mysql-test/r/system_mysql_db_fix50117.result b/mysql-test/r/system_mysql_db_fix50117.result
index bc4de8b4171..b88497dbd9b 100644
--- a/mysql-test/r/system_mysql_db_fix50117.result
+++ b/mysql-test/r/system_mysql_db_fix50117.result
@@ -122,23 +122,23 @@ user CREATE TABLE `user` (
`ssl_cipher` blob NOT NULL,
`x509_issuer` blob NOT NULL,
`x509_subject` blob NOT NULL,
- `max_questions` int(11) unsigned NOT NULL DEFAULT '0',
- `max_updates` int(11) unsigned NOT NULL DEFAULT '0',
- `max_connections` int(11) unsigned NOT NULL DEFAULT '0',
- `max_user_connections` int(11) NOT NULL DEFAULT '0',
+ `max_questions` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_updates` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_connections` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_user_connections` int(11) NOT NULL DEFAULT 0,
`plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '',
`authentication_string` text COLLATE utf8_bin NOT NULL,
`password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
- `max_statement_time` decimal(12,6) NOT NULL DEFAULT '0.000000',
+ `max_statement_time` decimal(12,6) NOT NULL DEFAULT 0.000000,
PRIMARY KEY (`Host`,`User`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
show create table func;
Table Create Table
func CREATE TABLE `func` (
`name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
- `ret` tinyint(1) NOT NULL DEFAULT '0',
+ `ret` tinyint(1) NOT NULL DEFAULT 0,
`dl` char(128) COLLATE utf8_bin NOT NULL DEFAULT '',
`type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`name`)
@@ -151,7 +151,7 @@ tables_priv CREATE TABLE `tables_priv` (
`User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
`Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '',
- `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '',
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
@@ -165,7 +165,7 @@ columns_priv CREATE TABLE `columns_priv` (
`User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
`Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
- `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges'
@@ -179,7 +179,7 @@ procs_priv CREATE TABLE `procs_priv` (
`Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL,
`Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '',
`Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '',
- `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`),
KEY `Grantor` (`Grantor`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges'
@@ -191,7 +191,7 @@ servers CREATE TABLE `servers` (
`Db` char(64) NOT NULL DEFAULT '',
`Username` char(80) NOT NULL DEFAULT '',
`Password` char(64) NOT NULL DEFAULT '',
- `Port` int(4) NOT NULL DEFAULT '0',
+ `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 '',
@@ -212,14 +212,14 @@ proc CREATE TABLE `proc` (
`returns` longblob NOT NULL,
`body` longblob NOT NULL,
`definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
- `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `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','IGNORE_BAD_TABLE_OPTIONS','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') NOT NULL DEFAULT '',
`comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
- `body_utf8` longblob,
+ `body_utf8` longblob DEFAULT NULL,
PRIMARY KEY (`db`,`name`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures'
show create table event;
@@ -232,7 +232,7 @@ event CREATE TABLE `event` (
`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,
+ `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,
@@ -246,13 +246,13 @@ event CREATE TABLE `event` (
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
- `body_utf8` longblob,
+ `body_utf8` longblob DEFAULT NULL,
PRIMARY KEY (`db`,`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'
show create table general_log;
Table Create Table
general_log CREATE TABLE `general_log` (
- `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`thread_id` bigint(21) unsigned NOT NULL,
`server_id` int(10) unsigned NOT NULL,
@@ -262,7 +262,7 @@ general_log CREATE TABLE `general_log` (
show create table slow_log;
Table Create Table
slow_log CREATE TABLE `slow_log` (
- `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
+ `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`query_time` time(6) NOT NULL,
`lock_time` time(6) NOT NULL,
diff --git a/mysql-test/r/system_mysql_db_refs.result b/mysql-test/r/system_mysql_db_refs.result
index ac072505bc9..96ecd2f27c0 100644
--- a/mysql-test/r/system_mysql_db_refs.result
+++ b/mysql-test/r/system_mysql_db_refs.result
@@ -1,22 +1,22 @@
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";
create table test_db select * from mysql.db;
delete from test_db;
-insert into test_db (Host,Db,User) values (@name,@name,@name);
+insert ignore into test_db (Host,Db,User) values (@name,@name,@name);
create table test_host select * from mysql.host;
delete from test_host;
-insert into test_host (Host,Db) values (@name,@name);
+insert ignore into test_host (Host,Db) values (@name,@name);
create table test_user select * from mysql.user;
delete from test_user;
-insert into test_user (Host,User) values (@name,@name);
+insert ignore into test_user (Host,User) values (@name,@name);
create table test_func select * from mysql.func;
delete from test_func;
-insert into test_func (name) values (@name);
+insert ignore into test_func (name) values (@name);
create table test_tables_priv select * from mysql.tables_priv;
delete from test_tables_priv;
-insert into test_tables_priv (Host,Db,User,Table_name) values (@name,@name,@name,@name);
+insert ignore into test_tables_priv (Host,Db,User,Table_name) values (@name,@name,@name,@name);
create table test_columns_priv select * from mysql.columns_priv;
delete from test_columns_priv;
-insert into test_columns_priv (Host,Db,User,Table_name,Column_name) values (@name,@name,@name,@name,@name);
+insert ignore into test_columns_priv (Host,Db,User,Table_name,Column_name) values (@name,@name,@name,@name,@name);
select
if(isnull(test_db.Host),'WRONG!!!','ok') as test_db_Host,
if(isnull(test_host.Host),'WRONG!!!','ok') as test_host_Host,
diff --git a/mysql-test/r/table_elim.result b/mysql-test/r/table_elim.result
index 3e66880ae84..764a1b2780e 100644
--- a/mysql-test/r/table_elim.result
+++ b/mysql-test/r/table_elim.result
@@ -62,7 +62,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 4 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t0` left join (`test`.`t1`) on((`test`.`t1`.`a` = `test`.`t0`.`a`)) where 1
+Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t0` left join (`test`.`t1`) on(`test`.`t1`.`a` = `test`.`t0`.`a`) where 1
# Elimination with aggregate functions
explain select count(*) from t1 left join t2 on t2.a=t1.a;
id select_type table type possible_keys key key_len ref rows Extra
@@ -126,7 +126,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY f range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.a2.id' of SELECT #3 was resolved in SELECT #2
-Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` where (`f`.`id` in (1,2,3,4))
+Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` where `f`.`id` in (1,2,3,4)
This should use facts and a1 tables:
explain extended select id from v1 where attr1 between 12 and 14;
id select_type table type possible_keys key key_len ref rows filtered Extra
@@ -134,7 +134,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY f eq_ref PRIMARY PRIMARY 4 test.a1.id 1 100.00 Using index
Warnings:
Note 1276 Field or reference 'test.a2.id' of SELECT #3 was resolved in SELECT #2
-Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t1` `a1` where ((`f`.`id` = `a1`.`id`) and (`a1`.`attr1` between 12 and 14))
+Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t1` `a1` where `f`.`id` = `a1`.`id` and `a1`.`attr1` between 12 and 14
This should use facts, a2 and its subquery:
explain extended select id from v1 where attr2 between 12 and 14;
id select_type table type possible_keys key key_len ref rows filtered Extra
@@ -143,7 +143,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t2 ref PRIMARY PRIMARY 4 test.a2.id 2 100.00 Using index
Warnings:
Note 1276 Field or reference 'test.a2.id' of SELECT #3 was resolved in SELECT #2
-Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t2` `a2` where ((`f`.`id` = `a2`.`id`) and (`a2`.`attr2` between 12 and 14) and (`a2`.`fromdate` = (select max(`test`.`t2`.`fromdate`) from `test`.`t2` where (`test`.`t2`.`id` = `a2`.`id`))))
+Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t2` `a2` where `f`.`id` = `a2`.`id` and `a2`.`attr2` between 12 and 14 and `a2`.`fromdate` = (select max(`test`.`t2`.`fromdate`) from `test`.`t2` where `test`.`t2`.`id` = `a2`.`id`)
This should use one table:
explain select id from v2 where id=2;
id select_type table type possible_keys key key_len ref rows Extra
@@ -154,7 +154,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY f range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.f.id' of SELECT #3 was resolved in SELECT #2
-Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` where (`f`.`id` in (1,2,3,4))
+Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` where `f`.`id` in (1,2,3,4)
This should use facts and a1 tables:
explain extended select id from v2 where attr1 between 12 and 14;
id select_type table type possible_keys key key_len ref rows filtered Extra
@@ -162,7 +162,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY f eq_ref PRIMARY PRIMARY 4 test.a1.id 1 100.00 Using index
Warnings:
Note 1276 Field or reference 'test.f.id' of SELECT #3 was resolved in SELECT #2
-Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t1` `a1` where ((`f`.`id` = `a1`.`id`) and (`a1`.`attr1` between 12 and 14))
+Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t1` `a1` where `f`.`id` = `a1`.`id` and `a1`.`attr1` between 12 and 14
This should use facts, a2 and its subquery:
explain extended select id from v2 where attr2 between 12 and 14;
id select_type table type possible_keys key key_len ref rows filtered Extra
@@ -171,7 +171,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t2 ref PRIMARY PRIMARY 4 test.f.id 2 100.00 Using index
Warnings:
Note 1276 Field or reference 'test.f.id' of SELECT #3 was resolved in SELECT #2
-Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t2` `a2` where ((`f`.`id` = `a2`.`id`) and (`a2`.`attr2` between 12 and 14) and (`a2`.`fromdate` = (select max(`test`.`t2`.`fromdate`) from `test`.`t2` where (`test`.`t2`.`id` = `f`.`id`))))
+Note 1003 select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t2` `a2` where `f`.`id` = `a2`.`id` and `a2`.`attr2` between 12 and 14 and `a2`.`fromdate` = (select max(`test`.`t2`.`fromdate`) from `test`.`t2` where `test`.`t2`.`id` = `f`.`id`)
drop view v1, v2;
drop table t0, t1, t2;
create table t1 (a int);
@@ -655,7 +655,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL b 5 NULL 2 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select `test`.`t2`.`b` AS `b` from `test`.`t2` where <expr_cache><`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`b`,<exists>(select sum(1) from dual where 1 having (<cache>(`test`.`t2`.`b`) = <ref_null_helper>(sum(1))))))
+Note 1003 select `test`.`t2`.`b` AS `b` from `test`.`t2` where <expr_cache><`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`b`,<exists>(select sum(1) from dual where 1 having <cache>(`test`.`t2`.`b`) = <ref_null_helper>(sum(1)))))
DROP TABLE t1,t2;
#
# MDEV-4840: Wrong result (missing rows) on LEFT JOIN with InnoDB tables
diff --git a/mysql-test/r/tc_heuristic_recover.result b/mysql-test/r/tc_heuristic_recover.result
index f5a295cbd9f..193a73c77f8 100644
--- a/mysql-test/r/tc_heuristic_recover.result
+++ b/mysql-test/r/tc_heuristic_recover.result
@@ -1,12 +1,13 @@
call mtr.add_suppression("Can't init tc log");
call mtr.add_suppression("Found 1 prepared transactions!");
call mtr.add_suppression("Aborting");
-set debug_sync='RESET';
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
FLUSH TABLES;
+connect con1,localhost,root,,;
set debug_sync='ha_commit_trans_after_prepare WAIT_FOR go';
INSERT INTO t1 VALUES (1);;
+connection default;
# Prove that no COMMIT or ROLLBACK occurred yet.
SELECT * FROM t1;
i
diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result
index 0ecdcf0058a..b833f4f9768 100644
--- a/mysql-test/r/temp_table.result
+++ b/mysql-test/r/temp_table.result
@@ -158,9 +158,12 @@ drop table t1, t2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT);
LOCK TABLE t1 WRITE;
+connect conn1, localhost, root,,;
CREATE TEMPORARY TABLE t1 (i INT);
The following command should not block
DROP TEMPORARY TABLE t1;
+disconnect conn1;
+connection default;
DROP TABLE t1;
CREATE TABLE t1 (i INT);
CREATE TEMPORARY TABLE t2 (i INT);
@@ -311,3 +314,237 @@ show status like 'com_drop%table';
Variable_name Value
Com_drop_table 2
Com_drop_temporary_table 1
+#
+# Some more generic temporary table tests
+# added during MDEV-5535.
+#
+DROP DATABASE IF EXISTS temp_db;
+CREATE DATABASE temp_db;
+USE temp_db;
+#
+# SHOW TABLES do not list temporary tables.
+#
+CREATE TEMPORARY TABLE temp_t1(i INT) ENGINE=INNODB;
+INSERT INTO temp_t1 VALUES(1);
+SELECT * FROM temp_t1;
+i
+1
+SHOW TABLES;
+Tables_in_temp_db
+DROP TABLE temp_t1;
+#
+# Create and drop a temporary table.
+#
+CREATE TEMPORARY TABLE temp_t1(i INT) ENGINE=INNODB;
+INSERT INTO temp_t1 VALUES(1);
+SELECT * FROM temp_t1;
+i
+1
+DROP TABLE temp_t1;
+SELECT * FROM temp_t1;
+ERROR 42S02: Table 'temp_db.temp_t1' doesn't exist
+#
+# Create a temporary table and base table with same name and DROP TABLE.
+#
+CREATE TABLE t1(c1 VARCHAR(20)) ENGINE=INNODB;
+INSERT INTO t1 VALUES("BASE TABLE");
+CREATE TEMPORARY TABLE t1(c1 VARCHAR(20)) ENGINE=INNODB;
+INSERT INTO t1 VALUES("TEMPORARY TABLE");
+SELECT * FROM t1;
+c1
+TEMPORARY TABLE
+DROP TABLE t1;
+SELECT * FROM t1;
+c1
+BASE TABLE
+DROP TABLE t1;
+SELECT * FROM t1;
+ERROR 42S02: Table 'temp_db.t1' doesn't exist
+#
+# Create a temporary table and base table with same name and DROP TEMPORARY
+# TABLE.
+#
+CREATE TABLE t1(c1 VARCHAR(20)) ENGINE=INNODB;
+INSERT INTO t1 VALUES("BASE TABLE");
+CREATE TEMPORARY TABLE t1(c1 VARCHAR(20)) ENGINE=INNODB;
+INSERT INTO t1 VALUES("TEMPORARY TABLE");
+SELECT * FROM t1;
+c1
+TEMPORARY TABLE
+DROP TEMPORARY TABLE t1;
+SELECT * FROM t1;
+c1
+BASE TABLE
+DROP TEMPORARY TABLE t1;
+ERROR 42S02: Unknown table 'temp_db.t1'
+SELECT * FROM t1;
+c1
+BASE TABLE
+DROP TABLE t1;
+#
+# Create a temporary table and drop its parent database.
+#
+USE temp_db;
+CREATE TEMPORARY TABLE temp_t1(i INT) ENGINE=INNODB;
+INSERT INTO temp_t1 VALUES (1);
+DROP DATABASE temp_db;
+CREATE DATABASE temp_db;
+USE temp_db;
+DROP TEMPORARY TABLE temp_t1;
+#
+# Similar to above, but this time with a base table with same name.
+#
+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 temp_db;
+CREATE DATABASE temp_db;
+USE temp_db;
+DROP TEMPORARY TABLE t1;
+DROP TABLE t1;
+ERROR 42S02: Unknown table 'temp_db.t1'
+#
+# Create a temporary table within a function.
+#
+USE temp_db;
+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|
+SELECT f1();
+f1()
+1
+SELECT * FROM temp_t1;
+i
+1
+DROP TABLE temp_t1;
+CREATE TEMPORARY TABLE `temp_t1`(i INT) ENGINE=INNODB;
+SELECT f1();
+f1()
+1
+SELECT * FROM temp_t1;
+i
+1
+DROP FUNCTION f1;
+#
+# Create and drop a temporary table within a function.
+#
+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|
+ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
+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|
+SELECT f2();
+f2()
+0
+DROP FUNCTION f2;
+#
+# Create a temporary table within a function and select it from another
+# function.
+#
+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)|
+SELECT f2();
+f2()
+1
+DROP TEMPORARY TABLE temp_t1;
+DROP FUNCTION f2;
+#
+# Create temporary table like base table.
+#
+CREATE TABLE t1(i INT) ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+CREATE TEMPORARY TABLE temp_t1 LIKE t1;
+SELECT * FROM temp_t1;
+i
+CREATE TEMPORARY TABLE t1 LIKE t1;
+ERROR 42000: Not unique table/alias: 't1'
+DROP TABLE temp_t1, t1;
+#
+# Create temporary table as base table.
+#
+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;
+i
+1
+DROP TABLE temp_t1, t1;
+#
+# ALTER TABLE RENAME & ENABLE/DISABLE KEYS (shortcuts)
+#
+CREATE TEMPORARY TABLE t1(i INT PRIMARY KEY) ENGINE=MYISAM;
+INSERT INTO t1 VALUES(1);
+SELECT COUNT(*)=1 FROM t1;
+COUNT(*)=1
+1
+ALTER TABLE t1 RENAME t2;
+SELECT COUNT(*)=1 FROM t2;
+COUNT(*)=1
+1
+ALTER TABLE t2 RENAME t1;
+ALTER TABLE t1 DISABLE KEYS;
+ALTER TABLE t1 ENABLE KEYS;
+LOCK TABLES t1 WRITE;
+ALTER TABLE t1 RENAME t2;
+SELECT COUNT(*)=1 FROM t2;
+COUNT(*)=1
+1
+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;
+COUNT(*)=1
+1
+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;
+COUNT(*)=1
+1
+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;
+#
+# MDEV-10792: Assertion `thd->mdl_context.is_lock_owner
+# (MDL_key::TABLE, table->db, table->table_name, MDL_SHARED)'
+# failed in mysql_rm_table_no_locks
+#
+CREATE TEMPORARY TABLE t1 (i INT);
+DROP TABLE nonexisting_table, t1;
+ERROR 42S02: Unknown table 'temp_db.nonexisting_table'
+# Cleanup
+DROP DATABASE temp_db;
diff --git a/mysql-test/r/thread_id_overflow.result b/mysql-test/r/thread_id_overflow.result
new file mode 100644
index 00000000000..8303debb246
--- /dev/null
+++ b/mysql-test/r/thread_id_overflow.result
@@ -0,0 +1,23 @@
+connect con1, localhost,root;
+disconnect con1;
+connect con2, localhost,root;
+connection con2;
+connection default;
+SET @orig_debug=@@debug_dbug;
+SET GLOBAL DEBUG_DBUG='+d,thread_id_overflow';
+connect con3, localhost,root;
+connection con3;
+SELECT CONNECTION_ID();
+CONNECTION_ID()
+4294967294
+connection default;
+SET GLOBAL DEBUG_DBUG=@orig_debug;
+connect con4, localhost,root;
+connection con4;
+select IF(connection_id() - max_id = 1,'Good','Bad') as result;
+result
+Good
+disconnect con4;
+disconnect con3;
+disconnect con2;
+connection default;
diff --git a/mysql-test/r/timezone_grant.result b/mysql-test/r/timezone_grant.result
index d33d92dbc9e..42ce458d00f 100644
--- a/mysql-test/r/timezone_grant.result
+++ b/mysql-test/r/timezone_grant.result
@@ -9,6 +9,8 @@ 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();
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
@@ -26,10 +28,15 @@ select * from mysql.time_zone_name;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
+connection default;
+disconnect tzuser;
+connection default;
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;
+connect tzuser2, localhost, mysqltest_1,,;
+connection tzuser2;
show grants for current_user();
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
@@ -57,6 +64,8 @@ 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';
+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\_%';
@@ -66,6 +75,7 @@ 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;
a lb
@@ -76,5 +86,7 @@ ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table '
drop view v1;
create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1, mysql.time_zone;
ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 'time_zone'
+connection default;
+disconnect tzuser3;
drop table t1;
drop user mysqltest_1@localhost;
diff --git a/mysql-test/r/trans_read_only.result b/mysql-test/r/trans_read_only.result
index 2b1055d4a7b..5e86b0993cd 100644
--- a/mysql-test/r/trans_read_only.result
+++ b/mysql-test/r/trans_read_only.result
@@ -7,7 +7,8 @@
SELECT @@tx_read_only;
@@tx_read_only
1
-# Also for new connections. Switching to con1
+# Also for new connections.
+connect con1, localhost, root;
SELECT @@tx_read_only;
@@tx_read_only
1
@@ -15,7 +16,8 @@ SET SESSION TRANSACTION READ WRITE;
SELECT @@tx_read_only;
@@tx_read_only
0
-# Connection default
+disconnect con1;
+connection default;
SELECT @@tx_read_only;
@@tx_read_only
1
@@ -35,6 +37,6 @@ DROP TABLE t1;
CREATE TABLE t1(a INT);
START TRANSACTION READ ONLY;
INSERT DELAYED INTO t1 VALUES (1);
-ERROR 25006: Cannot execute statement in a READ ONLY transaction.
+ERROR 25006: Cannot execute statement in a READ ONLY transaction
COMMIT;
DROP TABLE t1;
diff --git a/mysql-test/r/trigger-compat.result b/mysql-test/r/trigger-compat.result
index 7659667fb37..387d4fb1489 100644
--- a/mysql-test/r/trigger-compat.result
+++ b/mysql-test/r/trigger-compat.result
@@ -8,8 +8,8 @@ CREATE DATABASE mysqltest_db1;
CREATE USER mysqltest_dfn@localhost;
CREATE USER mysqltest_inv@localhost;
GRANT CREATE, TRIGGER ON mysqltest_db1.* TO mysqltest_dfn@localhost;
-
----> connection: wl2818_definer_con
+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());
@@ -20,7 +20,7 @@ CREATE TRIGGER wl2818_trg2 AFTER INSERT ON t1
FOR EACH ROW
INSERT INTO t2 VALUES(CURRENT_USER());
Warnings:
-Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
+Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger
SELECT trigger_name, definer FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
trigger_name definer
@@ -29,12 +29,14 @@ wl2818_trg2 mysqltest_dfn@localhost
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest_db1 wl2818_trg1 INSERT def mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci
-def mysqltest_db1 wl2818_trg2 INSERT def mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION mysqltest_dfn@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+def mysqltest_db1 wl2818_trg1 INSERT def mysqltest_db1 t1 1 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci
+def mysqltest_db1 wl2818_trg2 INSERT def mysqltest_db1 t1 1 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION mysqltest_dfn@localhost latin1 latin1_swedish_ci latin1_swedish_ci
DROP TRIGGER wl2818_trg1;
Warnings:
-Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
+Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger
DROP TRIGGER wl2818_trg2;
+disconnect wl2818_definer_con;
+connection default;
use mysqltest_db1;
DROP TABLE t1;
DROP TABLE t2;
@@ -72,9 +74,11 @@ CREATE TRIGGER tr22 BEFORE INSERT ON t2 FOR EACH ROW DELETE FROM non_existing_ta
ERROR 42000: Unknown trigger has an error in its body: 'You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Not allowed syntax here, and trigger name cant be extracted either.' at line 1'
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
-tr11 INSERT t1 DELETE FROM t3 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-tr12 INSERT t1 DELETE FROM t3 AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-tr14 DELETE t1 DELETE FROM non_existing_table AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr11 INSERT t1 DELETE FROM t3 BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr12 INSERT t1 DELETE FROM t3 AFTER # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr15 UPDATE t1 CREATE DEFINER=`root`@`localhost` TRIGGER tr15 BEFORE UPDATE ON t1 FOR EACH ROW DELETE FROM non_existing_table a USING non_existing_table a BEFORE # latin1 latin1_swedish_ci latin1_swedish_ci
+tr13 DELETE t1 CREATE DEFINER=`root`@`localhost` TRIGGER tr13 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a BEFORE # latin1 latin1_swedish_ci latin1_swedish_ci
+tr14 DELETE t1 DELETE FROM non_existing_table AFTER # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
INSERT INTO t1 VALUES (1);
ERROR 42000: Trigger 'tr13' has an error in its body: 'You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'a USING t1 a' at line 1'
INSERT INTO t2 VALUES (1);
@@ -92,9 +96,11 @@ RENAME TABLE t1 TO t1_2;
ERROR 42000: Trigger 'tr13' has an error in its body: 'You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'a USING t1 a' at line 1'
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
-tr11 INSERT t1 DELETE FROM t3 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-tr12 INSERT t1 DELETE FROM t3 AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-tr14 DELETE t1 DELETE FROM non_existing_table AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr11 INSERT t1 DELETE FROM t3 BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr12 INSERT t1 DELETE FROM t3 AFTER # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr15 UPDATE t1 CREATE DEFINER=`root`@`localhost` TRIGGER tr15 BEFORE UPDATE ON t1 FOR EACH ROW DELETE FROM non_existing_table a USING non_existing_table a BEFORE # latin1 latin1_swedish_ci latin1_swedish_ci
+tr13 DELETE t1 CREATE DEFINER=`root`@`localhost` TRIGGER tr13 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a BEFORE # latin1 latin1_swedish_ci latin1_swedish_ci
+tr14 DELETE t1 DELETE FROM non_existing_table AFTER # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
DROP TRIGGER tr11;
Warnings:
Warning 1603 Triggers for table `test`.`t1` have no creation context
@@ -122,16 +128,16 @@ INSERT INTO t1 VALUES (1), (2), (3);
INSERT INTO t2 VALUES (1), (2), (3);
# We write three trigger files. First trigger is syntaxically incorrect, next trigger is correct
# and last trigger is broken.
-# Next we try to execute SHOW CREATE TRGGIR command for broken trigger and then try to drop one.
+# Next we try to execute SHOW CREATE TRIGGER command for broken trigger and then try to drop one.
FLUSH TABLE t1;
SHOW CREATE TRIGGER tr12;
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-tr12 CREATE DEFINER=`root`@`localhost` TRIGGER tr12 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t2 latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+tr12 CREATE DEFINER=`root`@`localhost` TRIGGER tr12 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t2 latin1 latin1_swedish_ci latin1_swedish_ci NULL
Warnings:
Warning 1603 Triggers for table `test`.`t1` have no creation context
SHOW CREATE TRIGGER tr11;
-Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
-tr11 CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a latin1 latin1_swedish_ci latin1_swedish_ci
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+tr11 CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a latin1 latin1_swedish_ci latin1_swedish_ci NULL
DROP TRIGGER tr12;
DROP TRIGGER tr11;
DROP TABLE t1;
diff --git a/mysql-test/r/trigger-trans.result b/mysql-test/r/trigger-trans.result
index cab7336cbe5..c58c4230a40 100644
--- a/mysql-test/r/trigger-trans.result
+++ b/mysql-test/r/trigger-trans.result
@@ -113,13 +113,18 @@ for each row
begin
insert into t3 (c) values (1);
end|
+connect connection_aux,localhost,root,,test,,;
+connect connection_update,localhost,root,,test,,;
+connection connection_aux;
select get_lock("lock_bug26141_wait", 0);
get_lock("lock_bug26141_wait", 0)
1
+connection default;
select get_lock("lock_bug26141_sync", /* must not be priorly locked */ 0);
get_lock("lock_bug26141_sync", /* must not be priorly locked */ 0)
1
insert into t1 (c) values (2);
+connection connection_update;
select get_lock("lock_bug26141_sync", 1000);
get_lock("lock_bug26141_sync", 1000)
1
@@ -127,9 +132,11 @@ update t1 set c=3 where c=1;
select release_lock("lock_bug26141_sync");
release_lock("lock_bug26141_sync")
1
+connection connection_aux;
select release_lock("lock_bug26141_wait");
release_lock("lock_bug26141_wait")
1
+connection default;
select * from t1;
c
2
@@ -141,6 +148,8 @@ select * from t3;
c
1
drop table t1, t2, t3;
+disconnect connection_update;
+disconnect connection_aux;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=innodb;
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index 8455450e294..701739fcfe5 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -4,6 +4,10 @@ drop database if exists mysqltest;
drop function if exists f1;
drop function if exists f2;
drop procedure if exists p1;
+connect addconroot1, localhost, root,,;
+connect addconroot2, localhost, root,,;
+connect addconwithoutdb, localhost, root,,*NO-ONE*;
+connection default;
create table t1 (i int);
create trigger trg before insert on t1 for each row set @a:=1;
set @a:=0;
@@ -299,7 +303,7 @@ create trigger trg before insert on t1 for each row set @a:=1;
create trigger trg after insert on t1 for each row set @a:=1;
ERROR HY000: Trigger already exists
create trigger trg2 before insert on t1 for each row set @a:=1;
-ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
+drop trigger trg2;
create trigger trg before insert on t3 for each row set @a:=1;
ERROR HY000: Trigger already exists
create trigger trg2 before insert on t3 for each row set @a:=1;
@@ -733,7 +737,9 @@ set NEW.username = user;
select count(*) from ((select 1) union (select 2)) as d1 into i;
end|
update t1 set data = 1;
+connection addconroot1;
update t1 set data = 2;
+connection default;
drop table t1;
create table t1 (c1 int, c2 datetime);
create trigger tr1 before insert on t1 for each row
@@ -777,7 +783,7 @@ for each row insert into t1 values (new.f2+1);
set @SAVE_SP_RECURSION_LEVELS=@@max_sp_recursion_depth;
set @@max_sp_recursion_depth=100;
insert into t1 values (1);
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
set @@max_sp_recursion_depth=@SAVE_SP_RECURSION_LEVELS;
select * from t1;
f1
@@ -790,7 +796,7 @@ drop trigger t2_ai;
create trigger t1_bu before update on t1
for each row insert into t1 values (2);
update t1 set f1= 10;
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
select * from t1;
f1
1
@@ -798,7 +804,7 @@ drop trigger t1_bu;
create trigger t1_bu before update on t1
for each row delete from t1 where f1=new.f1;
update t1 set f1= 10;
-ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
select * from t1;
f1
1
@@ -848,12 +854,14 @@ end//
CALL p1();
drop procedure p1;
drop table t1;
+connection addconwithoutdb;
create trigger t1_bi before insert on test.t1 for each row set @a:=0;
ERROR 3D000: No database selected
create trigger test.t1_bi before insert on t1 for each row set @a:=0;
ERROR 42S02: Table 'test.t1' doesn't exist
drop trigger t1_bi;
ERROR 3D000: No database selected
+connection default;
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;
@@ -1061,7 +1069,10 @@ 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;
conn_id trigger_conn_id
DROP TRIGGER t1_bi;
@@ -1275,10 +1286,12 @@ insert into t1 values ();
select @a;
@a
20
+connection addconroot1;
insert into t1 values ();
select @a;
@a
20
+connection default;
drop table t1;
drop function f1;
drop table if exists t1;
@@ -1445,6 +1458,9 @@ isave
1
2
drop table t1, t2, t3;
+disconnect addconroot1;
+disconnect addconroot2;
+disconnect addconwithoutdb;
Bug#28502 Triggers that update another innodb table will block
on X lock unnecessarily
@@ -1464,7 +1480,10 @@ end if;
end|
insert into t1 (id, count) values (1, 0);
lock table t1 write;
+connect connection_insert, localhost, root, , test, , ;
+connection connection_insert;
insert into t2 set id=1;
+connection default;
unlock tables;
update t2 set id=1 where id=1;
select * from t1;
@@ -1474,6 +1493,7 @@ select * from t2;
id
1
drop table t1, t2;
+disconnect connection_insert;
Additionally, provide test coverage for triggers and
all MySQL data changing commands.
@@ -1938,7 +1958,7 @@ DROP TRIGGER t_insert;
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 |
INSERT INTO t2 (a,b) VALUES (3,5);
-ERROR HY000: Can't update table 't2' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
+ERROR HY000: Can't update table 't2' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
DROP TABLE t1;
DROP TRIGGER t_insert;
DROP TABLE t2;
@@ -1968,8 +1988,8 @@ create trigger t1_bi before insert on t1 for each row begin end;
create trigger t1_bi before insert on t1 for each row begin end;
ERROR HY000: Trigger already exists
create trigger t1_bi2 before insert on t1 for each row begin end;
-ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table'
drop trigger t1_bi;
+drop trigger t1_bi2;
drop trigger t1_bi;
ERROR HY000: Trigger does not exist
lock tables t1 read;
@@ -2075,7 +2095,7 @@ DROP TABLE t1, t2;
CREATE TABLE t1 (id INT NOT NULL);
CREATE TABLE t2 (id INT NOT NULL);
INSERT t1 VALUES (1),(2),(3);
-UPDATE t1 SET id=NULL;
+UPDATE IGNORE t1 SET id=NULL;
Warnings:
Warning 1048 Column 'id' cannot be null
Warning 1048 Column 'id' cannot be null
@@ -2103,6 +2123,7 @@ CREATE TRIGGER trg1 BEFORE INSERT ON t2 FOR EACH ROW INSERT/*!INTO*/t1 VALUES (1
# Used to crash
SHOW TRIGGERS IN db1;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+trg1 INSERT t2 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t2 FOR EACH ROW INSERTINTOt1 VALUES (1) BEFORE # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci
INSERT INTO t2 VALUES (1);
ERROR 42000: Trigger 'trg1' has an error in its body: 'You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VALUES (1)' at line 1'
SELECT * FROM t1;
@@ -2157,6 +2178,7 @@ s1
DELETE FROM t1;
DROP TABLE t1;
DROP TEMPORARY TABLE t2;
+SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
DROP TRIGGER IF EXISTS trg1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT);
@@ -2184,6 +2206,7 @@ BEGIN
DECLARE trg2 CHAR;
SELECT 'ab' INTO trg2;
END|
+SET sql_mode = DEFAULT;
INSERT INTO t1 VALUES (0);
SELECT * FROM t1;
a
@@ -2245,9 +2268,12 @@ VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t2
VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0);
UPDATE t1 SET a = 3;
+connect con1,localhost,root,,;
SELECT COUNT(*) FROM t1;
COUNT(*)
9
+disconnect con1;
+connection default;
SELECT * FROM t2;
b
9
@@ -2275,6 +2301,8 @@ SET optimizer_switch=@save_optimizer_switch;
DROP TRIGGER tr;
DROP TABLE t1, t2;
End of 5.3 tests.
+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);
CREATE TRIGGER t1_bi
@@ -2288,8 +2316,19 @@ END;
SET @@session.sql_mode = default;
INSERT INTO t1 VALUES ('a');
ERROR 22001: Data too long for column 'c' at row 1
+show create trigger t1_bi;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+t1_bi STRICT_TRANS_TABLES,STRICT_ALL_TABLES CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi
+BEFORE INSERT
+ON t1
+FOR EACH ROW
+BEGIN
+SET NEW.c = 'www';
+END latin1 latin1_swedish_ci latin1_swedish_ci 2001-01-01 10:20:30.00
DROP TRIGGER t1_bi;
DROP TABLE t1;
+SET TIMESTAMP=DEFAULT;
+set time_zone= @@global.time_zone;
#
# MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops
#
@@ -2307,3 +2346,53 @@ insert into t2 value (2);
DROP VIEW v1;
DROP TABLE t1,t2,t3;
End of 10.1 tests.
+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';
+Variable_name Value
+Executed_triggers 0
+set @a=0;
+insert into t1 values (1);
+show status like 'Executed_triggers';
+Variable_name Value
+Executed_triggers 3
+select @a;
+@a
+3
+drop table t1;
+create table t1 (i int);
+set time_zone="+0:00";
+SET TIMESTAMP=UNIX_TIMESTAMP('2016-01-01 10:10:10.33');
+select now(2);
+now(2)
+2016-01-01 10:10:10.33
+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);
+now(2)
+2016-01-01 10:10:10.99
+create or replace trigger tr2 after insert on t1 for each row set @a=@a+1;
+select now(2);
+now(2)
+2016-01-01 10:10:10.99
+select trigger_name, action_order, created from information_schema.triggers
+where event_object_table = 't1' and trigger_schema='test';
+trigger_name action_order created
+tr1 1 2016-01-01 10:10:10.33
+tr2 2 2016-01-01 10:10:10.99
+drop table t1;
+set time_zone= @@global.time_zone;
+#
+# MDEV-12992: Increasing memory consumption
+with each invocation of trigger
+#
+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;
+# Running 20000 queries
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/trigger_no_defaults-11698.result b/mysql-test/r/trigger_no_defaults-11698.result
index 93672092180..8ce495eaf3a 100644
--- a/mysql-test/r/trigger_no_defaults-11698.result
+++ b/mysql-test/r/trigger_no_defaults-11698.result
@@ -21,6 +21,7 @@ a b
0 30
drop table t1;
set sql_mode=default;
+set sql_mode='';
create table t1 (
id int(11) not null auto_increment primary key,
data1 varchar(10) not null,
@@ -38,3 +39,4 @@ id data1 data2
1 x
2 y
drop table t1;
+set sql_mode=default;
diff --git a/mysql-test/r/trigger_notembedded.result b/mysql-test/r/trigger_notembedded.result
index 795f722b0d4..3ee84c3c308 100644
--- a/mysql-test/r/trigger_notembedded.result
+++ b/mysql-test/r/trigger_notembedded.result
@@ -8,69 +8,67 @@ CREATE DATABASE mysqltest_db1;
CREATE USER mysqltest_dfn@localhost;
CREATE USER mysqltest_inv@localhost;
GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
-
----> connection: wl2818_definer_con
+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);
-
----> connection: default
+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;
-
----> connection: default
+connection default;
GRANT SUPER ON *.* TO mysqltest_dfn@localhost;
-
----> connection: wl2818_definer_con
+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());
ERROR 42000: TRIGGER command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
-
----> connection: default
+disconnect wl2818_definer_con;
+connection default;
GRANT TRIGGER ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
-
----> connection: wl2818_definer_con
+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
+disconnect wl2818_definer_con;
+connection default;
REVOKE TRIGGER ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost;
-
----> connection: wl2818_definer_con
+connect wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1;
+connection wl2818_definer_con;
DROP TRIGGER trg1;
ERROR 42000: TRIGGER command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
-
----> connection: wl2818_definer_con
+disconnect wl2818_definer_con;
+connect wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1;
+connection wl2818_definer_con;
INSERT INTO t1 VALUES(0);
ERROR 42000: TRIGGER command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
-
----> connection: default
+disconnect wl2818_definer_con;
+connection default;
GRANT TRIGGER ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
-
----> connection: wl2818_definer_con
+connect wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1;
+connection wl2818_definer_con;
INSERT INTO t1 VALUES(0);
DROP TRIGGER trg1;
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
-
----> connection: default
+disconnect wl2818_definer_con;
+connection default;
REVOKE SUPER ON *.* FROM mysqltest_dfn@localhost;
-
----> connection: wl2818_definer_con
+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
+connection default;
GRANT ALL PRIVILEGES ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
GRANT ALL PRIVILEGES ON mysqltest_db1.t2 TO mysqltest_dfn@localhost;
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
+connection wl2818_definer_con;
use mysqltest_db1;
INSERT INTO t1 VALUES(1);
SELECT * FROM t1;
@@ -79,8 +77,8 @@ num_value
SELECT * FROM t2;
user_str
mysqltest_dfn@localhost
-
----> connection: wl2818_invoker_con
+connect wl2818_invoker_con,localhost,mysqltest_inv,,mysqltest_db1;
+connection wl2818_invoker_con;
use mysqltest_db1;
INSERT INTO t1 VALUES(2);
SELECT * FROM t1;
@@ -91,12 +89,10 @@ SELECT * FROM t2;
user_str
mysqltest_dfn@localhost
mysqltest_dfn@localhost
-
----> connection: default
+connection default;
use mysqltest_db1;
REVOKE INSERT ON mysqltest_db1.t2 FROM mysqltest_dfn@localhost;
-
----> connection: wl2818_invoker_con
+connection wl2818_invoker_con;
use mysqltest_db1;
INSERT INTO t1 VALUES(3);
ERROR 42000: INSERT command denied to user 'mysqltest_dfn'@'localhost' for table 't2'
@@ -109,8 +105,7 @@ SELECT * FROM t2;
user_str
mysqltest_dfn@localhost
mysqltest_dfn@localhost
-
----> connection: wl2818_definer_con
+connection wl2818_definer_con;
use mysqltest_db1;
DROP TRIGGER trg1;
CREATE DEFINER='mysqltest_inv'@'localhost'
@@ -118,12 +113,12 @@ CREATE DEFINER='mysqltest_inv'@'localhost'
FOR EACH ROW
SET @new_sum = 0;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
-
----> connection: default
+connection default;
use mysqltest_db1;
GRANT SUPER ON *.* TO mysqltest_dfn@localhost;
-
----> connection: wl2818_definer_con
+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
@@ -138,8 +133,8 @@ INSERT INTO t1 VALUES(6);
ERROR HY000: The user specified as a definer ('mysqltest_nonexs'@'localhost') does not exist
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
-trg1 INSERT t1 SET @new_sum = 0 BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION mysqltest_inv@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-trg2 INSERT t1 SET @new_sum = 0 AFTER NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION mysqltest_nonexs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+trg1 INSERT t1 SET @new_sum = 0 BEFORE # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION mysqltest_inv@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+trg2 INSERT t1 SET @new_sum = 0 AFTER # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION mysqltest_nonexs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
DROP TRIGGER trg1;
DROP TRIGGER trg2;
CREATE TRIGGER trg1 BEFORE INSERT ON t1
@@ -168,13 +163,12 @@ trg5 @abcdef@@@hostname
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-def mysqltest_db1 trg1 INSERT def mysqltest_db1 t1 0 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci
-def mysqltest_db1 trg2 INSERT def mysqltest_db1 t1 0 NULL SET @a = 2 ROW AFTER NULL NULL OLD NEW NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @ latin1 latin1_swedish_ci latin1_swedish_ci
-def mysqltest_db1 trg3 UPDATE def mysqltest_db1 t1 0 NULL SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @abc@def@@% latin1 latin1_swedish_ci latin1_swedish_ci
-def mysqltest_db1 trg4 UPDATE def mysqltest_db1 t1 0 NULL SET @a = 4 ROW AFTER NULL NULL OLD NEW NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @hostname latin1 latin1_swedish_ci latin1_swedish_ci
-def mysqltest_db1 trg5 DELETE def mysqltest_db1 t1 0 NULL SET @a = 5 ROW BEFORE NULL NULL OLD NEW NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @abcdef@@@hostname latin1 latin1_swedish_ci latin1_swedish_ci
-
----> connection: default
+def mysqltest_db1 trg1 INSERT def mysqltest_db1 t1 1 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci
+def mysqltest_db1 trg2 INSERT def mysqltest_db1 t1 1 NULL SET @a = 2 ROW AFTER NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @ latin1 latin1_swedish_ci latin1_swedish_ci
+def mysqltest_db1 trg3 UPDATE def mysqltest_db1 t1 1 NULL SET @a = 3 ROW BEFORE NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @abc@def@@% latin1 latin1_swedish_ci latin1_swedish_ci
+def mysqltest_db1 trg4 UPDATE def mysqltest_db1 t1 1 NULL SET @a = 4 ROW AFTER NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @hostname latin1 latin1_swedish_ci latin1_swedish_ci
+def mysqltest_db1 trg5 DELETE def mysqltest_db1 t1 1 NULL SET @a = 5 ROW BEFORE NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @abcdef@@@hostname latin1 latin1_swedish_ci latin1_swedish_ci
+connection default;
DROP USER mysqltest_dfn@localhost;
DROP USER mysqltest_inv@localhost;
DROP DATABASE mysqltest_db1;
@@ -194,29 +188,26 @@ 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;
-
----> connection: default
+connect bug15166_u1_con,localhost,mysqltest_u1,,mysqltest_db1;
+connection default;
use mysqltest_db1;
GRANT DELETE ON mysqltest_db1.* TO mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
Grants for mysqltest_u1@localhost
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
GRANT DELETE, TRIGGER ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost'
-
----> connection: bug15166_u1_con
+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!';
-
----> connection: default
+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
+connection bug15166_u1_con;
use mysqltest_db1;
CREATE TRIGGER t1_trg_err_1 BEFORE INSERT ON t1
FOR EACH ROW
@@ -240,8 +231,7 @@ 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';
-
----> connection: default
+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;
@@ -251,8 +241,7 @@ 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
+connection bug15166_u1_con;
use mysqltest_db1;
CREATE TRIGGER t1_trg_after_insert AFTER INSERT ON t1
FOR EACH ROW
@@ -282,8 +271,7 @@ 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;
-
----> connection: default
+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;
@@ -317,8 +305,7 @@ INSERT INTO t4 VALUES('t4_line2');
SELECT * FROM t4;
col
t4_trg_before_insert
-
----> connection: default
+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;
@@ -374,69 +361,103 @@ 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;
+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 (7);
ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for column 'i1' in table 't1'
INSERT INTO t2 VALUES (11);
ERROR 42000: SELECT, UPDATE command denied to user 'mysqltest_dfn'@'localhost' for column 'i1' in table 't2'
+connection definer;
DROP TRIGGER t2_bi;
DROP TRIGGER t1_bi;
+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;
INSERT INTO t1 VALUES (13);
ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for column 'i1' in table 't1'
INSERT INTO t2 VALUES (17);
ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for column 'i1' in table 't2'
+connection default;
REVOKE SELECT ON mysqltest_db1.* FROM mysqltest_dfn@localhost;
+connection definer;
DROP TRIGGER t2_bi;
DROP TRIGGER t1_bi;
+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);
INSERT INTO t2 VALUES (23);
ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for column 'i1' in table 't2'
+connection default;
REVOKE UPDATE ON mysqltest_db1.* FROM mysqltest_dfn@localhost;
+connection definer;
DROP TRIGGER t2_bi;
DROP TRIGGER t1_bi;
+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;
+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;
INSERT INTO t1 VALUES (47);
ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for column 'i1' in table 't1'
+connection definer;
DROP PROCEDURE p1;
CREATE PROCEDURE p1(INOUT i INT) DETERMINISTIC NO SQL SET i = i + 51;
+connection invoker;
INSERT INTO t1 VALUES (53);
ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for column 'i1' in table 't1'
+connection default;
DROP PROCEDURE p1;
REVOKE UPDATE ON mysqltest_db1.* FROM mysqltest_dfn@localhost;
+connection definer;
DROP TRIGGER t1_bi;
+disconnect definer;
+disconnect invoker;
+connection default;
DROP USER mysqltest_inv@localhost;
DROP USER mysqltest_dfn@localhost;
DROP TABLE t2;
@@ -448,24 +469,41 @@ CREATE TABLE t2 (id INTEGER);
INSERT INTO t2 VALUES (1),(2);
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);
GET_LOCK('B26162',120)
1
+connection rl_acquirer;
SELECT 'rl_acquirer', GET_LOCK('B26162',120), id FROM t2 WHERE id = 1;
+connection wl_acquirer;
SET SESSION LOW_PRIORITY_UPDATES=1;
SET GLOBAL LOW_PRIORITY_UPDATES=1;
INSERT INTO t1 VALUES (5);
+connection rl_contender;
SELECT 'rl_contender', id FROM t2 WHERE id > 1;
+connection rl_holder;
SELECT RELEASE_LOCK('B26162');
RELEASE_LOCK('B26162')
1
+connection rl_acquirer;
rl_acquirer GET_LOCK('B26162',120) id
rl_acquirer 1 1
SELECT RELEASE_LOCK('B26162');
RELEASE_LOCK('B26162')
1
+connection wl_acquirer;
+connection rl_contender;
rl_contender id
rl_contender 2
+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;
@@ -473,18 +511,21 @@ SET GLOBAL LOW_PRIORITY_UPDATES=DEFAULT;
End of 5.0 tests.
drop table if exists t1;
create table t1 (i int);
-connection: default
+connect flush,localhost,root,,test,,;
+connection default;
lock tables t1 write;
-connection: flush
+connection flush;
flush tables with read lock;;
-connection: default
+connection default;
create trigger t1_bi before insert on t1 for each row begin end;
unlock tables;
-connection: flush
+connection flush;
unlock tables;
+connection default;
select * from t1;
i
drop table t1;
+disconnect flush;
CREATE DATABASE db1;
CREATE TABLE db1.t1 (a char(30)) ENGINE=MEMORY;
CREATE TRIGGER db1.trg AFTER INSERT ON db1.t1 FOR EACH ROW
@@ -492,11 +533,14 @@ 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';
trigger_name
SHOW CREATE TRIGGER db1.trg;
ERROR 42000: Access denied; you need (at least one of) the TRIGGER privilege(s) for this operation
+connection default;
+disconnect con1;
DROP USER 'no_rights'@'localhost';
DROP DATABASE db1;
DROP DATABASE IF EXISTS mysqltest_db1;
@@ -504,6 +548,7 @@ 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
@@ -515,10 +560,13 @@ CREATE TABLE t2 (
a1 int
);
INSERT INTO t2 VALUES (2);
+connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
UPDATE IGNORE t1, t2 SET t1.a1 = 2, t2.a1 = 3 WHERE t1.a1 = 1 AND t2.a1 = 2;
ERROR 42000: TRIGGER command denied to user 'mysqltest_u1'@'localhost' for table 't1'
DROP DATABASE mysqltest_db1;
DROP USER mysqltest_u1@localhost;
+disconnect con1;
+connection default;
USE test;
End of 5.1 tests.
diff --git a/mysql-test/r/trigger_wl3253.result b/mysql-test/r/trigger_wl3253.result
new file mode 100644
index 00000000000..bd2d250cb2f
--- /dev/null
+++ b/mysql-test/r/trigger_wl3253.result
@@ -0,0 +1,502 @@
+#
+# WL#3253: multiple triggers per table
+#
+SET @binlog_format_saved = @@binlog_format;
+SET binlog_format=ROW;
+SET time_zone='+00:00';
+#
+# Test 1.
+# Check that the sequence of triggers for the same combination
+# of event type/action type can be created for a table
+# and is fired consequently in the order of its creation
+# during statement execution.
+# In this test we check BEFORE triggers.
+#
+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;
+a b
+1 1
+101 2
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# Test 2.
+# Check that the sequence of triggers for the same combination
+# of event type/action type can be created for a table
+# and is fired consequently in the order of its creation
+# during statement execution.
+# In this test we check AFTER triggers.
+#
+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;
+a b
+1 1
+101 2
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# Test 3.
+# Check that the sequences of triggers for the different event types
+# can be created for a table and are fired consequently
+# in the order of its creation during statement execution.
+#
+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;
+a b
+1 1
+101 2
+UPDATE t1 SET a = 5;
+SELECT * FROM t2 ORDER BY b;
+a b
+1 1
+101 2
+5 3
+305 4
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# Test 4.
+# Check that every new created trigger has unique action_order value
+# started from 1 and NOT NULL value for creation timestamp.
+#
+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';
+trigger_name created action_order
+tr1_bi 2013-01-31 09:00:00.00 1
+tr2_bi 2013-01-31 09:00:01.00 2
+DROP TABLE t1;
+SET TIMESTAMP=DEFAULT;
+#
+# Test 5.
+# Check that action_order attribute isn't shown
+# in the output of SHOW TRIGGERS and SHOW CREATE TRIGGER
+#
+CREATE TABLE t1 (a INT);
+CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+tr1_bi INSERT t1 SET @a:=1 BEFORE # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_schema = 'test';
+TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
+def test tr1_bi INSERT def test t1 1 NULL SET @a:=1 ROW BEFORE NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+SHOW CREATE TRIGGER tr1_bi;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+tr1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 latin1 latin1_swedish_ci latin1_swedish_ci #
+DROP TABLE t1;
+#
+# Test 6.
+# Check that action_order attribute is reused when trigger
+# are recreated.
+#
+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';
+trigger_name action_order
+tr1_bi 1
+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';
+trigger_name action_order
+tr1_bi 1
+DROP TABLE t1;
+#
+# Test 7.
+# Check that it is possible to create several triggers with
+# the same value for creation timestamp.
+#
+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';
+trigger_name created action_order
+tr1_bi 2013-01-31 09:00:01.00 1
+tr2_bi 2013-01-31 09:00:01.00 2
+DROP TABLE t1;
+SET TIMESTAMP=DEFAULT;
+#
+# Test 8.
+# Check that SHOW CREATE TRIGGER outputs the CREATED attribute
+# and it is not NULL
+#
+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;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+tr1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 latin1 latin1_swedish_ci latin1_swedish_ci 2013-01-31 09:00:01.00
+DROP TABLE t1;
+SET TIMESTAMP=DEFAULT;
+#
+# Test 9.
+# Check that SHOW TRIGGERS outputs the CREATED attribute
+# and it is not NULL.
+#
+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;
+Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+tr1_bi INSERT t1 SET @a:=1 BEFORE 2013-01-31 09:00:01.00 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_schema = 'test';
+TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
+def test tr1_bi INSERT def test t1 1 NULL SET @a:=1 ROW BEFORE NULL NULL OLD NEW 2013-01-31 09:00:01.00 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+DROP TABLE t1;
+SET TIMESTAMP=DEFAULT;
+#
+# Test 10.
+# Check that FOLLOWS clause is supported and works correctly.
+#
+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';
+trigger_name action_order
+tr1_bi 1
+tr2_bi 2
+tr3_bi 3
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t2 ORDER BY b;
+a b
+101 1
+201 2
+301 3
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# Test 11.
+# Check that PRECEDES clause is supported and works correctly.
+#
+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';
+trigger_name action_order
+tr1_bi 1
+tr2_bi 2
+tr3_bi 3
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t2 ORDER BY b;
+a b
+101 1
+201 2
+301 3
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# Test 12.
+# Check that the PRECEDES works properly for the 1st trigger in the chain.
+#
+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';
+trigger_name action_order
+tr0_bi 1
+tr1_bi 2
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t2 ORDER BY b;
+a b
+1 1
+101 2
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# Test 13.
+# Check that error is reported if the FOLLOWS clause references to
+# non-existing trigger
+#
+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;
+CREATE TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW FOLLOWS tr0_bi SET @a:=2;
+ERROR HY000: Referenced trigger 'tr0_bi' for the given action time and event type does not exist
+SELECT trigger_name, action_order FROM information_schema.triggers WHERE trigger_schema='test';
+trigger_name action_order
+tr1_bi 1
+tr3_bi 2
+DROP TABLE t1;
+#
+# Test 14.
+# Check that error is reported if the PRECEDES clause references to
+# non-existing trigger
+#
+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;
+CREATE TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW PRECEDES tr0_bi SET @a:=2;
+ERROR HY000: Referenced trigger 'tr0_bi' for the given action time and event type does not exist
+SELECT trigger_name, action_order FROM information_schema.triggers WHERE trigger_schema='test';
+trigger_name action_order
+tr1_bi 1
+tr3_bi 2
+DROP TABLE t1;
+#
+# Test 15.
+# Check that action_order value is independent for each type of event
+# (INSERT/UPDATE/DELETE)
+#
+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';
+trigger_name action_order
+tr1_bi 1
+tr2_bi 2
+tr1_bu 1
+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';
+trigger_name action_order
+tr1_bi 1
+tr2_bi 2
+tr3_bi 3
+tr1_bu 1
+tr2_bu 2
+DROP TABLE t1;
+#
+# Test 16.
+# Check that the trigger in the clause FOLLOWS/PRECEDES can refences
+# only to the trigger for the same ACTION/TIMINMG
+#
+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;
+CREATE TRIGGER tr2_bu BEFORE UPDATE ON t1 FOR EACH ROW FOLLOWS tr1_bi SET @a:=3;
+ERROR HY000: Referenced trigger 'tr1_bi' for the given action time and event type does not exist
+CREATE TRIGGER tr2_au AFTER UPDATE ON t1 FOR EACH ROW FOLLOWS tr1_bi SET @a:=3;
+ERROR HY000: Referenced trigger 'tr1_bi' for the given action time and event type does not exist
+CREATE TRIGGER tr1_au AFTER UPDATE ON t1 FOR EACH ROW FOLLOWS tr1_bu SET @a:=3;
+ERROR HY000: Referenced trigger 'tr1_bu' for the given action time and event type does not exist
+CREATE TRIGGER tr1_ai AFTER INSERT ON t1 FOR EACH ROW FOLLOWS tr1_bi SET @a:=3;
+ERROR HY000: Referenced trigger 'tr1_bi' for the given action time and event type does not exist
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+tr1_bi INSERT t1 SET @a:=1 BEFORE # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr1_bu UPDATE t1 SET @a:=3 BEFORE # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_schema = 'test';
+TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
+def test tr1_bi INSERT def test t1 1 NULL SET @a:=1 ROW BEFORE NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+def test tr1_bu UPDATE def test t1 1 NULL SET @a:=3 ROW BEFORE NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+DROP TABLE t1;
+#
+# Test 17. Check that table's triggers are dumped correctly.
+#
+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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = latin1 */ ;
+/*!50003 SET character_set_results = latin1 */ ;
+/*!50003 SET collation_connection = latin1_swedish_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = latin1 */ ;
+/*!50003 SET character_set_results = latin1 */ ;
+/*!50003 SET collation_connection = latin1_swedish_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=2 */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = latin1 */ ;
+/*!50003 SET character_set_results = latin1 */ ;
+/*!50003 SET collation_connection = latin1_swedish_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr1_bu BEFORE UPDATE ON t1 FOR EACH ROW SET @a:=3 */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+DROP TABLE t1;
+#
+# Test 18. Check that table's triggers are dumped in right order
+# taking into account the PRECEDES/FOLLOWS clauses.
+#
+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;
+# Expected order of triggers in the dump is: tr0_bi, tr1_bi, tr1_1_bi, tr2_i.
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = latin1 */ ;
+/*!50003 SET character_set_results = latin1 */ ;
+/*!50003 SET collation_connection = latin1_swedish_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr0_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=0 */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = latin1 */ ;
+/*!50003 SET character_set_results = latin1 */ ;
+/*!50003 SET collation_connection = latin1_swedish_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = latin1 */ ;
+/*!50003 SET character_set_results = latin1 */ ;
+/*!50003 SET collation_connection = latin1_swedish_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr1_1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=0 */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = latin1 */ ;
+/*!50003 SET character_set_results = latin1 */ ;
+/*!50003 SET collation_connection = latin1_swedish_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=2 */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+DROP TABLE t1;
+#
+# Test 19. Check that table's triggers are dumped correctly in xml.
+#
+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;
+<?xml version="1.0"?>
+<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<database name="test">
+ <table_data name="t1">
+ </table_data>
+ <triggers name="t1">
+ <trigger Trigger="tr1_bi" sql_mode="STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci" Created="2013-01-31 09:00:00.00">
+<![CDATA[
+CREATE DEFINER=`root`@`localhost` TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1
+]]>
+ </trigger>
+ <trigger Trigger="tr2_bi" sql_mode="STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci" Created="2013-01-31 09:00:00.00">
+<![CDATA[
+CREATE DEFINER=`root`@`localhost` TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=2
+]]>
+ </trigger>
+ <trigger Trigger="tr1_bu" sql_mode="STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci" Created="2013-01-31 09:00:00.00">
+<![CDATA[
+CREATE DEFINER=`root`@`localhost` TRIGGER tr1_bu BEFORE UPDATE ON t1 FOR EACH ROW SET @a:=3
+]]>
+ </trigger>
+ </triggers>
+</database>
+</mysqldump>
+DROP TABLE t1;
+#
+# Test 20. Check that the statement CHECK TABLE FOR UPGRADE outputs
+# the warnings for triggers created by a server without support for wl3253.
+#
+CREATE TABLE t1 (a INT);
+FLUSH TABLE t1;
+CHECK TABLE t1 FOR UPGRADE;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+tr1_bi INSERT t1 SET @a:=1 BEFORE NULL NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr1_ai INSERT t1 SET @a:=2 AFTER NULL NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_schema = 'test';
+TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
+def test tr1_bi INSERT def test t1 1 NULL SET @a:=1 ROW BEFORE NULL NULL OLD NEW NULL NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+def test tr1_ai INSERT def test t1 1 NULL SET @a:=2 ROW AFTER NULL NULL OLD NEW NULL NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+SHOW CREATE TRIGGER tr1_bi;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+tr1_bi NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 latin1 latin1_swedish_ci latin1_swedish_ci NULL
+SHOW CREATE TRIGGER tr1_ai;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+tr1_ai NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER tr1_ai AFTER INSERT ON t1 FOR EACH ROW SET @a:=2 latin1 latin1_swedish_ci latin1_swedish_ci NULL
+DROP TABLE t1;
+SET binlog_format=@binlog_format_saved;
+# End of tests.
+#
diff --git a/mysql-test/r/truncate.result b/mysql-test/r/truncate.result
index 9b4cb4a36d9..48839f0eadb 100644
--- a/mysql-test/r/truncate.result
+++ b/mysql-test/r/truncate.result
@@ -142,7 +142,7 @@ TRUNCATE p1;
ERROR 42S02: Table 'test.p1' doesn't exist
SHOW CREATE PROCEDURE p1;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-p1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
SET @a = 5 latin1 latin1_swedish_ci latin1_swedish_ci
DROP PROCEDURE p1;
#
diff --git a/mysql-test/r/truncate_coverage.result b/mysql-test/r/truncate_coverage.result
index 395c71b2e6b..078de1ef3ab 100644
--- a/mysql-test/r/truncate_coverage.result
+++ b/mysql-test/r/truncate_coverage.result
@@ -5,76 +5,22 @@ DROP TABLE IF EXISTS t1;
#
CREATE TABLE t1 (c1 INT);
INSERT INTO t1 VALUES (1);
-#
-# connection con1
-HANDLER t1 OPEN;
-#
-# connection default
-LOCK TABLE t1 WRITE;
-SET DEBUG_SYNC='mdl_upgrade_lock SIGNAL waiting';
-TRUNCATE TABLE t1;
-#
-# connection con2
-SET DEBUG_SYNC='now WAIT_FOR waiting';
-KILL QUERY @id;
-#
-# connection default
-ERROR 70100: Query execution was interrupted
-UNLOCK TABLES;
-#
-# connection con1
-# Release shared metadata lock by closing HANDLER.
-HANDLER t1 CLOSE;
-#
-# connection default
-DROP TABLE t1;
-SET DEBUG_SYNC='RESET';
-CREATE TABLE t1 (c1 INT);
-INSERT INTO t1 VALUES (1);
-#
-# connection con1
-HANDLER t1 OPEN;
-#
-# connection default
-LOCK TABLE t1 WRITE;
-SET DEBUG_SYNC='mdl_upgrade_lock SIGNAL waiting';
-TRUNCATE TABLE t1;
-#
-# connection con2
-SET DEBUG_SYNC='now WAIT_FOR waiting';
-#
-# connection con1
-HANDLER t1 CLOSE;
-#
-# connection default
-ERROR 42S02: Table 'test.t1' doesn't exist
-UNLOCK TABLES;
-DROP TABLE t1;
-ERROR 42S02: Unknown table 'test.t1'
-SET DEBUG_SYNC='RESET';
-CREATE TABLE t1 (c1 INT);
-INSERT INTO t1 VALUES (1);
-#
-# connection con1
+connect con1, localhost, root,,;
START TRANSACTION;
INSERT INTO t1 VALUES (2);
-#
-# connection default
+connection default;
SET DEBUG_SYNC='mdl_acquire_lock_wait SIGNAL waiting';
TRUNCATE TABLE t1;
-#
-# connection con1
+connection con1;
SET DEBUG_SYNC='now WAIT_FOR waiting';
KILL QUERY @id;
-#
-# connection default
+connection default;
ERROR 70100: Query execution was interrupted
-#
-# connection con1
+connection con1;
# Release SW lock by committing transaction.
COMMIT;
-#
-# connection default
+disconnect con1;
+connection default;
UNLOCK TABLES;
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
@@ -86,22 +32,25 @@ SET DEBUG_SYNC='RESET';
DROP TABLE IF EXISTS t1, m1;
CREATE TABLE t1(a INT) engine=memory;
CREATE TABLE m1(a INT) engine=merge UNION(t1);
-# Connection con1
+connect con2, localhost, root;
+connect con1, localhost, root;
SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR dropped';
# Sending:
TRUNCATE TABLE m1;
-# Connection con2
+connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR opened';
# Sending:
FLUSH TABLES;
-# Connection default
+connection default;
# Waiting for FLUSH TABLES to be blocked.
SET DEBUG_SYNC= 'now SIGNAL dropped';
-# Connection con1
+connection con1;
# Reaping: TRUNCATE TABLE m1
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
-# Connection con2
+disconnect con1;
+connection con2;
# Reaping: FLUSH TABLES
-# Connection default
+disconnect con2;
+connection default;
SET DEBUG_SYNC= 'RESET';
DROP TABLE m1, t1;
diff --git a/mysql-test/r/type_binary.result b/mysql-test/r/type_binary.result
index 9d44d718a02..7dfe44ab045 100644
--- a/mysql-test/r/type_binary.result
+++ b/mysql-test/r/type_binary.result
@@ -116,7 +116,7 @@ hex(cast(0x10 as binary(2)))
1000
create table t1 (b binary(2), vb varbinary(2));
insert into t1 values(0x4120, 0x4120);
-insert into t1 values(0x412020, 0x412020);
+insert ignore into t1 values(0x412020, 0x412020);
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'vb' at row 1
@@ -137,7 +137,7 @@ ERROR 22001: Data too long for column 'vb' at row 1
drop table t1;
set @@sql_mode= @old_sql_mode;
create table t1(f1 int, f2 binary(2) not null, f3 char(2) not null);
-insert into t1 set f1=1;
+insert ignore into t1 set f1=1;
Warnings:
Warning 1364 Field 'f2' doesn't have a default value
Warning 1364 Field 'f3' doesn't have a default value
diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result
index 4136eb4dff7..30cd94c9277 100644
--- a/mysql-test/r/type_bit.result
+++ b/mysql-test/r/type_bit.result
@@ -461,7 +461,7 @@ h
a
drop table t1;
create table t1 (a bit(8)) engine=heap;
-insert into t1 values ('1111100000');
+insert ignore into t1 values ('1111100000');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select a+0 from t1;
@@ -605,7 +605,7 @@ NULL NULL
11111111 11111111
drop table bug15583;
create table t1(a bit(1), b smallint unsigned);
-insert into t1 (b, a) values ('2', '1');
+insert ignore into t1 (b, a) values ('2', '1');
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select hex(a), b from t1;
@@ -675,7 +675,7 @@ COUNT(DISTINCT b,c)
2
DROP TABLE t2;
CREATE TABLE t1(a BIT(13), KEY(a));
-INSERT INTO t1(a) VALUES
+INSERT IGNORE INTO t1(a) VALUES
(65535),(65525),(65535),(65535),(65535),(65535),(65535),(65535),(65535),(65535);
EXPLAIN SELECT 1 FROM t1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/r/type_bit_innodb.result b/mysql-test/r/type_bit_innodb.result
index 80fc942e77c..9b186207f3f 100644
--- a/mysql-test/r/type_bit_innodb.result
+++ b/mysql-test/r/type_bit_innodb.result
@@ -60,7 +60,7 @@ AAAAAAAAAAAAAAAA
5555555555555555
drop table t1;
create table t1 (a bit) engine=innodb;
-insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
+insert ignore into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
Warnings:
Warning 1264 Out of range value for column 'a' at row 4
select hex(a) from t1;
@@ -74,7 +74,7 @@ alter table t1 add unique (a);
ERROR 23000: Duplicate entry '' for key 'a'
drop table t1;
create table t1 (a bit(2)) engine=innodb;
-insert into t1 values (b'00'), (b'01'), (b'10'), (b'100');
+insert ignore into t1 values (b'00'), (b'01'), (b'10'), (b'100');
Warnings:
Warning 1264 Out of range value for column 'a' at row 4
select a+0 from t1;
@@ -256,7 +256,7 @@ a+0 b+0
127 403
explain select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 2 NULL 8 Using where; Using index; Using filesort
+1 SIMPLE t1 range a a 2 NULL 9 Using where; Using index; Using filesort
select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
a+0 b+0
57 135
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 223d26ad6d8..569ba65df3f 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -7,10 +7,12 @@ b text YES NULL
c tinyblob YES NULL
d mediumtext YES NULL
e longtext YES NULL
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 (a char(255), b varbinary(70000), c varchar(70000000));
Warnings:
Note 1246 Converting column 'b' from VARBINARY to BLOB
Note 1246 Converting column 'c' from VARCHAR to TEXT
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t4 (c varchar(65530) character set utf8 not null);
Warnings:
Note 1246 Converting column 'c' from VARCHAR to TEXT
@@ -23,8 +25,8 @@ create table t3 (a long, b long byte);
show create TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `a` mediumtext,
- `b` mediumblob
+ `a` mediumtext DEFAULT NULL,
+ `b` mediumblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create TABLE t4;
Table Create Table
@@ -36,11 +38,22 @@ CREATE TABLE t1 (a char(257) default "hello");
ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
CREATE TABLE t2 (a char(256));
ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t1 (a varchar(70000) default "hello");
-ERROR 42000: Column length too big for column 'a' (max = 65532); use BLOB or TEXT instead
+Warnings:
+Note 1246 Converting column 'a' from VARCHAR to TEXT
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` mediumtext DEFAULT 'hello'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 (a blob default "hello");
-ERROR 42000: BLOB/TEXT column 'a' can't have a default value
-drop table if exists t1,t2;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` blob DEFAULT 'hello'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1,t2;
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");
@@ -360,11 +373,11 @@ create table t1 (a text, unique (a(2100)));
ERROR 42000: Specified key was too long; max key length is 1000 bytes
create table t1 (a text, key (a(2100)));
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` text,
+ `a` text DEFAULT NULL,
KEY `a` (`a`(1000))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -503,11 +516,7 @@ foobar boggle
fish 10
drop table t1;
create table t1 (id integer auto_increment unique,imagem LONGBLOB not null default '');
-Warnings:
-Warning 1101 BLOB/TEXT column 'imagem' can't have a default value
insert into t1 (id) values (1);
-Warnings:
-Warning 1364 Field 'imagem' doesn't have a default value
select
charset(load_file('../../std_data/words.dat')),
collation(load_file('../../std_data/words.dat')),
@@ -793,21 +802,24 @@ NULL
620000000000
drop table t1;
create table t1 (a text default '');
-Warnings:
-Warning 1101 BLOB/TEXT column 'a' can't have a default value
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` text
+ `a` text DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (default);
select * from t1;
a
-NULL
+
drop table t1;
set @@sql_mode='TRADITIONAL';
create table t1 (a text default '');
-ERROR 42000: BLOB/TEXT column 'a' can't have a default value
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
set @@sql_mode='';
CREATE TABLE t (c TEXT CHARSET ASCII);
INSERT INTO t (c) VALUES (REPEAT('1',65537));
@@ -878,17 +890,22 @@ ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT
CREATE TABLE b15776 (a char(4294967295));
ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
CREATE TABLE b15776 (a char(4294967296));
-ERROR 42000: Display width out of range for 'a' (max = 4294967295)
-CREATE TABLE b15776 (a year(4294967295));
+ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
+CREATE TABLE b15776 (a year(?));
Warnings:
-Note 1287 'YEAR(4294967295)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+Note 1287 'YEAR(?)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
INSERT INTO b15776 VALUES (42);
SELECT * FROM b15776;
a
2042
DROP TABLE b15776;
CREATE TABLE b15776 (a year(4294967296));
-ERROR 42000: Display width out of range for 'a' (max = 4294967295)
+SHOW CREATE TABLE b15776;
+Table Create Table
+b15776 CREATE TABLE `b15776` (
+ `a` year(4) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE b15776;
CREATE TABLE b15776 (a year(0));
Warnings:
Note 1287 'YEAR(0)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
@@ -896,21 +913,26 @@ DROP TABLE b15776;
CREATE TABLE b15776 (a year(-2));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-2))' at line 1
CREATE TABLE b15776 (a timestamp(4294967294));
-ERROR 42000: Too big precision 4294967294 specified for 'a'. Maximum is 6.
+ERROR 42000: Too big precision 4294967294 specified for 'a'. Maximum is 6
CREATE TABLE b15776 (a timestamp(4294967295));
-ERROR 42000: Too big precision 4294967295 specified for 'a'. Maximum is 6.
+ERROR 42000: Too big precision 4294967295 specified for 'a'. Maximum is 6
CREATE TABLE b15776 (a timestamp(4294967296));
-ERROR 42000: Display width out of range for 'a' (max = 4294967295)
+ERROR 42000: Too big precision 4294967296 specified for 'a'. Maximum is 6
CREATE TABLE b15776 (a timestamp(-1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-1))' at line 1
CREATE TABLE b15776 (a timestamp(-2));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-2))' at line 1
CREATE TABLE b15776 (a int(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-ERROR 42000: Display width out of range for 'a' (max = 4294967295)
+ERROR 42000: Display width out of range for 'a' (max = 255)
CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-ERROR 42000: Display width out of range for 'a' (max = 4294967295)
+ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-ERROR 42000: Display width out of range for 'a' (max = 4294967295)
+SHOW CREATE TABLE b15776;
+Table Create Table
+b15776 CREATE TABLE `b15776` (
+ `a` year(4) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE b15776;
CREATE TABLE b15776 select cast(null as char(4294967295));
show columns from b15776;
Field Type Null Key Default Extra
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index 661dcabbcfe..a9e81b8071d 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -106,7 +106,7 @@ f2
19781126
DROP TABLE t1, t2, t3;
CREATE TABLE t1 (y YEAR);
-INSERT INTO t1 VALUES ('abc');
+INSERT IGNORE INTO t1 VALUES ('abc');
Warnings:
Warning 1366 Incorrect integer value: 'abc' for column 'y' at row 1
SELECT * FROM t1;
@@ -143,7 +143,7 @@ Warning 1292 Incorrect datetime value: '1311'
Warning 1292 Incorrect datetime value: '1311'
Warning 1292 Incorrect datetime value: '1311'
create table t1 (d date , dt datetime , ts timestamp);
-insert into t1 values (9912101,9912101,9912101);
+insert ignore into t1 values (9912101,9912101,9912101);
Warnings:
Warning 1265 Data truncated for column 'd' at row 1
Warning 1265 Data truncated for column 'dt' at row 1
@@ -300,7 +300,7 @@ b = CONVERT((SELECT CONVERT(a, DATE) FROM t1 GROUP BY a), DATE)
DROP TABLE t1;
End of 5.1 tests
create table t1 (f1 date, key (f1));
-insert t1 values ('2010-10-10 15:foobar');
+insert ignore t1 values ('2010-10-10 15:foobar');
Warnings:
Warning 1265 Data truncated for column 'f1' at row 1
drop table t1;
@@ -550,12 +550,12 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a BETWEEN '2001-01-01
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2001-01-01')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-01'
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a IN ('2001-01-01','2001-01-02');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2001-01-01')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-01'
DROP TABLE t1;
#
# MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x'
@@ -587,7 +587,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Warning 1292 Truncated incorrect date value: '2001-01-01x'
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2001-01-01') and (<cache>(hex(DATE'2001-01-01')) <> concat('xx',rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-01' and <cache>(hex(DATE'2001-01-01')) <> concat('xx',rand())
DROP TABLE t1;
CREATE TABLE t1 (a DATE);
INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02');
@@ -606,14 +606,14 @@ SELECT * FROM t1 WHERE LENGTH(a)=11+RAND() AND a=' 2001-01-01';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2001-01-01') and (<cache>(length(DATE'2001-01-01')) = (11 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-01' and <cache>(length(DATE'2001-01-01')) = 11 + rand()
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=11+RAND() AND a=' garbage ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Warning 1292 Incorrect datetime value: ' garbage '
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'0000-00-00') and (<cache>(length(DATE'0000-00-00')) = (11 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'0000-00-00' and <cache>(length(DATE'0000-00-00')) = 11 + rand()
DROP TABLE t1;
CREATE TABLE t1 (a DATE);
INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01');
@@ -632,7 +632,7 @@ SELECT * FROM t1 WHERE LENGTH(a)=8+RAND() AND a='20010101';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2001-01-01') and (<cache>(length(DATE'2001-01-01')) = (8 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-01' and <cache>(length(DATE'2001-01-01')) = 8 + rand()
DROP TABLE t1;
#
# MDEV-8706 Wrong result for SELECT..WHERE time_column=TIMESTAMP'2015-08-30 00:00:00' AND time_column='00:00:00'
@@ -655,13 +655,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2015-08-30')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-30'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2015-08-30') and (<cache>(length(DATE'2015-08-30')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-30' and <cache>(length(DATE'2015-08-30')) = 30 + rand()
DROP TABLE t1;
CREATE TABLE t1 (a DATE);
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
@@ -680,13 +680,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'24:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2015-08-31')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-31'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'24:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2015-08-31') and (<cache>(length(DATE'2015-08-31')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-31' and <cache>(length(DATE'2015-08-31')) = 30 + rand()
DROP TABLE t1;
# In this example '00:00:00' is not recognized as TIME'00:00:00'
# and is treated as DATE'0000-00-00'.
@@ -706,13 +706,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'0000-00-00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'0000-00-00'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'0000-00-00') and (<cache>(length(DATE'0000-00-00')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'0000-00-00' and <cache>(length(DATE'0000-00-00')) = 30 + rand()
DROP TABLE t1;
CREATE TABLE t1 (a DATE);
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
@@ -731,13 +731,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`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';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00') and (<cache>(length(DATE'2015-08-30')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00' and <cache>(length(DATE'2015-08-30')) = 30 + rand()
DROP TABLE t1;
CREATE TABLE t1 (a DATE);
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
@@ -754,13 +754,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00.1';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00.1')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`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';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00.1') and (<cache>(length(DATE'2015-08-30')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00.1' and <cache>(length(DATE'2015-08-30')) = 30 + rand()
DROP TABLE t1;
CREATE TABLE t1 (a DATE);
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
@@ -779,13 +779,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='2015-08-30 00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2015-08-30')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-30'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='2015-08-30 00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2015-08-30') and (<cache>(length(DATE'2015-08-30')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-30' and <cache>(length(DATE'2015-08-30')) = 30 + rand()
DROP TABLE t1;
SET timestamp=DEFAULT;
#
@@ -797,7 +797,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=DATE'2001-01-01' AND COALESC
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = DATE'2001-01-01')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = DATE'2001-01-01'
DROP TABLE t1;
#
# MDEV-8658 DATE(zerofill_column) and DATE(COALESCE(zerofill_column)) return different results
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index bf09ec8d0eb..c9b3358cca4 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -50,7 +50,7 @@ t
2001-01-01 01:01:01
2001-01-01 01:01:01
truncate table t1;
-insert into t1 values("2003-0303 12:13:14");
+insert ignore into t1 values("2003-0303 12:13:14");
Warnings:
Warning 1265 Data truncated for column 't' at row 1
select * from t1;
@@ -112,7 +112,7 @@ select * from t1 where a is null or b is null;
a b
drop table t1;
create table t1 (t datetime);
-insert into t1 values (20030102030460),(20030102036301),(20030102240401),
+insert ignore into t1 values (20030102030460),(20030102036301),(20030102240401),
(20030132030401),(20031302030401),(100001202030401);
Warnings:
Warning 1265 Data truncated for column 't' at row 1
@@ -130,7 +130,7 @@ t
0000-00-00 00:00:00
0000-00-00 00:00:00
delete from t1;
-insert into t1 values
+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");
Warnings:
@@ -149,7 +149,7 @@ t
0000-00-00 00:00:00
0000-00-00 00:00:00
delete from t1;
-insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
+insert ignore into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
Warnings:
Warning 1265 Data truncated for column 't' at row 1
Warning 1265 Data truncated for column 't' at row 2
@@ -544,7 +544,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY x1 ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary; End temporary
Warnings:
Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` semi join (`test`.`t1` `x1`) where ((`test`.`x1`.`id` = `test`.`t1`.`id`) and (`test`.`t1`.`cur_date` = 0))
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` semi join (`test`.`t1` `x1`) where `test`.`x1`.`id` = `test`.`t1`.`id` and `test`.`t1`.`cur_date` = 0
select * from t1
where id in (select id from t1 as x1 where (t1.cur_date is null));
id cur_date
@@ -556,7 +556,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY x1 ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary; End temporary
Warnings:
Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` semi join (`test`.`t2` `x1`) where ((`test`.`x1`.`id` = `test`.`t2`.`id`) and (`test`.`t2`.`cur_date` = 0))
+Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` semi join (`test`.`t2` `x1`) where `test`.`x1`.`id` = `test`.`t2`.`id` and `test`.`t2`.`cur_date` = 0
select * from t2
where id in (select id from t2 as x1 where (t2.cur_date is null));
id cur_date
@@ -747,7 +747,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 FORCE INDEX(attime) WHERE AtTime = '2010-02-22
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ref AtTime AtTime 6 const 1 100.00
Warnings:
-Note 1003 select `test`.`t1`.`Id` AS `Id`,`test`.`t1`.`AtTime` AS `AtTime` from `test`.`t1` FORCE INDEX (`attime`) where (`test`.`t1`.`AtTime` = TIMESTAMP'2010-02-22 18:40:07')
+Note 1003 select `test`.`t1`.`Id` AS `Id`,`test`.`t1`.`AtTime` AS `AtTime` from `test`.`t1` FORCE INDEX (`attime`) where `test`.`t1`.`AtTime` = TIMESTAMP'2010-02-22 18:40:07'
DROP TABLE t1;
SET NAMES latin1;
#
@@ -977,14 +977,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x'
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)!=30+RAND() AND a='2001-01-01 00:00:00x';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x'
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00')) <> (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and <cache>(length(TIMESTAMP'2001-01-01 00:00:00')) <> 30 + rand()
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME);;
INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01');
@@ -1000,20 +1000,20 @@ SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=' 2001-01-01 00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=19+RAND() AND a=' 2001-01-01 00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = (19 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and <cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = 19 + rand()
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' garbage ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Warning 1292 Incorrect datetime value: ' garbage '
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'0000-00-00 00:00:00') and (<cache>(length(TIMESTAMP'0000-00-00 00:00:00')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'0000-00-00 00:00:00' and <cache>(length(TIMESTAMP'0000-00-00 00:00:00')) = 30 + rand()
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME);;
INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01');
@@ -1032,13 +1032,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIMESTAMP'2001-01-01 00:00:00.000000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 00:00:00.000000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' and <cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = 30 + rand()
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME(6));;
INSERT INTO t1 VALUES ('2001-01-01 00:00:00.000000'),('2001-01-01 00:00:01.000000');
@@ -1057,13 +1057,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=26 AND a=TIMESTAMP'2001-01-01 00:00:00.000000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIMESTAMP'2001-01-01 00:00:00.000000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00.000000')) = (40 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' and <cache>(length(TIMESTAMP'2001-01-01 00:00:00.000000')) = 40 + rand()
DROP TABLE t1;
SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
CREATE TABLE t1 (a DATETIME);;
@@ -1083,13 +1083,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIME'00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIME'00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = (40 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and <cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = 40 + rand()
DROP TABLE t1;
#
# MDEV-8795 Equal expression propagation does not work for temporal literals
@@ -1100,7 +1100,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIMESTAMP'2001-01-01 00:00:0
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = TIMESTAMP'2001-01-01 00:00:00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = TIMESTAMP'2001-01-01 00:00:00'
DROP TABLE t1;
#
# MDEV-8875 Wrong metadata for MAX(CAST(time_column AS DATETIME))
@@ -1148,3 +1148,54 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9337 ALTER from DECIMAL and INT to DATETIME returns a wrong result
+#
+CREATE TABLE t1 (a DATETIME);
+INSERT INTO t1 VALUES (1000);
+SELECT * FROM t1;
+a
+2000-10-00 00:00:00
+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;
+a
+2000-10-00 00:00:00
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1000);
+ALTER TABLE t1 MODIFY a DATETIME;
+SELECT * FROM t1;
+a
+2000-10-00 00:00:00
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME);
+INSERT INTO t1 VALUES (1000.0);
+SELECT * FROM t1;
+a
+2000-10-00 00:00:00
+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;
+a
+2000-10-00 00:00:00
+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;
+a
+2000-10-00 00:00:00
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/type_datetime_hires.result b/mysql-test/r/type_datetime_hires.result
index 61c8001d98e..50354430e3f 100644
--- a/mysql-test/r/type_datetime_hires.result
+++ b/mysql-test/r/type_datetime_hires.result
@@ -1,13 +1,13 @@
SET timestamp=UNIX_TIMESTAMP('2001-02-03 10:20:30');
drop table if exists t1, t2, t3;
create table t1 (a datetime(7));
-ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6.
+ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6
create table t1 (a datetime(3), key(a));
insert t1 values ('2010-12-11 00:20:03.1234');
insert t1 values ('2010-12-11 15:47:11.1234');
insert t1 values (20101211010203.45678);
insert t1 values (20101211030405.789e0);
-insert t1 values (99991231235959e1);
+insert ignore t1 values (99991231235959e1);
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
@@ -95,7 +95,7 @@ a
select a, a + interval 2 year from t1;
a a + interval 2 year
2010-12-11 01:02:13.3332 2012-12-11 01:02:13.3332
-insert t1 select a + interval 2 year from t1;
+insert ignore t1 select a + interval 2 year from t1;
select * from t1;
a
2010-12-11 01:02:13.3332
@@ -322,12 +322,12 @@ INSERT INTO t2 VALUES
('2006-10-02 21:50:01.5678',9);
select table_name,partition_name,partition_method,partition_expression,partition_description,table_rows from information_schema.partitions where table_name in ('t1', 't2');
table_name partition_name partition_method partition_expression partition_description table_rows
-t1 p01 RANGE to_days(taken) 732920 0
-t1 p02 RANGE to_days(taken) 732950 7
-t1 p03 RANGE to_days(taken) MAXVALUE 3
-t2 p01 RANGE extract(microsecond from taken) 123000 3
-t2 p02 RANGE extract(microsecond from taken) 500000 4
-t2 p03 RANGE extract(microsecond from taken) MAXVALUE 3
+t1 p01 RANGE to_days(`taken`) 732920 0
+t1 p02 RANGE to_days(`taken`) 732950 7
+t1 p03 RANGE to_days(`taken`) MAXVALUE 3
+t2 p01 RANGE extract(microsecond from `taken`) 123000 3
+t2 p02 RANGE extract(microsecond from `taken`) 500000 4
+t2 p03 RANGE extract(microsecond from `taken`) MAXVALUE 3
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');
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index e515326e851..d5232ff92a8 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -155,31 +155,31 @@ 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 into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
+insert ignore into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 2
-insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
+insert ignore into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
-insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
+insert ignore into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
-insert into t1 values ("1e+4294967296"),("1e-4294967296");
+insert ignore into t1 values ("1e+4294967296"),("1e-4294967296");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
-insert into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809");
+insert ignore into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column 'a' at row 2
Note 1265 Data truncated for column 'a' at row 3
Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'a' at row 4
-insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
+insert ignore into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
@@ -222,28 +222,28 @@ create table t1 (a decimal(10,2) unsigned);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
Warnings:
Warning 1264 Out of range value for column 'a' at row 6
-insert into t1 values ("-.1"),("+.1"),(".1");
+insert ignore into t1 values ("-.1"),("+.1"),(".1");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
Warnings:
Warning 1264 Out of range value for column 'a' at row 3
-insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
+insert ignore into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
-insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
+insert ignore into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
-insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
+insert ignore into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
-insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
+insert ignore into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
@@ -280,28 +280,28 @@ create table t1 (a decimal(10,2) zerofill);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
Warnings:
Warning 1264 Out of range value for column 'a' at row 6
-insert into t1 values ("-.1"),("+.1"),(".1");
+insert ignore into t1 values ("-.1"),("+.1"),(".1");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
Warnings:
Warning 1264 Out of range value for column 'a' at row 3
-insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
+insert ignore into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
-insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
+insert ignore into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
-insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
+insert ignore into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
-insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
+insert ignore into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
@@ -338,16 +338,16 @@ 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 into t1 values (+111111111.11),(111111111.11),(-11111111.11);
+insert ignore into t1 values (+111111111.11),(111111111.11),(-11111111.11);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 2
-insert into t1 values (-111111111.11),(+1111111111.11),(1111111111.11);
+insert ignore into t1 values (-111111111.11),(+1111111111.11),(1111111111.11);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
-insert into t1 values (1e+100),(1e-100),(-1e+100);
+insert ignore into t1 values (1e+100),(1e-100),(-1e+100);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
@@ -392,7 +392,7 @@ a
98760.00
drop table t1;
create table t1 (a decimal);
-insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+12345678901'),(99999999999999);
+insert ignore into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+12345678901'),(99999999999999);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 6
@@ -408,7 +408,7 @@ a
9999999999
drop table t1;
create table t1 (a decimal unsigned);
-insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
+insert ignore into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 2
@@ -424,7 +424,7 @@ a
9999999999
drop table t1;
create table t1 (a decimal zerofill);
-insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
+insert ignore into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 2
@@ -440,7 +440,7 @@ a
9999999999
drop table t1;
create table t1 (a decimal unsigned zerofill);
-insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
+insert ignore into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 2
@@ -456,14 +456,14 @@ a
9999999999
drop table t1;
create table t1(a decimal(10,0));
-insert into t1 values ("1e4294967295");
+insert ignore into t1 values ("1e4294967295");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
a
9999999999
delete from t1;
-insert into t1 values("1e4294967297");
+insert ignore into t1 values("1e4294967297");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
@@ -477,7 +477,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
CREATE TABLE t1 (a_dec DECIMAL(-1,1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-1,1))' at line 1
CREATE TABLE t1 (a_dec DECIMAL(0,11));
-ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'a_dec').
+ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'a_dec')
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;
@@ -722,7 +722,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (d decimal(66,0));
-ERROR 42000: Too big precision 66 specified for 'd'. Maximum is 65.
+ERROR 42000: Too big precision 66 specified for 'd'. Maximum is 65
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),
@@ -811,10 +811,10 @@ c1
drop table t1;
SELECT 1 % .123456789123456789123456789123456789123456789123456789123456789123456789123456789 AS '%';
%
-0.012345687012345687012345687012
+0.01234568701234568701234568701234568701
SELECT MOD(1, .123456789123456789123456789123456789123456789123456789123456789123456789123456789) AS 'MOD()';
MOD()
-0.012345687012345687012345687012
+0.01234568701234568701234568701234568701
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;
@@ -845,8 +845,8 @@ c
123456
SELECT ROUND( a, 100 ) AS c FROM t1 ORDER BY c;
c
-123456.000000000000000000000000000000
-123456.000000000000000000000000000000
+123456.00000000000000000000000000000000000000
+123456.00000000000000000000000000000000000000
CREATE TABLE t2( a NUMERIC, b INT );
INSERT INTO t2 VALUES (123456, 100);
SELECT TRUNCATE( a, b ) AS c FROM t2 ORDER BY c;
@@ -867,8 +867,8 @@ c
123456
SELECT ROUND( a, 100 ) AS c FROM t3 ORDER BY c;
c
-123456.000000000000000000000000000000
-123456.000000000000000000000000000000
+123456.00000000000000000000000000000000000000
+123456.00000000000000000000000000000000000000
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;
@@ -881,8 +881,8 @@ c
123456
SELECT ROUND( a, 100 ) AS c FROM t4 ORDER BY c;
c
-123456.000000000000000000000000000000
-123456.000000000000000000000000000000
+123456.00000000000000000000000000000000000000
+123456.00000000000000000000000000000000000000
delete from t1;
INSERT INTO t1 VALUES (1234567890, 20), (999.99, 5);
Warnings:
@@ -1019,3 +1019,19 @@ cast('-0.0' as decimal(5,1)) < 0
#
# End of 5.5 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-15420 Wrong result for CAST from TIME or DATETIME with zero integer part and non-zero microseconds to DECIMAL(X,Y)
+#
+SET sql_mode='';
+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;
+c1 c2
+0.123456 0.123456
+SET sql_mode=DEFAULT;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
index d901434fd6e..6ad75339847 100644
--- a/mysql-test/r/type_enum.result
+++ b/mysql-test/r/type_enum.result
@@ -1637,13 +1637,13 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a enum ('0','1'));
-insert into t1 set a='foobar';
+insert ignore into t1 set a='foobar';
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
a
-update t1 set a = replace(a,'x','y');
+update ignore t1 set a = replace(a,'x','y');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
@@ -1669,7 +1669,7 @@ b ENUM('value','öäü_value','ÊÃÕ') character set latin1 NOT NULL
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) DEFAULT '1',
+ `a` int(11) DEFAULT 1,
`b` enum('value','öäü_value','ÊÃÕ') NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
@@ -1782,7 +1782,7 @@ CREATE TABLE t1 (
id INT AUTO_INCREMENT PRIMARY KEY,
c1 ENUM('a', '', 'b')
);
-INSERT INTO t1 (c1) VALUES (0), ('a'), (''), ('b');
+INSERT IGNORE INTO t1 (c1) VALUES (0), ('a'), (''), ('b');
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
SELECT id, c1 + 0, c1 FROM t1;
@@ -1791,6 +1791,7 @@ id c1 + 0 c1
2 1 a
3 2
4 3 b
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t1 CHANGE c1 c1 ENUM('a', '') NOT NULL;
Warnings:
Warning 1265 Data truncated for column 'c1' at row 4
@@ -1812,7 +1813,7 @@ drop table t1;
CREATE TABLE t1 (c1 ENUM('a', '', 'b'));
INSERT INTO t1 (c1) VALUES ('b');
INSERT INTO t1 (c1) VALUES ('');
-INSERT INTO t1 (c1) VALUES (0);
+INSERT IGNORE INTO t1 (c1) VALUES (0);
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
INSERT INTO t1 (c1) VALUES ('');
@@ -2104,7 +2105,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a ') and (hex(`test`.`t1`.`a`) = '61'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a ' and hex(`test`.`t1`.`a`) = '61'
DROP TABLE t1;
CREATE TABLE t1 (a ENUM('a','a ') CHARACTER SET BINARY);
INSERT INTO t1 VALUES ('a'),('a ');
@@ -2124,7 +2125,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
@@ -2134,3 +2135,87 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# MDEV-9340 Copying from INT/DOUBLE to ENUM is inconsistent
+#
+CREATE TABLE t1 (a ENUM('9e200','9e100'));
+CREATE TABLE t2 (a DOUBLE);
+INSERT INTO t2 VALUES ('9e100');
+INSERT IGNORE INTO t1 SELECT * FROM t2;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+SELECT * FROM t1;
+a
+
+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');
+Warnings:
+Warning 1916 Got overflow when converting '9e100' to INT. Value truncated
+Warning 1265 Data truncated for column 'a' at row 1
+SELECT * FROM t1;
+a
+
+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;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+SELECT * FROM t1;
+a
+
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a ENUM('200','100'));
+CREATE TABLE t2 (a INT);
+INSERT INTO t2 VALUES ('100');
+INSERT IGNORE INTO t1 SELECT * FROM t2;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+SELECT * FROM t1;
+a
+
+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');
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+SELECT *FROM t1;
+a
+
+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;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+SELECT * FROM t1;
+a
+
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a ENUM('2001','2002'));
+CREATE TABLE t2 (a YEAR);
+INSERT INTO t2 VALUES ('2001');
+INSERT IGNORE INTO t1 SELECT * FROM t2;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+SELECT * FROM t1;
+a
+
+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');
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+SELECT * FROM t1;
+a
+
+DROP TABLE t1;
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index e7267f012ae..2549d89fc97 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -133,12 +133,12 @@ min(a)
-0.010
drop table t1;
create table t1 (a float(200,100), b double(200,100));
-ERROR 42000: Too big scale 100 specified for 'a'. Maximum is 30.
+ERROR 42000: Too big scale 100 specified for 'a'. Maximum is 30
create table t1 (c20 char);
-insert into t1 values (5000.0);
+insert ignore into t1 values (5000.0);
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
-insert into t1 values (0.5e4);
+insert ignore into t1 values (0.5e4);
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
drop table t1;
@@ -147,7 +147,7 @@ ERROR 42000: Incorrect column specifier for column 'f'
drop table if exists t1;
create table t1 (d1 double, d2 double unsigned);
insert into t1 set d1 = -1.0;
-update t1 set d2 = d1;
+update ignore t1 set d2 = d1;
Warnings:
Warning 1264 Out of range value for column 'd2' at row 1
select * from t1;
@@ -155,7 +155,7 @@ d1 d2
-1 0
drop table t1;
create table t1 (f float(4,3));
-insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
+insert ignore into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
Warnings:
Warning 1264 Out of range value for column 'f' at row 1
Warning 1264 Out of range value for column 'f' at row 2
@@ -173,7 +173,7 @@ f
9.999
drop table if exists t1;
create table t1 (f double(4,3));
-insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
+insert ignore into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
Warnings:
Warning 1264 Out of range value for column 'f' at row 1
Warning 1264 Out of range value for column 'f' at row 2
@@ -341,9 +341,9 @@ s
drop table t1;
End of 4.1 tests
create table t1 (s1 float(0,2));
-ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
+ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1')
create table t1 (s1 float(1,2));
-ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
+ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1')
CREATE TABLE t1 (
f1 real zerofill,
f2 double zerofill,
@@ -363,7 +363,7 @@ DROP TABLE t1;
create table t1 (f1 double(200, 0));
insert into t1 values (1e199), (-1e199);
insert into t1 values (1e200), (-1e200);
-insert into t1 values (2e200), (-2e200);
+insert ignore into t1 values (2e200), (-2e200);
Warnings:
Warning 1264 Out of range value for column 'f1' at row 1
Warning 1264 Out of range value for column 'f1' at row 2
@@ -379,7 +379,7 @@ drop table t1;
create table t1 (f1 float(30, 0));
insert into t1 values (1e29), (-1e29);
insert into t1 values (1e30), (-1e30);
-insert into t1 values (2e30), (-2e30);
+insert ignore into t1 values (2e30), (-2e30);
Warnings:
Warning 1264 Out of range value for column 'f1' at row 1
Warning 1264 Out of range value for column 'f1' at row 2
@@ -453,10 +453,10 @@ foo
#
CREATE TABLE t1 (f FLOAT);
INSERT INTO t1 VALUES ('1.');
-INSERT INTO t1 VALUES ('2.0.');
+INSERT IGNORE INTO t1 VALUES ('2.0.');
Warnings:
Warning 1265 Data truncated for column 'f' at row 1
-INSERT INTO t1 VALUES ('.');
+INSERT IGNORE INTO t1 VALUES ('.');
Warnings:
Warning 1366 Incorrect double value: '.' for column 'f' at row 1
SELECT * FROM t1 ORDER BY f;
@@ -556,13 +556,13 @@ SELECT * FROM t1 WHERE LENGTH(a)!=6 AND a=100e0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 100e0)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 100e0
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=100e0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 100e0) and (<cache>(length(100)) <> rand()))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 100e0 and <cache>(length(100)) <> rand()
DROP TABLE t1;
CREATE TABLE t1 (a DOUBLE(10,1));
INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
@@ -582,7 +582,7 @@ SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10e0) and (<cache>(length(1.1)) <> rand()))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10e0 and <cache>(length(1.1)) <> rand()
DROP TABLE t1;
CREATE TABLE t1 (a DOUBLE(10,2));
INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
@@ -602,7 +602,7 @@ SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10e0) and (<cache>(length(1.10)) <> rand()))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10e0 and <cache>(length(1.10)) <> rand()
DROP TABLE t1;
CREATE TABLE t1 (a DOUBLE(10,3));
INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
@@ -622,7 +622,7 @@ SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10e0) and (<cache>(length(1.100)) <> rand()))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10e0 and <cache>(length(1.100)) <> rand()
DROP TABLE t1;
#
# MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010
@@ -633,8 +633,170 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010e0 AND a>=2010e0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010e0)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010e0
DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-4102 Limitation on DOUBLE or REAL length is ignored with INSERT .. SELECT
+#
+CREATE TABLE t1 (d1 DOUBLE(5,2), d2 DOUBLE(10,2));
+INSERT IGNORE INTO t1 VALUES (10000000.55, 10000000.55);
+Warnings:
+Warning 1264 Out of range value for column 'd1' at row 1
+INSERT IGNORE INTO t1 SELECT d2, d2 FROM t1;
+Warnings:
+Warning 1264 Out of range value for column 'd1' at row 1
+SELECT * FROM t1;
+d1 d2
+999.99 10000000.55
+999.99 10000000.55
+DROP TABLE t1;
+#
+# MDEV-9709 Unexpected modification of value and warning about out of range value upon ALTER
+#
+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
+);
+Warnings:
+Warning 1264 Out of range value for column 'f' at row 1
+Warning 1264 Out of range value for column 'd10_10' at row 1
+SELECT * FROM t1;
+f -3.40282e38
+d10_10 -0.9999999999
+d53_10 -10000000000000000000000000000000000000000000.0000000000
+INSERT IGNORE INTO t1 (f,d10_10,d53_10) SELECT d53_10, d53_10, d53_10 FROM t1;
+Warnings:
+Level Warning
+Code 1264
+Message Out of range value for column 'f' at row 1
+Level Warning
+Code 1264
+Message Out of range value for column 'd10_10' at row 1
+SELECT * FROM t1;
+f -3.40282e38
+d10_10 -0.9999999999
+d53_10 -10000000000000000000000000000000000000000000.0000000000
+f -3.40282e38
+d10_10 -0.9999999999
+d53_10 -10000000000000000000000000000000000000000000.0000000000
+ALTER TABLE t1 ADD COLUMN i INT;
+SELECT * FROM t1;
+f -3.40282e38
+d10_10 -0.9999999999
+d53_10 -10000000000000000000000000000000000000000000.0000000000
+i NULL
+f -3.40282e38
+d10_10 -0.9999999999
+d53_10 -10000000000000000000000000000000000000000000.0000000000
+i NULL
+DROP TABLE t1;
+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;
+Warnings:
+Warning 1264 Out of range value for column 'd10_10' at row 1
+SELECT * FROM t1;
+d10_10
+-0.9999999999
+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;
+Warnings:
+Warning 1264 Out of range value for column 'd2_2' at row 1
+SELECT * FROM t1;
+d2_2
+0.99
+DROP TABLE t1,t2;
+#
+# Test of using wrong scale
+#
+create or replace table t1 (a double(40,30));
+create or replace table t1 (a double(40,31));
+ERROR 42000: Too big scale 31 specified for 'a'. Maximum is 30
+create or replace table t1 as select 1.01e1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `1.01e1` double NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 as select truncate(10.000000000001e1, 30) as t;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `t` double(47,30) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 as select truncate(10.000000000001e1, 31) as t;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `t` double NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 as select truncate(10.000000000001e1, 39) as t;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `t` double NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 as select truncate(10.000000000001e1, 51) as t;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `t` double NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 as select truncate(10.000000000001e1, 20)/2 as t;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `t` double(41,24) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 as select truncate(10.000000000001e1, 28)/2 as t;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `t` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table if exists t1;
+#
+# MDEV-11586 UNION of FLOAT type results in erroneous precision
+#
+CREATE TABLE t1 (f FLOAT);
+INSERT INTO t1 VALUES (1.1);
+SELECT f FROM t1 UNION SELECT 1;
+f
+1.100000023841858
+1
+SELECT 1 UNION SELECT f FROM t1;
+1
+1
+1.100000023841858
+SELECT f FROM t1 UNION SELECT 2147483647;
+f
+1.100000023841858
+2147483647
+SELECT 2147483647 UNION SELECT f FROM t1;
+2147483647
+2147483647
+1.100000023841858
+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;
+c1 c2
+2147483647 2147483647
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/type_int.result b/mysql-test/r/type_int.result
index 4e7b928ac07..39e2e91ecc7 100644
--- a/mysql-test/r/type_int.result
+++ b/mysql-test/r/type_int.result
@@ -10,7 +10,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=2010;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010
DROP TABLE t1;
#
# MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field
@@ -31,8 +31,65 @@ SELECT * FROM t1 WHERE a=128 AND hex(a)='80';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 128) and (hex(`test`.`t1`.`a`) = '80'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 128 and hex(`test`.`t1`.`a`) = '80'
DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9393 Split Copy_field::get_copy_func() into virtual methods in Field
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (10.1),(10.9);
+SELECT * FROM t1;
+a
+10
+11
+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;
+a
+10
+11
+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;
+a
+10
+11
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (TIME'00:00:10.1'),(TIME'00:00:10.9');
+SELECT * FROM t1;
+a
+10
+10
+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;
+a
+10
+10
+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;
+a
+10
+10
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/type_json.result b/mysql-test/r/type_json.result
new file mode 100644
index 00000000000..2c1fdbe2b95
--- /dev/null
+++ b/mysql-test/r/type_json.result
@@ -0,0 +1,39 @@
+create or replace table t1(a json);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1(a json character set utf8);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'character set utf8)' at line 1
+create or replace table t1(a json default '{a:1}');
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '{a:1}'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1(a json not null check (json_valid(a)));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`a`))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert t1 values ('[]');
+insert t1 values ('a');
+ERROR 23000: CONSTRAINT `a` failed for `test`.`t1`
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT json_object('now',current_timestamp())
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert t1 values ();
+select * from t1;
+a
+{"now": "2010-11-12 13:14:15"}
+drop table t1;
+select cast('{a:1}' as text);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'text)' at line 1
+select cast('{a:1}' as json);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'json)' at line 1
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
index 56a04971fa1..ab0e2dbc71d 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -77,13 +77,13 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a decimal(4,2));
-insert into t1 value (10000), (1.1e10), ("11111"), (100000.1);
+insert ignore into t1 value (10000), (1.1e10), ("11111"), (100000.1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
Warning 1264 Out of range value for column 'a' at row 4
-insert into t1 value (-10000), (-1.1e10), ("-11111"), (-100000.1);
+insert ignore into t1 value (-10000), (-1.1e10), ("-11111"), (-100000.1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 2
@@ -101,13 +101,13 @@ a
-99.99
drop table t1;
create table t1 (a decimal(4,2) unsigned);
-insert into t1 value (10000), (1.1e10), ("11111"), (100000.1);
+insert ignore into t1 value (10000), (1.1e10), ("11111"), (100000.1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
Warning 1264 Out of range value for column 'a' at row 4
-insert into t1 value (-10000), (-1.1e10), ("-11111"), (-100000.1);
+insert ignore into t1 value (-10000), (-1.1e10), ("-11111"), (-100000.1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 2
@@ -125,13 +125,13 @@ a
0.00
drop table t1;
create table t1 (a bigint);
-insert into t1 values (18446744073709551615.0);
+insert ignore into t1 values (18446744073709551615.0);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-insert into t1 values (9223372036854775808.0);
+insert ignore into t1 values (9223372036854775808.0);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-insert into t1 values (-18446744073709551615.0);
+insert ignore into t1 values (-18446744073709551615.0);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
@@ -143,10 +143,10 @@ drop table t1;
create table t1 (a bigint unsigned);
insert into t1 values (18446744073709551615.0);
insert into t1 values (9223372036854775808.0);
-insert into t1 values (9999999999999999999999999.000);
+insert ignore into t1 values (9999999999999999999999999.000);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-insert into t1 values (-1.0);
+insert ignore into t1 values (-1.0);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
@@ -157,11 +157,11 @@ a
0
drop table t1;
create table t1 (a tinyint);
-insert into t1 values (18446744073709551615.0);
+insert ignore into t1 values (18446744073709551615.0);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 1
-insert into t1 values (9223372036854775808.0);
+insert ignore into t1 values (9223372036854775808.0);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'a' at row 1
@@ -176,7 +176,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`round(15.4,-1)` decimal(3,0) NOT NULL,
`truncate(-5678.123451,-3)` decimal(4,0) NOT NULL,
- `abs(-1.1)` decimal(3,1) NOT NULL,
+ `abs(-1.1)` decimal(2,1) NOT NULL,
`-(-1.1)` decimal(2,1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -700,10 +700,10 @@ select .7777777777777777777777777777777777777 *
1000000000000000000;
.7777777777777777777777777777777777777 *
1000000000000000000
-777777777777777777.777777777777777777700000000000
+777777777777777777.7777777777777777777000000000000000000
select .7777777777777777777777777777777777777 - 0.1;
.7777777777777777777777777777777777777 - 0.1
-0.677777777777777777777777777778
+0.6777777777777777777777777777777777777
select .343434343434343434 + .343434343434343434;
.343434343434343434 + .343434343434343434
0.686868686868686868
@@ -758,12 +758,12 @@ round(99999999999999999.999,3)
select round(-99999999999999999.999,3);
round(-99999999999999999.999,3)
-99999999999999999.999
-select truncate(99999999999999999999999999999999999999,31);
-truncate(99999999999999999999999999999999999999,31)
-99999999999999999999999999999999999999.000000000000000000000000000000
-select truncate(99.999999999999999999999999999999999999,31);
-truncate(99.999999999999999999999999999999999999,31)
-99.999999999999999999999999999999
+select truncate(99999999999999999999999999999999999999,49);
+truncate(99999999999999999999999999999999999999,49)
+99999999999999999999999999999999999999.000000000000000000000000000000000000
+select truncate(99.999999999999999999999999999999999999,49);
+truncate(99.999999999999999999999999999999999999,49)
+99.99999999999999999999999999999999999900
select truncate(99999999999999999999999999999999999999,-31);
truncate(99999999999999999999999999999999999999,-31)
99999990000000000000000000000000000000
@@ -838,12 +838,12 @@ select 9999999999999999999999999999999999999999999999999999999999999999999999999
x
99999999999999999999999999999999999999999999999999999999999999999
Warnings:
-Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated.
+Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 1 as x;
x
100000000000000000000000000000000000000000000000000000000000000000
Warnings:
-Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated.
+Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
select 0.190287977636363637 + 0.040372670 * 0 - 0;
0.190287977636363637 + 0.040372670 * 0 - 0
0.190287977636363637
@@ -889,7 +889,7 @@ 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;
col2/9999999999
-0.000000000001234567890246913578
+0.00000000000123456789024691357814814136
select 9999999999/col2 from t1 where col1=1;
9999999999/col2
810000007209.000065537105051
@@ -919,17 +919,19 @@ select ln(14000) c1, convert(ln(14000),decimal(5,3)) c2, cast(ln(14000) as decim
c1 c2 c3
9.546812608597396 9.547 9.547
select convert(ln(14000),decimal(2,3)) c1;
-ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '').
+ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '')
select cast(ln(14000) as decimal(2,3)) c1;
-ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '').
+ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '')
create table t1 (sl decimal(70,30));
-ERROR 42000: Too big precision 70 specified for 'sl'. Maximum is 65.
-create table t1 (sl decimal(32,31));
-ERROR 42000: Too big scale 31 specified for 'sl'. Maximum is 30.
-create table t1 (sl decimal(0,38));
-ERROR 42000: Too big scale 38 specified for 'sl'. Maximum is 30.
+ERROR 42000: Too big precision 70 specified for 'sl'. Maximum is 65
+create table t1 (sl decimal(32,39));
+ERROR 42000: Too big scale 39 specified for 'sl'. Maximum is 38
+create table t1 (sl decimal(67,38));
+ERROR 42000: Too big precision 67 specified for 'sl'. Maximum is 65
+create table t1 (sl decimal(0,50));
+ERROR 42000: Too big scale 50 specified for 'sl'. Maximum is 38
create table t1 (sl decimal(0,30));
-ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'sl').
+ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'sl')
create table t1 (sl decimal(5, 5));
show create table t1;
Table Create Table
@@ -937,11 +939,11 @@ t1 CREATE TABLE `t1` (
`sl` decimal(5,5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
-create table t1 (sl decimal(65, 30));
+create table t1 (sl decimal(65, 38));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `sl` decimal(65,30) DEFAULT NULL
+ `sl` decimal(65,38) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (
@@ -973,8 +975,8 @@ f1 decimal (0,0) zerofill not null default 0);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f0` decimal(30,30) unsigned zerofill NOT NULL DEFAULT '0.000000000000000000000000000000',
- `f1` decimal(10,0) unsigned zerofill NOT NULL DEFAULT '0000000000'
+ `f0` decimal(30,30) unsigned zerofill NOT NULL DEFAULT 0.000000000000000000000000000000,
+ `f1` decimal(10,0) unsigned zerofill NOT NULL DEFAULT 0000000000
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
drop procedure if exists wg2;
@@ -1011,7 +1013,7 @@ select cast(@non_existing_user_var/2 as DECIMAL);
cast(@non_existing_user_var/2 as DECIMAL)
NULL
create table t (d decimal(0,10));
-ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'd').
+ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'd')
CREATE TABLE t1 (
my_float FLOAT,
my_double DOUBLE,
@@ -1380,12 +1382,12 @@ create table t1 (c1 decimal(64));
insert into t1 values(
89000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);
Warnings:
-Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated.
+Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
Warning 1264 Out of range value for column 'c1' at row 1
insert into t1 values(
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 *
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999);
-ERROR 22003: DECIMAL value is out of range in '(99999999999999999999999999999999999999999999999999999999999999999 * 99999999999999999999999999999999999999999999999999999999999999999)'
+ERROR 22003: DECIMAL value is out of range in '99999999999999999999999999999999999999999999999999999999999999999 * 99999999999999999999999999999999999999999999999999999999999999999'
insert into t1 values(1e100);
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
@@ -1427,7 +1429,7 @@ select cast(19999999999999999999 as unsigned);
cast(19999999999999999999 as unsigned)
18446744073709551615
Warnings:
-Warning 1916 Got overflow when converting '19999999999999999999' to UNSIGNED INT. Value truncated.
+Warning 1916 Got overflow when converting '19999999999999999999' to UNSIGNED INT. Value truncated
create table t1(a decimal(18));
insert into t1 values(123456789012345678);
alter table t1 modify column a decimal(19);
@@ -1480,12 +1482,12 @@ SELECT CAST(1 AS decimal(65,10));
CAST(1 AS decimal(65,10))
1.0000000000
SELECT CAST(1 AS decimal(66,10));
-ERROR 42000: Too big precision 66 specified for '1'. Maximum is 65.
-SELECT CAST(1 AS decimal(65,30));
-CAST(1 AS decimal(65,30))
-1.000000000000000000000000000000
-SELECT CAST(1 AS decimal(65,31));
-ERROR 42000: Too big scale 31 specified for '1'. Maximum is 30.
+ERROR 42000: Too big precision 66 specified for '1'. Maximum is 65
+SELECT CAST(1 AS decimal(65,38));
+CAST(1 AS decimal(65,38))
+1.00000000000000000000000000000000000000
+SELECT CAST(1 AS decimal(65,39));
+ERROR 42000: Too big scale 39 specified for '1'. Maximum is 38
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;
@@ -1493,8 +1495,8 @@ aa SUM(b)
2.000000000000000000000000000000 10
3.000000000000000000000000000000 10
4.000000000000000000000000000000 30
-SELECT a+CAST(1 AS decimal(65,31)) AS aa, SUM(b) FROM t1 GROUP BY aa;
-ERROR 42000: Too big scale 31 specified for '1'. Maximum is 30.
+SELECT a+CAST(1 AS decimal(65,49)) AS aa, SUM(b) FROM t1 GROUP BY aa;
+ERROR 42000: Too big scale 49 specified for '1'. Maximum is 38
DROP TABLE t1;
CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL);
INSERT INTO t1 VALUES (3,30), (1,10), (2,10);
@@ -1504,31 +1506,31 @@ SELECT 1 FROM t1 GROUP BY @b := @a, @b;
1
1
DROP TABLE t1;
-CREATE TABLE t1 SELECT 0.123456789012345678901234567890123456 AS f1;
+CREATE TABLE t1 SELECT 0.1234567890123456789012345678901234567890123456789 AS f1;
Warnings:
Note 1265 Data truncated for column 'f1' at row 1
DESC t1;
Field Type Null Key Default Extra
-f1 decimal(31,30) NO NULL
+f1 decimal(39,38) NO NULL
SELECT f1 FROM t1;
f1
-0.123456789012345678901234567890
+0.12345678901234567890123456789012345679
DROP TABLE t1;
CREATE TABLE t1 SELECT 123451234512345123451234512345123451234512345.678906789067890678906789067890678906789067890 AS f1;
Warnings:
Warning 1264 Out of range value for column 'f1' at row 1
DESC t1;
Field Type Null Key Default Extra
-f1 decimal(65,30) NO NULL
+f1 decimal(65,36) NO NULL
SELECT f1 FROM t1;
f1
-99999999999999999999999999999999999.999999999999999999999999999999
+99999999999999999999999999999.999999999999999999999999999999999999
DROP TABLE t1;
select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
1.01500000 * 1.01500000 * 0.99500000);
(1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
1.01500000 * 1.01500000 * 0.99500000)
-0.812988073953673124592306939480
+0.81298807395367312459230693948000000000
create table t1 as select 5.05 / 0.014;
Warnings:
Note 1265 Data truncated for column '5.05 / 0.014' at row 1
@@ -1552,8 +1554,8 @@ SELECT substring(('M') FROM (999999999999999999999999999999999999999999999999999
foo
Warnings:
-Warning 1916 Got overflow when converting '999999999999999999999999999999999999999999999999999999999999999999999999999999999' to INT. Value truncated.
-Warning 1916 Got overflow when converting '999999999999999999999999999999999999999999999999999999999999999999999999999999999' to INT. Value truncated.
+Warning 1916 Got overflow when converting '999999999999999999999999999999999999999999999999999999999999999999999999999999999' to INT. Value truncated
+Warning 1916 Got overflow when converting '999999999999999999999999999999999999999999999999999999999999999999999999999999999' to INT. Value truncated
SELECT min(999999999999999999999999999999999999999999999999999999999999999999999999999999999) AS foo;
foo
999999999999999999999999999999999999999999999999999999999999999999999999999999999
@@ -1561,7 +1563,7 @@ SELECT multipolygonfromtext(('4294967294.1'),(9999999999999999999999999999999999
foo
NULL
Warnings:
-Warning 1916 Got overflow when converting '999999999999999999999999999999999999999999999999999999999999999999999999999999999' to INT. Value truncated.
+Warning 1916 Got overflow when converting '999999999999999999999999999999999999999999999999999999999999999999999999999999999' to INT. Value truncated
SELECT convert((999999999999999999999999999999999999999999999999999999999999999999999999999999999), decimal(30,30)) AS foo;
foo
0.999999999999999999999999999999
@@ -1571,7 +1573,7 @@ SELECT bit_xor(99999999999999999999999999999999999999999999999999999999999999999
foo
9223372036854775807
Warnings:
-Warning 1916 Got overflow when converting '999999999999999999999999999999999999999999999999999999999999999999999999999999999' to INT. Value truncated.
+Warning 1916 Got overflow when converting '999999999999999999999999999999999999999999999999999999999999999999999999999999999' to INT. Value truncated
SELECT -(999999999999999999999999999999999999999999999999999999999999999999999999999999999) AS foo;
foo
-999999999999999999999999999999999999999999999999999999999999999999999999999999999
@@ -1623,30 +1625,30 @@ Warnings:
Note 1265 Data truncated for column 'my_col' at row 1
DESCRIBE t1;
Field Type Null Key Default Extra
-my_col decimal(30,30) NO NULL
+my_col decimal(38,38) NO NULL
SELECT my_col FROM t1;
my_col
-0.123456789123456789123456789123
+0.12345678912345678912345678912345678912
DROP TABLE t1;
CREATE TABLE t1 SELECT 1 + .123456789123456789123456789123456789123456789123456789123456789123456789123456789 AS my_col;
Warnings:
Note 1265 Data truncated for column 'my_col' at row 1
DESCRIBE t1;
Field Type Null Key Default Extra
-my_col decimal(65,30) NO NULL
+my_col decimal(65,38) NO NULL
SELECT my_col FROM t1;
my_col
-1.123456789123456789123456789123
+1.12345678912345678912345678912345678912
DROP TABLE t1;
CREATE TABLE t1 SELECT 1 * .123456789123456789123456789123456789123456789123456789123456789123456789123456789 AS my_col;
Warnings:
Note 1265 Data truncated for column 'my_col' at row 1
DESCRIBE t1;
Field Type Null Key Default Extra
-my_col decimal(65,30) NO NULL
+my_col decimal(65,38) NO NULL
SELECT my_col FROM t1;
my_col
-0.123456789123456789123456789123
+0.12345678912345678912345678912345678912
DROP TABLE t1;
CREATE TABLE t1 SELECT 1 / .123456789123456789123456789123456789123456789123456789123456789123456789123456789 AS my_col;
Warnings:
@@ -1663,10 +1665,10 @@ Warnings:
Note 1265 Data truncated for column 'my_col' at row 1
DESCRIBE t1;
Field Type Null Key Default Extra
-my_col decimal(65,30) YES NULL
+my_col decimal(65,38) YES NULL
SELECT my_col FROM t1;
my_col
-0.012345687012345687012345687012
+0.01234568701234568701234568701234568701
DROP TABLE t1;
#
# Bug#45261: Crash, stored procedure + decimal
@@ -1712,7 +1714,7 @@ CREATE TABLE t1 SELECT
/* 82 */ 1000000000000000000000000000000000000000000000000000000000000000000000000000000001
AS c1;
Warnings:
-Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated.
+Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
DESC t1;
Field Type Null Key Default Extra
c1 decimal(65,0) NO NULL
@@ -1727,30 +1729,30 @@ Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(65,30) NO NULL
+c1 decimal(65,36) NO NULL
SELECT * FROM t1;
c1
-99999999999999999999999999999999999.999999999999999999999999999999
+99999999999999999999999999999.999999999999999999999999999999999999
DROP TABLE t1;
CREATE TABLE t1 SELECT
/* 1 */ 1.10000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 80 */
AS c1;
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(31,30) NO NULL
+c1 decimal(39,38) NO NULL
SELECT * FROM t1;
c1
-1.100000000000000000000000000000
+1.10000000000000000000000000000000000000
DROP TABLE t1;
CREATE TABLE t1 SELECT
/* 1 */ 1.100000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 81 */
AS c1;
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(31,30) NO NULL
+c1 decimal(39,38) NO NULL
SELECT * FROM t1;
c1
-1.100000000000000000000000000000
+1.10000000000000000000000000000000000000
DROP TABLE t1;
CREATE TABLE t1 SELECT
.100000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 81 */
@@ -1759,10 +1761,10 @@ Warnings:
Note 1265 Data truncated for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(30,30) NO NULL
+c1 decimal(38,38) NO NULL
SELECT * FROM t1;
c1
-0.100000000000000000000000000000
+0.10000000000000000000000000000000000000
DROP TABLE t1;
CREATE TABLE t1 SELECT
/* 45 */ 123456789012345678901234567890123456789012345.123456789012345678901234567890123456789012345 /* 45 */
@@ -1771,10 +1773,10 @@ Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(65,30) NO NULL
+c1 decimal(65,36) NO NULL
SELECT * FROM t1;
c1
-99999999999999999999999999999999999.999999999999999999999999999999
+99999999999999999999999999999.999999999999999999999999999999999999
DROP TABLE t1;
CREATE TABLE t1 SELECT
/* 65 */ 12345678901234567890123456789012345678901234567890123456789012345.1 /* 1 */
@@ -1807,20 +1809,18 @@ Warnings:
Note 1265 Data truncated for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(30,30) NO NULL
+c1 decimal(38,38) NO NULL
SELECT * FROM t1;
c1
-0.123456789012345678901234567890
+0.12345678901234567890123456789012345679
DROP TABLE t1;
CREATE TABLE t1 AS SELECT 123.1234567890123456789012345678901 /* 31 */ AS c1;
-Warnings:
-Note 1265 Data truncated for column 'c1' at row 1
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(33,30) NO NULL
+c1 decimal(34,31) NO NULL
SELECT * FROM t1;
c1
-123.123456789012345678901234567890
+123.1234567890123456789012345678901
DROP TABLE t1;
CREATE TABLE t1 SELECT 1.1 + CAST(1 AS DECIMAL(65,30)) AS c1;
DESC t1;
@@ -1836,22 +1836,20 @@ DROP TABLE t1;
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;
-Warnings:
-Note 1265 Data truncated for column 'c1' at row 4
DESC t2;
Field Type Null Key Default Extra
-c1 decimal(33,30) YES NULL
+c1 decimal(33,31) YES NULL
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.0000000000000000000000000000001, NULL) AS c1 FROM t1;
+CREATE TABLE t2 SELECT IFNULL(a + 0.00000000000000000000000000000000000000000000000001, NULL) AS c1 FROM t1;
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
Note 1265 Data truncated for column 'c1' at row 2
Note 1265 Data truncated for column 'c1' at row 3
DESC t2;
Field Type Null Key Default Extra
-c1 decimal(33,30) YES NULL
+c1 decimal(52,38) YES NULL
DROP TABLE t1,t2;
CREATE TABLE t1 (a DECIMAL(30,30));
INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
@@ -1860,7 +1858,7 @@ Warnings:
Note 1265 Data truncated for column 'c1' at row 1
DESC t2;
Field Type Null Key Default Extra
-c1 decimal(65,30) YES NULL
+c1 decimal(65,38) YES NULL
DROP TABLE t1,t2;
#
# Test that variables get maximum precision.
@@ -1869,10 +1867,10 @@ SET @decimal= 1.1;
CREATE TABLE t1 SELECT @decimal AS c1;
DESC t1;
Field Type Null Key Default Extra
-c1 decimal(65,30) YES NULL
+c1 decimal(65,38) YES NULL
SELECT * FROM t1;
c1
-1.100000000000000000000000000000
+1.10000000000000000000000000000000000000
DROP TABLE t1;
#
# Bug #45261 : Crash, stored procedure + decimal
@@ -1990,7 +1988,7 @@ d1 * d2
DROP TABLE t1;
select 0.000000000000000000000000000000000000000000000000001 mod 1;
0.000000000000000000000000000000000000000000000000001 mod 1
-0.000000000000000000000000000000
+0.00000000000000000000000000000000000000
select 0.0000000001 mod 1;
0.0000000001 mod 1
0.0000000001
@@ -2088,7 +2086,7 @@ SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10) and (<cache>(length(1.1)) <> rand()))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10 and <cache>(length(1.1)) <> rand()
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL(10,2));
INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
@@ -2108,7 +2106,7 @@ SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10) and (<cache>(length(1.10)) <> rand()))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10 and <cache>(length(1.10)) <> rand()
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL(10,3));
INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
@@ -2128,7 +2126,7 @@ SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10) and (<cache>(length(1.100)) <> rand()))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10 and <cache>(length(1.100)) <> rand()
DROP TABLE t1;
#
# MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010
@@ -2139,7 +2137,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010.0 AND a>=2010.0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010.0)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010.0
DROP TABLE t1;
#
# MDEV-8635 Redundant warnings on WHERE decimal_column='ax'
@@ -2192,7 +2190,7 @@ Note 1265 Data truncated for column 'a' at row 1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` decimal(2,1) DEFAULT '0.0'
+ `a` decimal(2,1) DEFAULT 0.0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT '0.1 ');
@@ -2201,7 +2199,7 @@ Note 1265 Data truncated for column 'a' at row 1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` decimal(2,1) DEFAULT '0.1'
+ `a` decimal(2,1) DEFAULT 0.1
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT '0.10001 ');
@@ -2210,7 +2208,7 @@ Note 1265 Data truncated for column 'a' at row 1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` decimal(2,1) DEFAULT '0.1'
+ `a` decimal(2,1) DEFAULT 0.1
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT '0.10001');
@@ -2219,7 +2217,7 @@ Note 1265 Data truncated for column 'a' at row 1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` decimal(2,1) DEFAULT '0.1'
+ `a` decimal(2,1) DEFAULT 0.1
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT 0.10001);
@@ -2228,7 +2226,7 @@ Note 1265 Data truncated for column 'a' at row 1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` decimal(2,1) DEFAULT '0.1'
+ `a` decimal(2,1) DEFAULT 0.1
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT 0.10001e0);
@@ -2237,13 +2235,10 @@ Note 1265 Data truncated for column 'a' at row 1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` decimal(2,1) DEFAULT '0.1'
+ `a` decimal(2,1) DEFAULT 0.1
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
-# End of 10.1 tests
-#
-#
# Bug#18408499 UNSIGNED BIGINT HIGH VALUES
# WRONG NUMERICAL COMPARISON RESULTS
#
@@ -2282,3 +2277,31 @@ SELECT * FROM t1 WHERE value = '100000000000000000000002';
value
100000000000000000000002
DROP TABLE t1;
+#
+# End of 10.1 tests
+#
+#
+# Test CREATE .. SELECT
+#
+create or replace table t1 as select 1.000000000000000000000000000000000 as a;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` decimal(34,33) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 as select 1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 as a;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` decimal(39,38) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 as select 1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 as a;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` decimal(39,38) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/type_num.result b/mysql-test/r/type_num.result
index 2eed7890e75..966d94ee385 100644
--- a/mysql-test/r/type_num.result
+++ b/mysql-test/r/type_num.result
@@ -423,7 +423,7 @@ Note 1265 Data truncated for column 'i2' at row 1
Note 1265 Data truncated for column 'i4' at row 1
Note 1265 Data truncated for column 'i8' at row 1
Note 1265 Data truncated for column 'd' at row 1
-INSERT INTO t1 VALUES ('','','','','','','');
+INSERT IGNORE INTO t1 VALUES ('','','','','','','');
Warnings:
Warning 1366 Incorrect double value: '' for column 'f4' at row 1
Warning 1366 Incorrect double value: '' for column 'f8' at row 1
@@ -432,7 +432,7 @@ Warning 1366 Incorrect integer value: '' for column 'i2' at row 1
Warning 1366 Incorrect integer value: '' for column 'i4' at row 1
Warning 1366 Incorrect integer value: '' for column 'i8' at row 1
Warning 1366 Incorrect decimal value: '' for column 'd' at row 1
-INSERT INTO t1 VALUES ('x','x','x','x','x','x','x');
+INSERT IGNORE INTO t1 VALUES ('x','x','x','x','x','x','x');
Warnings:
Warning 1366 Incorrect double value: 'x' for column 'f4' at row 1
Warning 1366 Incorrect double value: 'x' for column 'f8' at row 1
@@ -441,7 +441,7 @@ Warning 1366 Incorrect integer value: 'x' for column 'i2' at row 1
Warning 1366 Incorrect integer value: 'x' for column 'i4' at row 1
Warning 1366 Incorrect integer value: 'x' for column 'i8' at row 1
Warning 1366 Incorrect decimal value: 'x' for column 'd' at row 1
-INSERT INTO t1 VALUES (' x',' x',' x',' x',' x',' x',' x');
+INSERT IGNORE INTO t1 VALUES (' x',' x',' x',' x',' x',' x',' x');
Warnings:
Warning 1366 Incorrect double value: ' x' for column 'f4' at row 1
Warning 1366 Incorrect double value: ' x' for column 'f8' at row 1
@@ -450,7 +450,7 @@ Warning 1366 Incorrect integer value: ' x' for column 'i2' at row 1
Warning 1366 Incorrect integer value: ' x' for column 'i4' at row 1
Warning 1366 Incorrect integer value: ' x' for column 'i8' at row 1
Warning 1366 Incorrect decimal value: ' x' for column 'd' at row 1
-INSERT INTO t1 VALUES ('.','.','.','.','.','.','.');
+INSERT IGNORE INTO t1 VALUES ('.','.','.','.','.','.','.');
Warnings:
Warning 1366 Incorrect double value: '.' for column 'f4' at row 1
Warning 1366 Incorrect double value: '.' for column 'f8' at row 1
@@ -459,7 +459,7 @@ Warning 1366 Incorrect integer value: '.' for column 'i2' at row 1
Warning 1366 Incorrect integer value: '.' for column 'i4' at row 1
Warning 1366 Incorrect integer value: '.' for column 'i8' at row 1
Warning 1366 Incorrect decimal value: '.' for column 'd' at row 1
-INSERT INTO t1 VALUES ('-','-','-','-','-','-','-');
+INSERT IGNORE INTO t1 VALUES ('-','-','-','-','-','-','-');
Warnings:
Warning 1366 Incorrect double value: '-' for column 'f4' at row 1
Warning 1366 Incorrect double value: '-' for column 'f8' at row 1
@@ -468,7 +468,7 @@ Warning 1366 Incorrect integer value: '-' for column 'i2' at row 1
Warning 1366 Incorrect integer value: '-' for column 'i4' at row 1
Warning 1366 Incorrect integer value: '-' for column 'i8' at row 1
Warning 1366 Incorrect decimal value: '-' for column 'd' at row 1
-INSERT INTO t1 VALUES ('+','+','+','+','+','+','+');
+INSERT IGNORE INTO t1 VALUES ('+','+','+','+','+','+','+');
Warnings:
Warning 1366 Incorrect double value: '+' for column 'f4' at row 1
Warning 1366 Incorrect double value: '+' for column 'f8' at row 1
@@ -477,7 +477,7 @@ Warning 1366 Incorrect integer value: '+' for column 'i2' at row 1
Warning 1366 Incorrect integer value: '+' for column 'i4' at row 1
Warning 1366 Incorrect integer value: '+' for column 'i8' at row 1
Warning 1366 Incorrect decimal value: '+' for column 'd' at row 1
-INSERT INTO t1 VALUES ('1x','1x','1x','1x','1x','1x','1x');
+INSERT IGNORE INTO t1 VALUES ('1x','1x','1x','1x','1x','1x','1x');
Warnings:
Warning 1265 Data truncated for column 'f4' at row 1
Warning 1265 Data truncated for column 'f8' at row 1
@@ -486,7 +486,7 @@ Warning 1265 Data truncated for column 'i2' at row 1
Warning 1265 Data truncated for column 'i4' at row 1
Warning 1265 Data truncated for column 'i8' at row 1
Warning 1265 Data truncated for column 'd' at row 1
-INSERT INTO t1 VALUES ('1e','1e','1e','1e','1e','1e','1e');
+INSERT IGNORE INTO t1 VALUES ('1e','1e','1e','1e','1e','1e','1e');
Warnings:
Warning 1265 Data truncated for column 'f4' at row 1
Warning 1265 Data truncated for column 'f8' at row 1
@@ -495,7 +495,7 @@ Warning 1265 Data truncated for column 'i2' at row 1
Warning 1265 Data truncated for column 'i4' at row 1
Warning 1265 Data truncated for column 'i8' at row 1
Warning 1265 Data truncated for column 'd' at row 1
-INSERT INTO t1 VALUES ('1e-','1e-','1e-','1e-','1e-','1e-','1e-');
+INSERT IGNORE INTO t1 VALUES ('1e-','1e-','1e-','1e-','1e-','1e-','1e-');
Warnings:
Warning 1265 Data truncated for column 'f4' at row 1
Warning 1265 Data truncated for column 'f8' at row 1
@@ -504,7 +504,7 @@ Warning 1265 Data truncated for column 'i2' at row 1
Warning 1265 Data truncated for column 'i4' at row 1
Warning 1265 Data truncated for column 'i8' at row 1
Warning 1265 Data truncated for column 'd' at row 1
-INSERT INTO t1 VALUES ('1E+','1E+','1E+','1E+','1E+','1E+','1E+');
+INSERT IGNORE INTO t1 VALUES ('1E+','1E+','1E+','1E+','1E+','1E+','1E+');
Warnings:
Warning 1265 Data truncated for column 'f4' at row 1
Warning 1265 Data truncated for column 'f8' at row 1
@@ -513,7 +513,7 @@ Warning 1265 Data truncated for column 'i2' at row 1
Warning 1265 Data truncated for column 'i4' at row 1
Warning 1265 Data truncated for column 'i8' at row 1
Warning 1265 Data truncated for column 'd' at row 1
-INSERT INTO t1 VALUES ('1e1000','1e1000','1e1000','1e1000','1e1000','1e1000','1e1000');
+INSERT IGNORE INTO t1 VALUES ('1e1000','1e1000','1e1000','1e1000','1e1000','1e1000','1e1000');
Warnings:
Warning 1264 Out of range value for column 'f4' at row 1
Warning 1264 Out of range value for column 'f4' at row 1
@@ -1025,7 +1025,7 @@ SELECT COUNT(*) FROM t1 WHERE d='1e1000';
COUNT(*)
0
Warnings:
-Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated.
+Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
Warning 1292 Truncated incorrect DECIMAL value: '1e1000'
ALTER TABLE t1
ADD KEY f4(f4),
@@ -1219,9 +1219,6 @@ Warning 1292 Truncated incorrect INTEGER value: '1E+'
Warning 1292 Truncated incorrect DECIMAL value: '1E+'
Warning 1292 Truncated incorrect DOUBLE value: '1E+'
#
-# End of 10.0 tests
-#
-#
# Start of 10.1 tests
#
#
@@ -1247,5 +1244,17 @@ Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: ''
#
-# Start of 10.1 tests
+# Start of 10.2 tests
#
+CREATE TABLE t1 (a INT SIGNED ZEROFILL);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ZEROFILL)' at line 1
+CREATE TABLE t1 (a INT SIGNED UNSIGNED);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNSIGNED)' at line 1
+CREATE TABLE t1 (a INT ZEROFILL UNSIGNED ZEROFILL);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ZEROFILL)' at line 1
+CREATE OR REPLACE TABLE t1 (a INT SIGNED);
+CREATE OR REPLACE TABLE t1 (a INT UNSIGNED);
+CREATE OR REPLACE TABLE t1 (a INT ZEROFILL);
+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/r/type_num_innodb.result b/mysql-test/r/type_num_innodb.result
new file mode 100644
index 00000000000..581a387b2e8
--- /dev/null
+++ b/mysql-test/r/type_num_innodb.result
@@ -0,0 +1,107 @@
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9391 InnoDB does not produce warnings when doing WHERE int_column=varchar_column
+#
+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;
+a b c pk d e
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'f'
+Warning 1292 Truncated incorrect DOUBLE value: 'f'
+Warning 1292 Truncated incorrect DOUBLE value: 'g'
+Warning 1292 Truncated incorrect DOUBLE value: 'k'
+Warning 1292 Truncated incorrect DOUBLE value: 'm'
+Warning 1292 Truncated incorrect DOUBLE value: 'm'
+Warning 1292 Truncated incorrect DOUBLE value: 'm'
+Warning 1292 Truncated incorrect DOUBLE value: 'o'
+Warning 1292 Truncated incorrect DOUBLE value: 'q'
+Warning 1292 Truncated incorrect DOUBLE value: 'r'
+Warning 1292 Truncated incorrect DOUBLE value: 'u'
+Warning 1292 Truncated incorrect DOUBLE value: 'w'
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DOUBLE value: 'y'
+ALTER TABLE t1 MODIFY a DECIMAL(10,0);
+SELECT * FROM t1,t2 WHERE a=d;
+a b c pk d e
+Warnings:
+Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1292 Truncated incorrect DECIMAL value: 'd'
+Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1292 Truncated incorrect DECIMAL value: 'd'
+Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1292 Truncated incorrect DECIMAL value: 'f'
+Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1292 Truncated incorrect DECIMAL value: 'f'
+Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1292 Truncated incorrect DECIMAL value: 'g'
+Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1292 Truncated incorrect DECIMAL value: 'k'
+Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1292 Truncated incorrect DECIMAL value: 'm'
+Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1292 Truncated incorrect DECIMAL value: 'm'
+Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1292 Truncated incorrect DECIMAL value: 'm'
+Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1292 Truncated incorrect DECIMAL value: 'o'
+Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1292 Truncated incorrect DECIMAL value: 'q'
+Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1292 Truncated incorrect DECIMAL value: 'r'
+Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1292 Truncated incorrect DECIMAL value: 'u'
+Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1292 Truncated incorrect DECIMAL value: 'w'
+Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1292 Truncated incorrect DECIMAL value: 'x'
+Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1292 Truncated incorrect DECIMAL value: 'x'
+Warning 1918 Encountered illegal value '' when converting to DECIMAL
+Warning 1292 Truncated incorrect DECIMAL value: 'y'
+ALTER TABLE t1 MODIFY a DOUBLE;
+SELECT * FROM t1,t2 WHERE a=d;
+a b c pk d e
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'f'
+Warning 1292 Truncated incorrect DOUBLE value: 'f'
+Warning 1292 Truncated incorrect DOUBLE value: 'g'
+Warning 1292 Truncated incorrect DOUBLE value: 'k'
+Warning 1292 Truncated incorrect DOUBLE value: 'm'
+Warning 1292 Truncated incorrect DOUBLE value: 'm'
+Warning 1292 Truncated incorrect DOUBLE value: 'm'
+Warning 1292 Truncated incorrect DOUBLE value: 'o'
+Warning 1292 Truncated incorrect DOUBLE value: 'q'
+Warning 1292 Truncated incorrect DOUBLE value: 'r'
+Warning 1292 Truncated incorrect DOUBLE value: 'u'
+Warning 1292 Truncated incorrect DOUBLE value: 'w'
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DOUBLE value: 'y'
+DROP TABLE t1,t2;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result
index 101bf0cfb2c..fe7392c758f 100644
--- a/mysql-test/r/type_ranges.result
+++ b/mysql-test/r/type_ranges.result
@@ -38,9 +38,6 @@ KEY (ulong),
KEY (ulonglong,ulong),
KEY (options,flags)
);
-Warnings:
-Warning 1101 BLOB/TEXT column 'mediumblob_col' can't have a default value
-Warning 1101 BLOB/TEXT column 'longblob_col' can't have a default value
show full fields from t1;
Field Type Collation Null Key Default Extra Privileges Comment
auto int(5) unsigned NULL NO PRI NULL auto_increment #
@@ -57,14 +54,14 @@ ushort smallint(5) unsigned zerofill NULL NO MUL 00000 #
umedium mediumint(8) unsigned NULL NO MUL 0 #
ulong int(11) unsigned NULL NO MUL 0 #
ulonglong bigint(13) unsigned NULL NO MUL 0 #
-time_stamp timestamp NULL NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP #
+time_stamp timestamp NULL NO current_timestamp() on update current_timestamp() #
date_field date NULL YES NULL #
time_field time NULL YES NULL #
date_time datetime NULL YES NULL #
blob_col blob NULL YES NULL #
tinyblob_col tinyblob NULL YES NULL #
-mediumblob_col mediumblob NULL NO NULL #
-longblob_col longblob NULL NO NULL #
+mediumblob_col mediumblob NULL NO '' #
+longblob_col longblob NULL NO '' #
options enum('one','two','tree') latin1_swedish_ci NO MUL NULL #
flags set('one','two','tree') latin1_swedish_ci NO #
show keys from t1;
@@ -86,17 +83,17 @@ t1 1 options 2 flags A NULL NULL NULL BTREE
CREATE UNIQUE INDEX test on t1 ( auto ) ;
CREATE INDEX test2 on t1 ( ulonglong,ulong) ;
Warnings:
-Note 1831 Duplicate index `test2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `test2`. This is deprecated and will be disallowed in a future release
CREATE INDEX test3 on t1 ( medium ) ;
Warnings:
-Note 1831 Duplicate index `test3`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `test3`. This is deprecated and will be disallowed in a future release
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 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/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303101010','','','','3',3,3);
Warnings:
Warning 1265 Data truncated for column 'string' at row 1
-insert into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1);
+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);
Warnings:
Warning 1264 Out of range value for column 'utiny' at row 1
Warning 1264 Out of range value for column 'ushort' at row 1
@@ -105,7 +102,7 @@ Warning 1264 Out of range value for column 'ulong' at row 1
Warning 1264 Out of range value for column 'ulonglong' at row 1
Warning 1265 Data truncated for column 'options' at row 1
Warning 1265 Data truncated for column 'flags' at row 1
-insert into t1 values (0,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,NULL,0,0,0,-4294967295,-4294967295,-4294967295,'-4294967295',0,"one,two,tree");
+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");
Warnings:
Warning 1265 Data truncated for column 'string' at row 1
Warning 1264 Out of range value for column 'tiny' at row 1
@@ -118,7 +115,7 @@ Warning 1264 Out of range value for column 'umedium' at row 1
Warning 1264 Out of range value for column 'ulong' at row 1
Warning 1264 Out of range value for column 'ulonglong' at row 1
Warning 1265 Data truncated for column 'options' at row 1
-insert into t1 values (0,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,NULL,0,0,0,4294967295,4294967295,4294967295,'4294967295',0,0);
+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);
Warnings:
Warning 1264 Out of range value for column 'tiny' at row 1
Warning 1264 Out of range value for column 'short' at row 1
@@ -129,9 +126,6 @@ Warning 1264 Out of range value for column 'ushort' at row 1
Warning 1264 Out of range value for column 'umedium' at row 1
Warning 1265 Data truncated for column 'options' at row 1
insert into t1 (tiny) values (1);
-Warnings:
-Warning 1364 Field 'mediumblob_col' doesn't have a default value
-Warning 1364 Field 'longblob_col' doesn't have a default value
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;
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
10 1 1 1 1 1 1 1.0 1.0000 1 00001 1 1 1 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1 1 1
@@ -177,7 +171,7 @@ mediumblob_col mediumblob not null,
new_field char(2),
PRIMARY KEY (auto)
);
-INSERT INTO t2 (string,mediumblob_col,new_field) SELECT string,mediumblob_col,new_field from t1 where auto > 10;
+INSERT IGNORE INTO t2 (string,mediumblob_col,new_field) SELECT string,mediumblob_col,new_field from t1 where auto > 10;
Warnings:
Warning 1265 Data truncated for column 'new_field' at row 2
Warning 1265 Data truncated for column 'new_field' at row 3
@@ -232,13 +226,13 @@ ushort smallint(5) unsigned zerofill NULL NO 00000 #
umedium mediumint(8) unsigned NULL NO MUL 0 #
ulong int(11) unsigned NULL NO MUL 0 #
ulonglong bigint(13) unsigned NULL NO MUL 0 #
-time_stamp timestamp NULL NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP #
+time_stamp timestamp NULL NO current_timestamp() on update current_timestamp() #
date_field char(10) latin1_swedish_ci YES NULL #
time_field time NULL YES NULL #
date_time datetime NULL YES NULL #
new_blob_col varchar(20) latin1_swedish_ci YES NULL #
tinyblob_col tinyblob NULL YES NULL #
-mediumblob_col mediumblob NULL NO NULL #
+mediumblob_col mediumblob NULL NO '' #
options enum('one','two','tree') latin1_swedish_ci NO MUL NULL #
flags set('one','two','tree') latin1_swedish_ci NO #
new_field char(10) latin1_swedish_ci NO new #
@@ -258,13 +252,13 @@ ushort smallint(5) unsigned zerofill NULL NO 00000 #
umedium mediumint(8) unsigned NULL NO 0 #
ulong int(11) unsigned NULL NO 0 #
ulonglong bigint(13) unsigned NULL NO 0 #
-time_stamp timestamp NULL NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP #
+time_stamp timestamp NULL NO current_timestamp() on update current_timestamp() #
date_field char(10) latin1_swedish_ci YES NULL #
time_field time NULL YES NULL #
date_time datetime NULL YES NULL #
new_blob_col varchar(20) latin1_swedish_ci YES NULL #
tinyblob_col tinyblob NULL YES NULL #
-mediumblob_col mediumblob NULL NO NULL #
+mediumblob_col mediumblob NULL NO '' #
options enum('one','two','tree') latin1_swedish_ci NO NULL #
flags set('one','two','tree') latin1_swedish_ci NO #
new_field char(10) latin1_swedish_ci NO new #
@@ -281,12 +275,12 @@ Field Type Collation Null Key Default Extra Privileges Comment
auto int(11) unsigned NULL NO PRI NULL #
t1 int(1) NULL NO NULL #
t2 varchar(1) latin1_swedish_ci NO NULL #
-t3 varchar(256) latin1_swedish_ci NO NULL #
-t4 varbinary(256) NULL NO NULL #
-t5 text latin1_swedish_ci NO NULL #
-t6 blob NULL NO NULL #
+t3 varchar(256) latin1_swedish_ci YES NULL #
+t4 varbinary(256) NULL YES NULL #
+t5 text latin1_swedish_ci YES NULL #
+t6 blob NULL YES NULL #
t7 char(0) latin1_swedish_ci NO NULL #
-t8 binary(0) NULL NO NULL #
+t8 binary(0) NULL YES NULL #
select t1,t2,length(t3),length(t4),length(t5),length(t6),t7,t8 from t2;
t1 t2 length(t3) length(t4) length(t5) length(t6) t7 t8
1 a 256 256 4096 4096
@@ -311,7 +305,7 @@ const int(1) NULL NO NULL #
drop table t1,t2,t3;
create table t1 ( myfield INT NOT NULL, UNIQUE INDEX (myfield), unique (myfield), index(myfield));
Warnings:
-Note 1831 Duplicate index `myfield_2`. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `myfield_2`. This is deprecated and will be disallowed in a future release
drop table t1;
create table t1 ( id integer unsigned not null primary key );
create table t2 ( id integer unsigned not null primary key );
diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result
index 586c6345e00..742ee5a33e9 100644
--- a/mysql-test/r/type_set.result
+++ b/mysql-test/r/type_set.result
@@ -72,6 +72,7 @@ set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17',
'34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49',
'50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','128'));
ERROR HY000: Too many strings for column f1 and SET
+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',
@@ -285,7 +286,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a ') and (hex(`test`.`t1`.`a`) = '61'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a ' and hex(`test`.`t1`.`a`) = '61'
DROP TABLE t1;
CREATE TABLE t1 (a SET('a','a ') CHARACTER SET BINARY);
INSERT INTO t1 VALUES ('a'),('a ');
@@ -305,7 +306,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
diff --git a/mysql-test/r/type_temporal_innodb.result b/mysql-test/r/type_temporal_innodb.result
index 425e499a5d3..b869822722d 100644
--- a/mysql-test/r/type_temporal_innodb.result
+++ b/mysql-test/r/type_temporal_innodb.result
@@ -7,7 +7,7 @@ TIME'00:00:00'=''
Warnings:
Warning 1292 Truncated incorrect time value: ''
CREATE TABLE t1 (a ENUM('a'), b TIME, c INT, KEY(b)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES ('','00:00:00',0);
+INSERT IGNORE INTO t1 VALUES ('','00:00:00',0);
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
SELECT * FROM t1 WHERE b='';
@@ -58,7 +58,7 @@ DATE'0000-00-00'=''
Warnings:
Warning 1292 Incorrect datetime value: ''
CREATE TABLE t1 (a ENUM('a'), b DATE, c INT, KEY(b)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES ('','0000-00-00',0);
+INSERT IGNORE INTO t1 VALUES ('','0000-00-00',0);
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
SELECT * FROM t1 WHERE b='';
@@ -109,7 +109,7 @@ TIMESTAMP'0000-00-00 00:00:00'=''
Warnings:
Warning 1292 Incorrect datetime value: ''
CREATE TABLE t1 (a ENUM('a'), b DATETIME, c INT, KEY(b)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES ('','0000-00-00 00:00:00',0);
+INSERT IGNORE INTO t1 VALUES ('','0000-00-00 00:00:00',0);
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
SELECT * FROM t1 WHERE b='';
@@ -154,3 +154,9 @@ SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b;
Warnings:
Warning 1292 Incorrect datetime value: ''
DROP TABLE t1;
+CREATE TABLE t1 (d DATE) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('2012-12-21');
+SELECT * FROM t1 WHERE LEAST( UTC_TIME(), d );
+d
+2012-12-21
+DROP TABLE t1;
diff --git a/mysql-test/r/type_temporal_mysql56.result b/mysql-test/r/type_temporal_mysql56.result
index b0c81844781..cdc951dac14 100644
--- a/mysql-test/r/type_temporal_mysql56.result
+++ b/mysql-test/r/type_temporal_mysql56.result
@@ -63,7 +63,7 @@ SET TIME_ZONE='+00:00';
SHOW CREATE TABLE mysql56timestamp;
Table Create Table
mysql56timestamp CREATE TABLE `mysql56timestamp` (
- `ts0` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `ts0` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`ts1` timestamp(1) NOT NULL DEFAULT '0000-00-00 00:00:00.0',
`ts2` timestamp(2) NOT NULL DEFAULT '0000-00-00 00:00:00.00',
`ts3` timestamp(3) NOT NULL DEFAULT '0000-00-00 00:00:00.000',
diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result
index fc287e86fbd..06da656c7cb 100644
--- a/mysql-test/r/type_time.result
+++ b/mysql-test/r/type_time.result
@@ -25,7 +25,7 @@ t
12:30:00
12:30:35
36:30:31
-insert into t1 values("10.22.22"),(1234567),(123456789),(123456789.10),("10 22:22"),("12.45a");
+insert ignore into t1 values("10.22.22"),(1234567),(123456789),(123456789.10),("10 22:22"),("12.45a");
Warnings:
Warning 1265 Data truncated for column 't' at row 1
Warning 1265 Data truncated for column 't' at row 2
@@ -322,7 +322,7 @@ CREATE TABLE t1 (a TIME(6));
INSERT INTO t1 VALUES (CAST(0xFFFFFFFF00000000 AS UNSIGNED));
ERROR 22007: Incorrect time value: '18446744069414584320' for column 'a' at row 1
SET sql_mode=DEFAULT;
-INSERT INTO t1 VALUES (CAST(0xFFFFFFFF00000000 AS UNSIGNED));
+INSERT IGNORE INTO t1 VALUES (CAST(0xFFFFFFFF00000000 AS UNSIGNED));
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
SELECT * FROM t1;
@@ -417,14 +417,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Warning 1292 Truncated incorrect time value: '00:00:00x'
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00x';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Warning 1292 Truncated incorrect time value: '00:00:00x'
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (<cache>(length(TIME'00:00:00')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and <cache>(length(TIME'00:00:00')) = 30 + rand()
DROP TABLE t1;
# Trailing fractional digits in string literals
CREATE TABLE t1 (a TIME);
@@ -441,13 +441,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00.000000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00.000000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (<cache>(length(TIME'00:00:00')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and <cache>(length(TIME'00:00:00')) = 30 + rand()
DROP TABLE t1;
# Trailing fractional digits in temporal literals
CREATE TABLE t1 (a TIME);
@@ -464,13 +464,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00.000000')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00.000000'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00.000000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00.000000') and (<cache>(length(TIME'00:00:00')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00.000000' and <cache>(length(TIME'00:00:00')) = 30 + rand()
DROP TABLE t1;
# Trailing fractional digits in temporal literals, same precision
CREATE TABLE t1 (a TIME(6));
@@ -490,7 +490,7 @@ SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00.000000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00.000000') and (<cache>(length(TIME'00:00:00.000000')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00.000000' and <cache>(length(TIME'00:00:00.000000')) = 30 + rand()
DROP TABLE t1;
# Leading spaces in string literals
CREATE TABLE t1 (a TIME);
@@ -507,13 +507,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=' 00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' 00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (<cache>(length(TIME'00:00:00')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and <cache>(length(TIME'00:00:00')) = 30 + rand()
DROP TABLE t1;
# Numeric format in string literals
CREATE TABLE t1 (a TIME);
@@ -530,13 +530,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='000000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='000000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (<cache>(length(TIME'00:00:00')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and <cache>(length(TIME'00:00:00')) = 30 + rand()
DROP TABLE t1;
#
# MDEV-8766 Wrong result for SELECT..WHERE LENGTH(time_column)=8 AND time_column=TIMESTAMP'2001-01-01 10:20:31'
@@ -559,13 +559,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31') and (<cache>(length(TIME'10:20:31')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31' and <cache>(length(TIME'10:20:31')) = 30 + rand()
DROP TABLE t1;
# TIMESTAMP literal with a bigger scale and fractional second truncation
# Ok to propagate with precision truncation
@@ -583,13 +583,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31.123000')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.123';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123000') and (<cache>(length(TIME'10:20:31')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000' and <cache>(length(TIME'10:20:31')) = 30 + rand()
DROP TABLE t1;
# TIMESTAMP literal with a bigger scale and no fractional second truncation
# Ok to propagate
@@ -609,13 +609,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31') and (<cache>(length(TIME'10:20:31')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31' and <cache>(length(TIME'10:20:31')) = 30 + rand()
DROP TABLE t1;
# TIMESTAMP literal with a smaller scale
# Ok to propagate
@@ -638,7 +638,7 @@ SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.1
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123000') and (<cache>(length(TIME'10:20:31.123000')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000' and <cache>(length(TIME'10:20:31.123000')) = 30 + rand()
DROP TABLE t1;
# TIME literal with a bigger scale and fractional second truncation
# Ok to propagate with precision truncation
@@ -656,13 +656,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31.123')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.123';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123') and (<cache>(length(TIME'10:20:31')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123' and <cache>(length(TIME'10:20:31')) = 30 + rand()
DROP TABLE t1;
# TIME literal with a bigger scale and no fractional second truncation
# Ok to propagate
@@ -682,13 +682,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31.000')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.000'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.000') and (<cache>(length(TIME'10:20:31')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.000' and <cache>(length(TIME'10:20:31')) = 30 + rand()
DROP TABLE t1;
# TIME literal with a smaller scale
# Ok to propagate
@@ -711,7 +711,7 @@ SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.123';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123') and (<cache>(length(TIME'10:20:31.123000')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123' and <cache>(length(TIME'10:20:31.123000')) = 30 + rand()
DROP TABLE t1;
# TIME-alike string literal with a bigger scale and fractional second truncation
# Ok to propagate with precision truncation
@@ -729,13 +729,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31.123000')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.123';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123000') and (<cache>(length(TIME'10:20:31')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000' and <cache>(length(TIME'10:20:31')) = 30 + rand()
DROP TABLE t1;
# TIME-alike string literal with a bigger scale and no fractional second truncation
# Ok to propagate
@@ -755,13 +755,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31') and (<cache>(length(TIME'10:20:31')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31' and <cache>(length(TIME'10:20:31')) = 30 + rand()
DROP TABLE t1;
# TIME-alike string literal with a smaller scale
# Ok to propagate
@@ -784,7 +784,7 @@ SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.123';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123000') and (<cache>(length(TIME'10:20:31.123000')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000' and <cache>(length(TIME'10:20:31.123000')) = 30 + rand()
DROP TABLE t1;
SET timestamp=DEFAULT;
SET @@old_mode=zero_date_time_cast;
@@ -815,14 +815,14 @@ SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=8;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:30')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:30'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=30+RAND();
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:30') and (<cache>(length(TIME'10:20:30')) = (30 + rand())))
-# Old mode, TIMESTAMP literal, zon-zero YYYYMMDD, no propagation
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:30' and <cache>(length(TIME'10:20:30')) = 30 + rand()
+# Old mode, TIMESTAMP literal, non-zero YYYYMMDD, no propagation
SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30';
a
34:20:30
@@ -834,13 +834,13 @@ SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=8;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'0000-00-01 10:20:30') and (length(`test`.`t1`.`a`) = 8))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'0000-00-01 10:20:30' and length(`test`.`t1`.`a`) = 8
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=30+RAND();
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'0000-00-01 10:20:30') and (length(`test`.`t1`.`a`) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'0000-00-01 10:20:30' and length(`test`.`t1`.`a`) = 30 + rand()
# Old mode, TIMESTAMP-alike string literal, zero YYYYMMDD, Ok to propagate
SELECT * FROM t1 WHERE a='0000-00-00 10:20:30';
a
@@ -853,14 +853,14 @@ SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=8;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:30')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:30'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=30+RAND();
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:30') and (<cache>(length(TIME'10:20:30')) = (30 + rand())))
-# Old mode, TIMESTAMP-alike literal, zon-zero YYYYMMDD, no propagation
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:30' and <cache>(length(TIME'10:20:30')) = 30 + rand()
+# Old mode, TIMESTAMP-alike literal, non-zero YYYYMMDD, no propagation
SELECT * FROM t1 WHERE a='0000-00-01 10:20:30';
a
34:20:30
@@ -872,13 +872,13 @@ SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '0000-00-01 10:20:30') and (length(`test`.`t1`.`a`) = 8))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '0000-00-01 10:20:30' and length(`test`.`t1`.`a`) = 8
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=30+RAND();
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '0000-00-01 10:20:30') and (length(`test`.`t1`.`a`) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '0000-00-01 10:20:30' and length(`test`.`t1`.`a`) = 30 + rand()
DROP TABLE t1;
SET @@old_mode=DEFAULT;
#
@@ -904,7 +904,7 @@ SELECT * FROM t1 WHERE a>=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00'
DROP TABLE t1;
SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
CREATE TABLE t1 (a TIME);
@@ -917,19 +917,19 @@ SELECT * FROM t1 WHERE DATE(a)<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'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';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (timestamp('2015-08-08',(TIME'00:00:00' + rand())) <= TIMESTAMP'2015-08-30 00:00:00.1'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and timestamp('2015-08-08',TIME'00:00:00' + rand()) <= TIMESTAMP'2015-08-30 00:00:00.1'
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';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00.100000') and (timestamp('2015-08-08',(TIME'00:00:00' + rand())) <= TIMESTAMP'2015-08-30 00:00:00.1'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00.100000' and timestamp('2015-08-08',TIME'00:00:00' + rand()) <= TIMESTAMP'2015-08-30 00:00:00.1'
DROP TABLE t1;
SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
CREATE TABLE t1 (a TIME);
@@ -942,19 +942,19 @@ SELECT * FROM t1 WHERE DATE(a)<=DATE'2015-08-30' AND a='00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=DATE'2015-08-30' AND a='00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (timestamp('2015-08-08',(TIME'00:00:00' + rand())) <= DATE'2015-08-30'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and timestamp('2015-08-08',TIME'00:00:00' + rand()) <= DATE'2015-08-30'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=DATE'2015-08-30' AND a='00:00:00.1';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00.100000') and (timestamp('2015-08-08',(TIME'00:00:00' + rand())) <= DATE'2015-08-30'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00.100000' and timestamp('2015-08-08',TIME'00:00:00' + rand()) <= DATE'2015-08-30'
DROP TABLE t1;
SET timestamp=DEFAULT;
#
@@ -966,7 +966,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:01' AND COALESCE(
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = TIME'00:00:01')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = TIME'00:00:01'
DROP TABLE t1;
#
# MDEV-8793 Wrong result set for SELECT ... WHERE COALESCE(time_column)=TIME('00:00:00') AND COALESCE(time_column)=DATE('2015-09-11')
@@ -989,7 +989,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE('2015-0
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = 00:00:00)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '00:00:00'
# TIME cast + DATE literal
SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE'2015-09-11';
a
@@ -999,7 +999,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE'2015-09
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = 00:00:00)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '00:00:00'
# TIME literal + DATE cast
SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE('2015-09-11');
a
@@ -1009,7 +1009,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE('2015-09-
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = TIME'00:00:00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = TIME'00:00:00'
# TIME literal + DATE literal
SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE'2015-09-11';
a
@@ -1019,7 +1019,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE'2015-09-1
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = TIME'00:00:00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = TIME'00:00:00'
# TIME-alike string literal + DATE cast
SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE('2015-09-11');
a
@@ -1029,7 +1029,7 @@ SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE('2015-09-11')
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = '00:00:00') and (coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '00:00:00' and coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00'
# TIME-alike string literal + DATE literal
SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE'2015-09-11';
a
@@ -1039,7 +1039,7 @@ SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE'2015-09-11';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = '00:00:00') and (coalesce(`test`.`t1`.`a`) = DATE'2015-09-11'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '00:00:00' and coalesce(`test`.`t1`.`a`) = DATE'2015-09-11'
# TIME-alike integer literal + DATE cast
SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE('2015-09-11');
a
@@ -1049,7 +1049,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE('2015-09-11');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 0) and (coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 0 and coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00'
# TIME-alike integer literal + DATE literal
SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE'2015-09-11';
a
@@ -1059,7 +1059,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE'2015-09-11';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 0) and (coalesce(`test`.`t1`.`a`) = DATE'2015-09-11'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 0 and coalesce(`test`.`t1`.`a`) = DATE'2015-09-11'
# DATE cast + TIME cast
SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME('00:00:00');
a
@@ -1069,7 +1069,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME('00:0
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00'
# DATE cast + TIME literal
SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME'00:00:00';
a
@@ -1079,7 +1079,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME'00:00
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00'
# DATE cast + TIME-alike string literal
SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)='00:00:00';
a
@@ -1089,7 +1089,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)='00:00:00'
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00) and (coalesce(`test`.`t1`.`a`) = '00:00:00'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00' and coalesce(`test`.`t1`.`a`) = '00:00:00'
# DATE cast + TIME-alike integer literal
SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=0;
a
@@ -1099,7 +1099,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00) and (coalesce(`test`.`t1`.`a`) = 0))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00' and coalesce(`test`.`t1`.`a`) = 0
# DATE literal + TIME cast
SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME('00:00:00');
a
@@ -1109,7 +1109,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME('00:00:
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = DATE'2015-09-11')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = DATE'2015-09-11'
# DATE literal + TIME literal
SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME'00:00:00';
a
@@ -1119,7 +1119,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME'00:00:0
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = DATE'2015-09-11')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = DATE'2015-09-11'
# DATE literal + TIME-alike string literal
SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)='00:00:00';
a
@@ -1129,7 +1129,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)='00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = DATE'2015-09-11') and (coalesce(`test`.`t1`.`a`) = '00:00:00'))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = DATE'2015-09-11' and coalesce(`test`.`t1`.`a`) = '00:00:00'
# DATE literal + TIME-alike integer literal
SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=0;
a
@@ -1139,7 +1139,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = DATE'2015-09-11') and (coalesce(`test`.`t1`.`a`) = 0))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = DATE'2015-09-11' and coalesce(`test`.`t1`.`a`) = 0
DROP TABLE t1;
SET timestamp=DEFAULT;
#
@@ -1232,7 +1232,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '0000-00-01 10:20:30') and (length(`test`.`t1`.`a`) = 8))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '0000-00-01 10:20:30' and length(`test`.`t1`.`a`) = 8
SET @@optimizer_use_condition_selectivity=4;
SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
a
@@ -1241,10 +1241,54 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '0000-00-01 10:20:30') and (length(`test`.`t1`.`a`) = 8))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '0000-00-01 10:20:30' and length(`test`.`t1`.`a`) = 8
drop table t1;
SET @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
set @@old_mode= @save_old_mode;
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9393 Split Copy_field::get_copy_func() into virtual methods in Field
+#
+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;
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 2
+Warning 1265 Data truncated for column 'b' at row 6
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
+ALTER TABLE t1 MODIFY c TIME;
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 2
+Warning 1265 Data truncated for column 'c' at row 6
+SELECT * FROM t1;
+a b c
+0000 00:00:00 00:00:00
+1999 00:00:00 00:00:00
+2000 00:20:00 00:20:00
+2030 00:20:30 00:20:30
+2050 00:20:50 00:20:50
+2070 00:00:00 00:00:00
+DROP TABLE t1,t2;
+#
+# MDEV-10817 CAST(MAX(DATE'2001-01-01') AS TIME) returns a wrong result
+#
+SELECT CAST(DATE'2001-01-01' AS TIME);
+CAST(DATE'2001-01-01' AS TIME)
+00:00:00
+SELECT CAST(MAX(DATE'2001-01-01') AS TIME);
+CAST(MAX(DATE'2001-01-01') AS TIME)
+00:00:00
+CREATE FUNCTION f1() RETURNS DATE RETURN DATE'2001-01-01';
+SELECT CAST(f1() AS TIME);
+CAST(f1() AS TIME)
+00:00:00
+DROP FUNCTION f1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/type_time_6065.result b/mysql-test/r/type_time_6065.result
index 067fe9b89fc..56de96870b6 100644
--- a/mysql-test/r/type_time_6065.result
+++ b/mysql-test/r/type_time_6065.result
@@ -12,7 +12,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -33,7 +33,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -54,7 +54,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
1 SIMPLE t2 ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -75,7 +75,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
1 SIMPLE t2 ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -96,7 +96,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -117,7 +117,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -138,7 +138,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using where; Using index
1 SIMPLE t2 ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -159,7 +159,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using where; Using index
1 SIMPLE t2 ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -180,7 +180,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -201,7 +201,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -222,7 +222,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where
1 SIMPLE t1 ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -243,7 +243,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where
1 SIMPLE t1 ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -264,7 +264,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -285,7 +285,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -306,7 +306,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using where; Using index
1 SIMPLE t1 ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -327,7 +327,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using where; Using index
1 SIMPLE t1 ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -348,7 +348,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -379,7 +379,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -410,7 +410,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -441,7 +441,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -472,7 +472,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -503,7 +503,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -534,7 +534,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -565,7 +565,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -596,7 +596,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -627,7 +627,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -658,7 +658,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -689,7 +689,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -720,7 +720,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -751,7 +751,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -782,7 +782,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -813,7 +813,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -844,7 +844,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -870,7 +870,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -896,7 +896,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -922,7 +922,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -948,7 +948,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -974,7 +974,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1000,7 +1000,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1026,7 +1026,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1052,7 +1052,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -1078,7 +1078,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -1104,7 +1104,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -1130,7 +1130,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -1156,7 +1156,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -1182,7 +1182,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -1208,7 +1208,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -1234,7 +1234,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -1260,7 +1260,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1291,7 +1291,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1322,7 +1322,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1353,7 +1353,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1384,7 +1384,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1415,7 +1415,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1446,7 +1446,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1477,7 +1477,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1508,7 +1508,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -1539,7 +1539,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -1570,7 +1570,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -1601,7 +1601,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -1632,7 +1632,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -1663,7 +1663,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -1694,7 +1694,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -1725,7 +1725,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -1756,7 +1756,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1782,7 +1782,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1808,7 +1808,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1834,7 +1834,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`
SELECT * FROM
t1 ignore INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1860,7 +1860,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1886,7 +1886,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1912,7 +1912,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1938,7 +1938,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index
1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`
SELECT * FROM
t1 force INDEX (col_time_key)
STRAIGHT_JOIN
@@ -1964,7 +1964,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -1990,7 +1990,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -2016,7 +2016,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -2042,7 +2042,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00
1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`
SELECT * FROM
t2 ignore INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -2068,7 +2068,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -2094,7 +2094,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -2120,7 +2120,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -2146,7 +2146,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index
1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1)
Warnings:
-Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`)
+Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`
SELECT * FROM
t2 force INDEX (col_datetime_key)
STRAIGHT_JOIN
@@ -2198,7 +2198,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system col_datetime_key NULL NULL NULL 1 100.00
1 SIMPLE t3 index col_time_key col_time_key 4 NULL 20 100.00 Using where; Using index
Warnings:
-Note 1003 select 1 AS `col_int_nokey`,'2001-11-04 19:07:55' AS `col_datetime_key`,'k' AS `col_varchar_key`,`test`.`t3`.`col_time_key` AS `col_time_key` from `test`.`t3` FORCE INDEX (`col_time_key`) where (`test`.`t3`.`col_time_key` > '2001-11-04 19:07:55')
+Note 1003 select 1 AS `col_int_nokey`,'2001-11-04 19:07:55' AS `col_datetime_key`,'k' AS `col_varchar_key`,`test`.`t3`.`col_time_key` AS `col_time_key` from `test`.`t3` FORCE INDEX (`col_time_key`) where `test`.`t3`.`col_time_key` > '2001-11-04 19:07:55'
SELECT * FROM t2 STRAIGHT_JOIN t3 FORCE INDEX (col_time_key)
ON t3.col_time_key > t2.col_datetime_key;
col_int_nokey col_datetime_key col_varchar_key col_time_key
@@ -2228,7 +2228,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system col_datetime_key NULL NULL NULL 1 100.00
1 SIMPLE t3 ALL NULL NULL NULL NULL 20 100.00 Using where
Warnings:
-Note 1003 select 1 AS `col_int_nokey`,'2001-11-04 19:07:55' AS `col_datetime_key`,'k' AS `col_varchar_key`,`test`.`t3`.`col_time_key` AS `col_time_key` from `test`.`t3` IGNORE INDEX (`col_time_key`) where (`test`.`t3`.`col_time_key` > '2001-11-04 19:07:55')
+Note 1003 select 1 AS `col_int_nokey`,'2001-11-04 19:07:55' AS `col_datetime_key`,'k' AS `col_varchar_key`,`test`.`t3`.`col_time_key` AS `col_time_key` from `test`.`t3` IGNORE INDEX (`col_time_key`) where `test`.`t3`.`col_time_key` > '2001-11-04 19:07:55'
SELECT * FROM t2 STRAIGHT_JOIN t3 IGNORE INDEX (col_time_key)
ON t3.col_time_key > t2.col_datetime_key;
col_int_nokey col_datetime_key col_varchar_key col_time_key
@@ -2271,7 +2271,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY outr2 index col_time_key col_time_key 4 NULL 20 100.00 Using where; Using index; Using join buffer (flat, BNL join)
2 MATERIALIZED innr ref col_int_key col_int_key 4 const 2 100.00 Using where
Warnings:
-Note 1003 select 1 AS `col_int_nokey` from `test`.`t3` `outr2` semi join (`test`.`t1` `innr`) where ((`test`.`innr`.`col_int_key` = 1) and (`test`.`innr`.`pk` >= `test`.`innr`.`col_int_nokey`) and (`test`.`outr2`.`col_time_key` > '2001-11-04 19:07:55'))
+Note 1003 select 1 AS `col_int_nokey` from `test`.`t3` `outr2` semi join (`test`.`t1` `innr`) where `test`.`innr`.`col_int_key` = 1 and `test`.`innr`.`pk` >= `test`.`innr`.`col_int_nokey` and `test`.`outr2`.`col_time_key` > '2001-11-04 19:07:55'
SELECT outr.col_int_nokey
FROM t2 as outr
STRAIGHT_JOIN t3 AS outr2
diff --git a/mysql-test/r/type_time_hires.result b/mysql-test/r/type_time_hires.result
index 2620dac0794..a9345a7e83f 100644
--- a/mysql-test/r/type_time_hires.result
+++ b/mysql-test/r/type_time_hires.result
@@ -1,7 +1,7 @@
SET timestamp=UNIX_TIMESTAMP('2001-02-03 10:20:30');
drop table if exists t1, t2, t3;
create table t1 (a time(7));
-ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6.
+ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6
create table t1 (a time(3), key(a));
insert t1 values ('2010-12-11 00:20:03.1234');
Warnings:
@@ -15,7 +15,7 @@ Note 1265 Data truncated for column 'a' at row 1
insert t1 values (20101211030405.789e0);
Warnings:
Note 1265 Data truncated for column 'a' at row 1
-insert t1 values (99991231235959e1);
+insert ignore t1 values (99991231235959e1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1;
@@ -105,7 +105,7 @@ a a + interval 2 year
01:02:13.3332 NULL
Warnings:
Warning 1441 Datetime function: time field overflow
-insert t1 select a + interval 2 year from t1;
+insert ignore t1 select a + interval 2 year from t1;
Warnings:
Warning 1441 Datetime function: time field overflow
select * from t1;
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index 69c9f68811d..20523dc1791 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -138,7 +138,7 @@ ix+0
0
0
truncate table t1;
-insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
+insert ignore into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
Warnings:
Warning 1265 Data truncated for column 'ix' at row 1
Warning 1265 Data truncated for column 'ix' at row 2
@@ -195,13 +195,13 @@ t1 t2 t3
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `t1` timestamp NOT NULL DEFAULT current_timestamp(),
`t2` datetime DEFAULT NULL,
`t3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
-t1 timestamp NO CURRENT_TIMESTAMP
+t1 timestamp NO current_timestamp()
t2 datetime YES NULL
t3 timestamp NO 0000-00-00 00:00:00
drop table t1;
@@ -222,12 +222,12 @@ t1 t2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `t1` timestamp NOT NULL DEFAULT '2003-01-01 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `t1` timestamp NOT NULL DEFAULT '2003-01-01 00:00:00' ON UPDATE current_timestamp(),
`t2` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
-t1 timestamp NO 2003-01-01 00:00:00 on update CURRENT_TIMESTAMP
+t1 timestamp NO 2003-01-01 00:00:00 on update current_timestamp()
t2 datetime YES NULL
drop table t1;
create table t1 (t1 timestamp not null default now() on update now(), t2 datetime);
@@ -247,12 +247,12 @@ t1 t2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `t1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`t2` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
-t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
+t1 timestamp NO current_timestamp() on update current_timestamp()
t2 datetime YES NULL
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');
@@ -272,13 +272,13 @@ t1 t2 t3
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `t1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`t2` datetime DEFAULT NULL,
`t3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
-t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
+t1 timestamp NO current_timestamp() on update current_timestamp()
t2 datetime YES NULL
t3 timestamp NO 0000-00-00 00:00:00
drop table t1;
@@ -299,12 +299,12 @@ t1 t2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `t1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`t2` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
-t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
+t1 timestamp NO current_timestamp() on update current_timestamp()
t2 datetime YES NULL
truncate table t1;
insert into t1 values ('2004-04-01 00:00:00', '2004-04-01 00:00:00');
@@ -369,7 +369,7 @@ create table t1 (a timestamp null default current_timestamp on update current_ti
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `a` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`b` timestamp NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (NULL, NULL);
@@ -710,12 +710,12 @@ CREATE TABLE t2 AS SELECT * from t1 LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+ `ts` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+ `ts` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2;
SET sql_mode=DEFAULT;
@@ -731,13 +731,13 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`vc` varchar(10) NOT NULL DEFAULT 'test',
- `ts` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
+ `ts` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`vc` varchar(10) NOT NULL DEFAULT 'test',
- `ts` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
+ `ts` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2;
End of 10.0 tests
@@ -833,14 +833,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x'
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)!=30+RAND() AND a='2001-01-01 00:00:00x';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x'
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00')) <> (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and <cache>(length(TIMESTAMP'2001-01-01 00:00:00')) <> 30 + rand()
DROP TABLE t1;
CREATE TABLE t1 (a TIMESTAMP);;
INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01');
@@ -856,20 +856,20 @@ SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=' 2001-01-01 00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=19+RAND() AND a=' 2001-01-01 00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = (19 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and <cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = 19 + rand()
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' garbage ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Warning 1292 Incorrect datetime value: ' garbage '
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'0000-00-00 00:00:00') and (<cache>(length(TIMESTAMP'0000-00-00 00:00:00')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'0000-00-00 00:00:00' and <cache>(length(TIMESTAMP'0000-00-00 00:00:00')) = 30 + rand()
DROP TABLE t1;
CREATE TABLE t1 (a TIMESTAMP);;
INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01');
@@ -888,13 +888,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIMESTAMP'2001-01-01 00:00:00.000000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 00:00:00.000000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = (30 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' and <cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = 30 + rand()
DROP TABLE t1;
CREATE TABLE t1 (a TIMESTAMP(6));;
INSERT INTO t1 VALUES ('2001-01-01 00:00:00.000000'),('2001-01-01 00:00:01.000000');
@@ -913,13 +913,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=26 AND a=TIMESTAMP'2001-01-01 00:00:00.000000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIMESTAMP'2001-01-01 00:00:00.000000';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00.000000')) = (40 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' and <cache>(length(TIMESTAMP'2001-01-01 00:00:00.000000')) = 40 + rand()
DROP TABLE t1;
SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
CREATE TABLE t1 (a TIMESTAMP);;
@@ -939,13 +939,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIME'00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00')
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00'
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIME'00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = (40 + rand())))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and <cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = 40 + rand()
DROP TABLE t1;
#
# End of 10.1 tests
diff --git a/mysql-test/r/type_timestamp_hires.result b/mysql-test/r/type_timestamp_hires.result
index 573ebbeb709..7179277aa9a 100644
--- a/mysql-test/r/type_timestamp_hires.result
+++ b/mysql-test/r/type_timestamp_hires.result
@@ -1,13 +1,13 @@
SET timestamp=UNIX_TIMESTAMP('2001-02-03 10:20:30');
drop table if exists t1, t2, t3;
create table t1 (a timestamp(7));
-ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6.
+ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6
create table t1 (a timestamp(3), key(a));
insert t1 values ('2010-12-11 00:20:03.1234');
insert t1 values ('2010-12-11 15:47:11.1234');
insert t1 values (20101211010203.45678);
insert t1 values (20101211030405.789e0);
-insert t1 values (99991231235959e1);
+insert ignore t1 values (99991231235959e1);
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1;
@@ -64,15 +64,15 @@ a
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4)
+ `a` timestamp(4) NOT NULL DEFAULT current_timestamp(4) ON UPDATE current_timestamp(4)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
show columns from t1;
Field Type Null Key Default Extra
-a timestamp(4) NO CURRENT_TIMESTAMP(4) on update CURRENT_TIMESTAMP
+a timestamp(4) NO current_timestamp(4) on update current_timestamp(4)
select table_name, column_name, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, datetime_precision, character_set_name, collation_name, column_type, column_key, extra from information_schema.columns where table_name='t1';
table_name t1
column_name a
-column_default CURRENT_TIMESTAMP(4)
+column_default current_timestamp(4)
is_nullable NO
data_type timestamp
character_maximum_length NULL
@@ -84,7 +84,7 @@ character_set_name NULL
collation_name NULL
column_type timestamp(4)
column_key
-extra on update CURRENT_TIMESTAMP
+extra on update current_timestamp(4)
select a, a+interval 9876543 microsecond from t1;
a a+interval 9876543 microsecond
2010-12-11 01:02:03.4567 2010-12-11 01:02:13.333243
@@ -95,7 +95,7 @@ a
select a, a + interval 2 year from t1;
a a + interval 2 year
2010-12-11 01:02:13.3332 2012-12-11 01:02:13.3332
-insert t1 select a + interval 2 year from t1;
+insert ignore t1 select a + interval 2 year from t1;
select * from t1;
a
2010-12-11 01:02:13.3332
@@ -109,12 +109,12 @@ create table t3 like t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4)
+ `a` timestamp(4) NOT NULL DEFAULT current_timestamp(4) ON UPDATE current_timestamp(4)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4)
+ `a` timestamp(4) NOT NULL DEFAULT current_timestamp(4) ON UPDATE current_timestamp(4)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2, t3;
insert t1 values ('2010-12-13 14:15:16.222222');
@@ -130,7 +130,7 @@ create table t3 select max(a), min(a), sum(a), avg(a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4),
+ `a` timestamp(4) NOT NULL DEFAULT current_timestamp(4) ON UPDATE current_timestamp(4),
`a+0` decimal(25,4) NOT NULL,
`a-1` decimal(25,4) NOT NULL,
`a*1` decimal(25,4) NOT NULL,
@@ -272,23 +272,64 @@ select * from t1;
a
2011-01-01 01:01:01.12345
drop table t1;
-create table t1 (a timestamp(5) default current_timestamp);
-drop table t1;
-create table t1 (a timestamp(5) default current_timestamp());
-drop table t1;
-create table t1 (a timestamp(5) default current_timestamp(2));
-ERROR 42000: Invalid default value for 'a'
-create table t1 (a timestamp(5) default current_timestamp(5));
-drop table t1;
-create table t1 (a timestamp(5) default current_timestamp(6));
-drop table t1;
-create table t1 (a timestamp(5) on update current_timestamp);
-drop table t1;
-create table t1 (a timestamp(5) on update current_timestamp());
-drop table t1;
-create table t1 (a timestamp(5) on update current_timestamp(3));
+create or replace table t1 (a timestamp(5) default current_timestamp);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp(5) NOT NULL DEFAULT current_timestamp(5)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 (a timestamp(5) default current_timestamp());
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp(5) NOT NULL DEFAULT current_timestamp(5)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 (a timestamp(5) default current_timestamp(2));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp(5) NOT NULL DEFAULT current_timestamp(2)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert t1 () values ();
+select * from t1;
+a
+2011-01-01 01:01:01.12000
+create or replace table t1 (a timestamp(5) default current_timestamp(5));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp(5) NOT NULL DEFAULT current_timestamp(5)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 (a timestamp(5) default current_timestamp(6));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp(5) NOT NULL DEFAULT current_timestamp(5)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 (a timestamp(5) on update current_timestamp);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE current_timestamp(5)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 (a timestamp(5) on update current_timestamp());
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE current_timestamp(5)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 (a timestamp(5) on update current_timestamp(3));
ERROR HY000: Invalid ON UPDATE clause for 'a' column
-create table t1 (a timestamp(5) on update current_timestamp(5));
-drop table t1;
-create table t1 (a timestamp(5) on update current_timestamp(6));
+create or replace table t1 (a timestamp(5) on update current_timestamp(5));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE current_timestamp(5)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 (a timestamp(5) on update current_timestamp(6));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE current_timestamp(5)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
diff --git a/mysql-test/r/type_uint.result b/mysql-test/r/type_uint.result
index c970f2ff896..ef7a7ed98ca 100644
--- a/mysql-test/r/type_uint.result
+++ b/mysql-test/r/type_uint.result
@@ -2,10 +2,10 @@ drop table if exists t1;
SET SQL_WARNINGS=1;
create table t1 (this int unsigned);
insert into t1 values (1);
-insert into t1 values (-1);
+insert ignore into t1 values (-1);
Warnings:
Warning 1264 Out of range value for column 'this' at row 1
-insert into t1 values ('5000000000');
+insert ignore into t1 values ('5000000000');
Warnings:
Warning 1264 Out of range value for column 'this' at row 1
select * from t1;
diff --git a/mysql-test/r/type_varchar.result b/mysql-test/r/type_varchar.result
index 882b7f55102..0b2a5b54d08 100644
--- a/mysql-test/r/type_varchar.result
+++ b/mysql-test/r/type_varchar.result
@@ -7,7 +7,7 @@ t1 CREATE TABLE `t1` (
`v` varchar(30) DEFAULT NULL,
`c` char(3) DEFAULT NULL,
`e` enum('abc','def','ghi') DEFAULT NULL,
- `t` text
+ `t` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table vchar;
Table Create Table
@@ -15,7 +15,7 @@ vchar CREATE TABLE `vchar` (
`v` varchar(30) DEFAULT NULL,
`c` char(3) DEFAULT NULL,
`e` enum('abc','def','ghi') DEFAULT NULL,
- `t` text
+ `t` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('abc', 'de', 'ghi', 'jkl');
insert into t1 values ('abc ', 'de ', 'ghi', 'jkl ');
@@ -40,7 +40,7 @@ vchar CREATE TABLE `vchar` (
`v` varchar(30) DEFAULT NULL,
`c` char(3) DEFAULT NULL,
`e` enum('abc','def','ghi') DEFAULT NULL,
- `t` text,
+ `t` text DEFAULT NULL,
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select length(v),length(c),length(e),length(t) from vchar;
@@ -411,7 +411,7 @@ alter table t1 modify f1 tinytext;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f1` tinytext,
+ `f1` tinytext DEFAULT NULL,
KEY `index1` (`f1`(10))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -515,6 +515,7 @@ DROP TABLE t1;
#
# MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535
#
+set sql_mode='';
CREATE TABLE t1 (c1 VARBINARY(65532));
DESCRIBE t1;
Field Type Null Key Default Extra
@@ -581,6 +582,9 @@ DESCRIBE t1;
Field Type Null Key Default Extra
c1 mediumtext YES NULL
DROP TABLE t1;
+set sql_mode=default;
+CREATE TABLE t1 (c1 VARCHAR(65536));
+ERROR 42000: Column length too big for column 'c1' (max = 65532); use BLOB or TEXT instead
#
# End of 5.5 tests
#
diff --git a/mysql-test/r/type_year.result b/mysql-test/r/type_year.result
index 204cec2cc66..8d58659769e 100644
--- a/mysql-test/r/type_year.result
+++ b/mysql-test/r/type_year.result
@@ -29,7 +29,7 @@ y y2
2069 69
drop table t1;
create table t1 (y year);
-insert into t1 values (now());
+insert ignore into t1 values (now());
Warnings:
Warning 1265 Data truncated for column 'y' at row 1
select if(y = now(), 1, 0) from t1;
@@ -316,7 +316,7 @@ DROP TABLE t2, t4;
# Bug #49910: Behavioural change in SELECT/WHERE on YEAR(4) data type
#
CREATE TABLE t1 (y YEAR NOT NULL, s VARCHAR(4));
-INSERT INTO t1 (s) VALUES ('bad');
+INSERT IGNORE INTO t1 (s) VALUES ('bad');
Warnings:
Warning 1364 Field 'y' doesn't have a default value
INSERT INTO t1 (y, s) VALUES (0, 0), (2000, 2000), (2001, 2001);
@@ -410,7 +410,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=2010;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010
SELECT * FROM t1 WHERE a=2010 AND a>=10;
a
2010
@@ -418,7 +418,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010
SELECT * FROM t1 WHERE a=10 AND a>=2010;
a
2010
@@ -426,7 +426,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND a>=2010;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010
SELECT * FROM t1 WHERE a=10 AND a>=10;
a
2010
@@ -434,8 +434,55 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND a>=10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010
DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-9392 Copying from DECIMAL to YEAR is not consistent about warnings
+#
+CREATE TABLE t1 (a YEAR);
+INSERT IGNORE INTO t1 VALUES (-0.1);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 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;
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+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;
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a YEAR);
+INSERT IGNORE INTO t1 VALUES (-0.1e0);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+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;
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+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;
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result
index bcfc9941db9..98aa2b50fc6 100644
--- a/mysql-test/r/udf.result
+++ b/mysql-test/r/udf.result
@@ -440,8 +440,28 @@ EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE f1=1 + myfunc_double(1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`f1` = <cache>((1 + myfunc_double(1 AS `1`))))
+Note 1003 select 1 AS `1` from `test`.`t1` where `test`.`t1`.`f1` = <cache>(1 + myfunc_double(1 AS `1`))
DROP FUNCTION myfunc_double;
DROP TABLE t1;
#
End of 5.1 tests.
+#
+# MDEV-10134 Add full support for DEFAULT
+#
+CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
+SELECT METAPHON('Hello');
+METAPHON('Hello')
+HL
+CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10) DEFAULT METAPHON(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(10) DEFAULT metaphon(`a` AS `a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (a) VALUES ('Hello');
+SELECT * FROM t1;
+a b
+Hello HL
+DROP FUNCTION METAPHON;
+DROP TABLE t1;
diff --git a/mysql-test/r/udf_debug_sync.result b/mysql-test/r/udf_debug_sync.result
index 2db75f9aa76..8ce6dbdd5c0 100644
--- a/mysql-test/r/udf_debug_sync.result
+++ b/mysql-test/r/udf_debug_sync.result
@@ -1,20 +1,28 @@
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
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';
CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
+connection default;
SET debug_sync='now WAIT_FOR locked';
SET debug_sync='find_udf_before_lock SIGNAL go';
SELECT * FROM v1;
myfunc_int(1)
1
FLUSH TABLES;
+connection con1;
SET debug_sync='mysql_drop_function_after_lock SIGNAL locked WAIT_FOR go';
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;
myfunc_int(1)
1
+connection con1;
+disconnect con1;
+connection default;
SET debug_sync='RESET';
DROP VIEW v1;
DROP FUNCTION myfunc_int;
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 62b5e2841fb..a7863506951 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -124,11 +124,11 @@ ERROR 21000: The used SELECT statements have a different number of columns
explain select a,b from t1 union select 1 limit 0;
ERROR 21000: The used SELECT statements have a different number of columns
select a,b from t1 into outfile 'skr' union select a,b from t2;
-ERROR HY000: Incorrect usage of UNION and INTO
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'union select a,b from t2' at line 1
select a,b from t1 order by a union select a,b from t2;
-ERROR HY000: Incorrect usage of UNION and ORDER BY
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'union select a,b from t2' at line 1
insert into t3 select a from t1 order by a union select a from t2;
-ERROR HY000: Incorrect usage of UNION and ORDER BY
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'union select a from t2' at line 1
create table t3 select a,b from t1 union select a from t2;
ERROR 21000: The used SELECT statements have a different number of columns
select a,b from t1 union select a from t2;
@@ -380,7 +380,7 @@ select found_rows();
found_rows()
4
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION all SELECT * FROM t2 LIMIT 2;
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION all SELECT * FROM t2 LIMIT 2' at line 1
SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION all SELECT * FROM t2 LIMIT 2;
a
1
@@ -422,7 +422,7 @@ select found_rows();
found_rows()
5
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 100 UNION SELECT * FROM t2;
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT * FROM t2' at line 1
SELECT COUNT(*) FROM (
(SELECT * FROM t1 LIMIT 100) UNION SELECT * FROM t2) q;
COUNT(*)
@@ -435,7 +435,7 @@ a
4
5
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION SELECT * FROM t2;
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT * FROM t2' at line 1
SELECT COUNT(*) FROM (
(SELECT * FROM t1 LIMIT 1) UNION SELECT * FROM t2) q;
COUNT(*)
@@ -447,7 +447,7 @@ a
4
5
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION SELECT * FROM t2 LIMIT 2;
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT * FROM t2 LIMIT 2' at line 1
SELECT COUNT(*) FROM (
(SELECT * FROM t1 LIMIT 1) UNION SELECT * FROM t2) q;
COUNT(*)
@@ -468,7 +468,7 @@ SELECT * FROM t1 UNION SELECT * FROM t2) q;
COUNT(*)
5
SELECT SQL_CALC_FOUND_ROWS * FROM t1 limit 2,2 UNION SELECT * FROM t2;
-ERROR HY000: Incorrect usage of UNION and LIMIT
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT * FROM t2' at line 1
SELECT COUNT(*) FROM (
(SELECT * FROM t1 limit 2,2) UNION SELECT * FROM t2) q;
COUNT(*)
@@ -629,7 +629,7 @@ a
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` decimal(3,1) NOT NULL DEFAULT '0.0'
+ `a` decimal(3,1) NOT NULL DEFAULT 0.0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t2 (it1 tinyint, it2 tinyint not null, i int not null, ib bigint, f float, d double, y year, da date, dt datetime, sc char(10), sv varchar(10), b blob, tx text);
@@ -653,7 +653,7 @@ it2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `it2` int(11) NOT NULL DEFAULT '0'
+ `it2` int(11) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT i from t2 UNION select f from t2;
@@ -796,7 +796,7 @@ tetetetetest
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `dt` blob
+ `dt` blob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT sv from t2 UNION select b from t2;
@@ -807,7 +807,7 @@ tetetetetest
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `sv` blob
+ `sv` blob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT i from t2 UNION select d from t2 UNION select b from t2;
@@ -819,7 +819,7 @@ tetetetetest
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `i` blob
+ `i` blob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT sv from t2 UNION select tx from t2;
@@ -830,7 +830,7 @@ teeeeeeeeeeeest
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `sv` text
+ `sv` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT b from t2 UNION select tx from t2;
@@ -841,7 +841,7 @@ teeeeeeeeeeeest
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `b` blob
+ `b` blob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t2;
create table t1 select 1 union select -1;
@@ -852,7 +852,7 @@ select * from t1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `1` bigint(20) NOT NULL DEFAULT '0'
+ `1` bigint(20) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 select _latin1"test" union select _latin2"testt" ;
@@ -1121,7 +1121,7 @@ create table t1 as
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `_latin1'test' collate latin1_bin` varchar(4) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT ''
+ `_latin1'test' collate latin1_bin` varchar(4) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select count(*) from t1;
count(*)
@@ -1134,7 +1134,7 @@ create table t1 as
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `test` varchar(4) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT ''
+ `test` varchar(4) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select count(*) from t1;
count(*)
@@ -1147,7 +1147,7 @@ create table t1 as
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `test` varchar(4) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT ''
+ `test` varchar(4) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select count(*) from t1;
count(*)
@@ -1351,7 +1351,7 @@ create table t3 SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `left(a,100000000)` mediumtext
+ `left(a,100000000)` mediumtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop tables t1,t2,t3;
CREATE TABLE t1 (a longtext);
@@ -1365,15 +1365,16 @@ create table t3 SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `left(a,100000000)` longtext
+ `left(a,100000000)` longtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop tables t1,t2,t3;
SELECT @tmp_max:= @@global.max_allowed_packet;
@tmp_max:= @@global.max_allowed_packet
-4194304
+16777216
SET @@global.max_allowed_packet=25000000;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '25000000'
+connect newconn, localhost, root,,;
CREATE TABLE t1 (a mediumtext);
CREATE TABLE t2 (b varchar(20));
INSERT INTO t1 VALUES ('a');
@@ -1381,7 +1382,7 @@ CREATE TABLE t3 SELECT REPEAT(a,20000000) AS a FROM t1 UNION SELECT b FROM t2;
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `a` longtext
+ `a` longtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLES t1,t3;
CREATE TABLE t1 (a tinytext);
@@ -1399,7 +1400,7 @@ CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
- `a` longtext
+ `a` longtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLES t1,t3;
CREATE TABLE t1 (a tinyblob);
@@ -1411,7 +1412,9 @@ t3 CREATE TABLE `t3` (
`a` varbinary(510) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLES t1,t2,t3;
+connection default;
SET @@global.max_allowed_packet:= @tmp_max;
+disconnect newconn;
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;
@@ -1442,8 +1445,8 @@ t2 CREATE TABLE `t2` (
`f4` binary(5) DEFAULT NULL,
`f5` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`f6` varchar(1) CHARACTER SET utf8 DEFAULT NULL,
- `f7` text,
- `f8` mediumtext CHARACTER SET utf8
+ `f7` text DEFAULT NULL,
+ `f8` mediumtext CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
(select avg(1)) union (select avg(1)) union (select avg(1)) union
@@ -1563,7 +1566,8 @@ UNION ALL
SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP ORDER BY a
UNION
SELECT 1,1;
-ERROR HY000: Incorrect usage of UNION and ORDER BY
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION
+SELECT 1,1' at line 4
DROP TABLE t1,t2;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2), (3);
@@ -1640,11 +1644,11 @@ 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;
SELECT a INTO @v FROM t1 UNION SELECT a FROM t1;
-ERROR HY000: Incorrect usage of UNION and INTO
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT a FROM t1' at line 1
SELECT a INTO OUTFILE 'union.out.file7' FROM t1 UNION SELECT a FROM t1;
-ERROR HY000: Incorrect usage of UNION and INTO
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT a FROM t1' at line 1
SELECT a INTO DUMPFILE 'union.out.file8' FROM t1 UNION SELECT a FROM t1;
-ERROR HY000: Incorrect usage of UNION and INTO
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT a FROM t1' at line 1
# 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;
@@ -1666,7 +1670,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 UNION t1 ALL NULL NULL NULL NULL 2 100.00
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by (`a` + 12)
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by `a` + 12
# Should not crash
SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY a + 12;
a
@@ -1705,7 +1709,7 @@ NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'a' of SELECT #3 was resolved in SELECT #-1
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by <expr_cache><`a`>((select `a` from `test`.`t2` where (`test`.`t2`.`b` = 12)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by <expr_cache><`a`>((select `a` from `test`.`t2` where `test`.`t2`.`b` = 12))
# Should not crash
SELECT * FROM t1 UNION SELECT * FROM t1
ORDER BY (SELECT a FROM t2 WHERE b = 12);
@@ -2079,7 +2083,10 @@ 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);
-ERROR HY000: Invalid use of group function
+a f
+1 1
+3 3
+2 2
(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + 1)
UNION
(SELECT 2, 2);
@@ -2207,3 +2214,33 @@ WHERE t1_2.b NOT IN ( SELECT 4 UNION ALL SELECT 5 );
a b a b
1 1 1 1
DROP TABLE t1;
+#
+# Bug mdev-12788: UNION ALL + impossible having for derived
+# with IN subquery in WHERE
+#
+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);
+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;
+1 2
+1 2
+EXPLAIN EXTENDED 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;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+2 UNION NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables
+Warnings:
+Note 1003 select 1 AS `1`,2 AS `2` union all select 1 AS `i`,count(0) AS `COUNT(*)` from `test`.`t2` where 1 group by 1 having 0
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/unsafe_binlog_innodb.result b/mysql-test/r/unsafe_binlog_innodb.result
index b2cf16ad58f..0fe3d38035b 100644
--- a/mysql-test/r/unsafe_binlog_innodb.result
+++ b/mysql-test/r/unsafe_binlog_innodb.result
@@ -14,6 +14,9 @@ select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
where mm.id is null lock in share mode;
id f_id f
drop table t1,t2;
+connect a,localhost,root,,;
+connect b,localhost,root,,;
+connection a;
create table t1(a int not null, b int, primary key(a)) engine = InnoDB;
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
commit;
@@ -28,24 +31,41 @@ a b
6 2
7 3
update t1 set b = 5 where b = 1;
+connection b;
set autocommit = 0;
select * from t1 where a = 2 and b = 2 for update;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection a;
commit;
+connection b;
commit;
drop table t1;
+connection default;
+disconnect a;
+disconnect b;
+connect a,localhost,root,,;
+connect b,localhost,root,,;
+connection a;
create table t1(a int not null, b int, primary key(a)) engine = InnoDB;
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
commit;
set autocommit = 0;
update t1 set b = 5 where b = 1;
+connection b;
set autocommit = 0;
select * from t1 where a = 7 and b = 3 for update;
a b
7 3
commit;
+connection a;
commit;
drop table t1;
+connection default;
+disconnect a;
+disconnect b;
+connect a,localhost,root,,;
+connect b,localhost,root,,;
+connection a;
create table t1(a int not null, b int, primary key(a)) engine = InnoDB;
insert into t1 values (1,2),(5,3),(4,2);
create table t2(d int not null, e int, primary key(d)) engine = InnoDB;
@@ -57,17 +77,33 @@ d e
3 1
8 6
12 1
+connection b;
set autocommit = 0;
insert into t1 select * from t2;
update t1 set b = (select e from t2 where a = d);
create table t3(d int not null, e int, primary key(d)) engine = InnoDB
select * from t2;
commit;
+connection a;
commit;
+connection default;
+disconnect a;
+disconnect b;
drop table t1, t2, t3;
+connect a,localhost,root,,;
+connect b,localhost,root,,;
+connect c,localhost,root,,;
+connect d,localhost,root,,;
SET SESSION STORAGE_ENGINE = InnoDB;
+connect e,localhost,root,,;
+connect f,localhost,root,,;
+connect g,localhost,root,,;
SET SESSION STORAGE_ENGINE = InnoDB;
+connect h,localhost,root,,;
+connect i,localhost,root,,;
+connect j,localhost,root,,;
SET SESSION STORAGE_ENGINE = InnoDB;
+connection a;
create table t1(a int not null, b int, primary key(a)) engine = InnoDB;
insert into t1 values (1,2),(5,3),(4,2);
create table t2(a int not null, b int, primary key(a)) engine = InnoDB;
@@ -89,35 +125,65 @@ a b
3 1
8 6
12 1
+connection b;
set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
insert into t1 select * from t2;
+connection c;
set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
update t3 set b = (select b from t2 where a = d);
+connection d;
set autocommit = 0;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
create table t4(a int not null, b int, primary key(a)) select * from t2;
+connection e;
set autocommit = 0;
insert into t5 (select * from t2 lock in share mode);
+connection f;
set autocommit = 0;
update t6 set e = (select b from t2 where a = d lock in share mode);
+connection g;
set autocommit = 0;
create table t7(a int not null, b int, primary key(a)) select * from t2 lock in share mode;
+connection h;
set autocommit = 0;
insert into t8 (select * from t2 for update);
+connection i;
set autocommit = 0;
update t9 set e = (select b from t2 where a = d for update);
+connection j;
set autocommit = 0;
create table t10(a int not null, b int, primary key(a)) select * from t2 for update;
+connection b;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection c;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection d;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection e;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection f;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection g;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection h;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection i;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection j;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection a;
commit;
+connection default;
+disconnect a;
+disconnect b;
+disconnect c;
+disconnect d;
+disconnect e;
+disconnect f;
+disconnect g;
+disconnect h;
+disconnect i;
+disconnect j;
drop table t1, t2, t3, t5, t6, t8, t9;
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 49141e33709..73ebb73e313 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -487,6 +487,8 @@ a quux
2 0.100000000000000000000000000000
3 NULL
DROP TABLE t1;
+connect con1,localhost,root,,test;
+connection con1;
set tmp_table_size=1024;
create table t1 (id int, a int, key idx(a));
create table t2 (id int unsigned not null auto_increment primary key, a int);
@@ -521,15 +523,17 @@ update t1 join t2 on (t1.a=t2.a) set t1.id=t2.id;
affected rows: 127
info: Rows matched: 128 Changed: 127 Warnings: 0
drop table t1,t2;
+connection default;
+disconnect con1;
DROP TABLE IF EXISTS t1;
DROP FUNCTION IF EXISTS f1;
CREATE FUNCTION f1() RETURNS INT RETURN f1();
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1);
UPDATE t1 SET i = 3 WHERE f1();
-ERROR HY000: Recursive stored functions and triggers are not allowed.
+ERROR HY000: Recursive stored functions and triggers are not allowed
UPDATE t1 SET i = f1();
-ERROR HY000: Recursive stored functions and triggers are not allowed.
+ERROR HY000: Recursive stored functions and triggers are not allowed
DROP TABLE t1;
DROP FUNCTION f1;
End of 5.0 tests
diff --git a/mysql-test/r/upgrade.result b/mysql-test/r/upgrade.result
index 74b888e49c5..887a53887fe 100644
--- a/mysql-test/r/upgrade.result
+++ b/mysql-test/r/upgrade.result
@@ -110,7 +110,7 @@ Database (%a-b-c%)
a-b-c
show create view `a-b-c`.v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS 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`) utf8 utf8_general_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS 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` utf8 utf8_general_ci
select * from `a-b-c`.v1;
f1
drop database `a-b-c`;
diff --git a/mysql-test/r/user_limits.result b/mysql-test/r/user_limits.result
index 5ab98d1fc30..bbf73d7c617 100644
--- a/mysql-test/r/user_limits.result
+++ b/mysql-test/r/user_limits.result
@@ -9,18 +9,27 @@ flush privileges;
create user mysqltest_1@localhost;
grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 2;
flush user_resources;
+connect mqph, localhost, mysqltest_1,,;
+connection mqph;
select * from t1;
i
select * from t1;
i
select * from t1;
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_queries_per_hour' resource (current value: 2)
+connect mqph2, localhost, mysqltest_1,,;
+connection mqph2;
select * from t1;
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_queries_per_hour' resource (current value: 2)
+connection default;
drop user mysqltest_1@localhost;
+disconnect mqph;
+disconnect mqph2;
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;
i
select * from t1;
@@ -33,43 +42,69 @@ delete from t1;
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_updates_per_hour' resource (current value: 2)
select * from t1;
i
+connect muph2, localhost, mysqltest_1,,;
+connection muph2;
delete from t1;
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_updates_per_hour' resource (current value: 2)
select * from t1;
i
+connection default;
drop user mysqltest_1@localhost;
+disconnect muph;
+disconnect muph2;
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;
i
+connect mcph2, localhost, mysqltest_1,,;
+connection mcph2;
select * from t1;
i
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
+connect mcph3, localhost, mysqltest_1,,;
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_connections_per_hour' resource (current value: 2)
select * from t1;
i
+disconnect mcph1;
+disconnect mcph2;
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
+connect mcph3, localhost, mysqltest_1,,;
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_connections_per_hour' resource (current value: 2)
+connection default;
drop user mysqltest_1@localhost;
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;
i
+connect muc2, localhost, mysqltest_1,,;
+connection muc2;
select * from t1;
i
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
+connect muc3, localhost, mysqltest_1,,;
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_user_connections' resource (current value: 2)
+disconnect muc1;
+connect muc3, localhost, mysqltest_1,,;
select * from t1;
i
+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;
i
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
+connect muc5, localhost, mysqltest_1,,;
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_user_connections' resource (current value: 3)
+connection default;
grant usage on *.* to mysqltest_1@localhost with max_user_connections -1;
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
@@ -79,7 +114,11 @@ show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_USER_CONNECTIONS -1
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
+connect muc5, localhost, mysqltest_1,,;
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_user_connections' resource (current value: -1)
+disconnect muc2;
+disconnect muc3;
+disconnect muc4;
drop user mysqltest_1@localhost;
select @@session.max_user_connections, @@global.max_user_connections;
@@session.max_user_connections @@global.max_user_connections
@@ -93,20 +132,33 @@ select @@session.max_user_connections, @@global.max_user_connections;
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;
@@session.max_user_connections @@global.max_user_connections
2 2
+connect muca2, localhost, mysqltest_1,,;
+connection muca2;
select * from t1;
i
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
+connect muca3, localhost, mysqltest_1,,;
ERROR 42000: User mysqltest_1 already has more than 'max_user_connections' active connections
+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;
@@session.max_user_connections @@global.max_user_connections
3 2
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
+connect muca4, localhost, mysqltest_1,,;
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_user_connections' resource (current value: 3)
+connection default;
+disconnect muca1;
+disconnect muca2;
+disconnect muca3;
set global max_user_connections= 0;
grant usage on *.* to mysqltest_1@localhost with max_user_connections 0;
set global max_user_connections=-1;
@@ -119,10 +171,18 @@ select @@global.max_user_connections;
@@global.max_user_connections
-1
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
+connect muca2, localhost, mysqltest_1,,;
ERROR 42000: User mysqltest_1 already has more than 'max_user_connections' active connections
+connect muca2, localhost, root,,;
+disconnect muca2;
+connection default;
set global max_user_connections=1;
+connect muca2, localhost, mysqltest_1,,;
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
+connect muca3, localhost, mysqltest_1,,;
ERROR 42000: User mysqltest_1 already has more than 'max_user_connections' active connections
+disconnect muca2;
+connection default;
drop user mysqltest_1@localhost;
drop table t1;
set global max_user_connections= @my_max_user_connections;
diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result
index 2e1eb15cad4..6066da2481a 100644
--- a/mysql-test/r/user_var-binlog.result
+++ b/mysql-test/r/user_var-binlog.result
@@ -29,8 +29,8 @@ SET @`a b`:=_latin1 X'68656C6C6F' COLLATE `latin1_swedish_ci`/*!*/;
use `test`/*!*/;
SET TIMESTAMP=10000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=1342177280/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index ec19f922b05..93b684628fd 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -218,7 +218,7 @@ create table t1 select @first_var;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `@first_var` longblob
+ `@first_var` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @first_var= cast(NULL as signed integer);
@@ -242,7 +242,7 @@ create table t1 select @first_var;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `@first_var` longblob
+ `@first_var` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @first_var=1;
@@ -251,7 +251,7 @@ create table t1 select @first_var;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `@first_var` longtext
+ `@first_var` longtext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @a=18446744071710965857;
diff --git a/mysql-test/r/userstat-badlogin-4824.result b/mysql-test/r/userstat-badlogin-4824.result
index 8362e8d5239..6a38c2bd601 100644
--- a/mysql-test/r/userstat-badlogin-4824.result
+++ b/mysql-test/r/userstat-badlogin-4824.result
@@ -1,14 +1,19 @@
create user foo@localhost identified by 'foo';
flush user_statistics;
set global userstat=1;
+connect foo, localhost, foo, foo;
select 1;
1
1
+disconnect foo;
+connection default;
select user, bytes_received from information_schema.user_statistics where user = 'foo';
user bytes_received
foo 18
connect(localhost,foo,bar,test,MASTER_PORT,MASTER_SOCKET);
+connect foo, localhost, foo, bar;
ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES)
+connection default;
select user, bytes_received from information_schema.user_statistics where user = 'foo';
user bytes_received
foo 18
diff --git a/mysql-test/r/userstat.result b/mysql-test/r/userstat.result
index 66bb4516c85..37d07439fee 100644
--- a/mysql-test/r/userstat.result
+++ b/mysql-test/r/userstat.result
@@ -80,9 +80,11 @@ delete from t1 where a=3;
select * from t1 where a=999;
a b
drop table t1;
+connect ssl_con,localhost,root,,,,,SSL;
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
have_ssl
1
+connection default;
create table t1 (a int, primary key (a), b int default 0) engine=innodb;
begin;
insert into t1 values(1,1);
@@ -133,6 +135,7 @@ Handler_write 7
select variable_value - @global_read_key as "handler_read_key" from information_schema.global_status where variable_name="handler_read_key";
handler_read_key
9
+disconnect ssl_con;
set @@global.userstat=0;
select * from information_schema.index_statistics;
TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ
diff --git a/mysql-test/r/variables-notembedded.result b/mysql-test/r/variables-notembedded.result
index f8191345219..a8bf7ecc429 100644
--- a/mysql-test/r/variables-notembedded.result
+++ b/mysql-test/r/variables-notembedded.result
@@ -158,6 +158,7 @@ Warning 1708 The value of 'max_allowed_packet' should be no less than the value
SET GLOBAL net_buffer_length=4096;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+CONNECT con1,localhost,root,,test;
SHOW SESSION VARIABLES LIKE 'max_allowed_packet';
Variable_name Value
max_allowed_packet 2048
@@ -165,6 +166,8 @@ SHOW SESSION VARIABLES LIKE 'net_buffer_length';
Variable_name Value
net_buffer_length 4096
Got one of the listed errors
+connection default;
+disconnect con1;
SELECT LENGTH(a) FROM t1;
LENGTH(a)
SET GLOBAL max_allowed_packet=default;
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index df0d16237ac..7549832e09d 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -77,7 +77,7 @@ explain extended select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select (@t1:=((@t2:=1) + (@t3:=4))) AS `@t1:=(@t2:=1)+@t3:=4`,(@`t1`) AS `@t1`,(@`t2`) AS `@t2`,(@`t3`) AS `@t3`
+Note 1003 select @t1:=(@t2:=1) + (@t3:=4) AS `@t1:=(@t2:=1)+@t3:=4`,@`t1` AS `@t1`,@`t2` AS `@t2`,@`t3` AS `@t3`
select @t5;
@t5
1.23456
@@ -189,7 +189,7 @@ select @@concurrent_insert;
AUTO
set global timed_mutexes=ON;
Warnings:
-Warning 1287 '@@timed_mutexes' is deprecated and will be removed in a future release.
+Warning 1287 '@@timed_mutexes' is deprecated and will be removed in a future release
show variables like 'timed_mutexes';
Variable_name Value
timed_mutexes ON
@@ -198,7 +198,7 @@ VARIABLE_NAME VARIABLE_VALUE
TIMED_MUTEXES ON
set global timed_mutexes=0;
Warnings:
-Warning 1287 '@@timed_mutexes' is deprecated and will be removed in a future release.
+Warning 1287 '@@timed_mutexes' is deprecated and will be removed in a future release
show variables like 'timed_mutexes';
Variable_name Value
timed_mutexes OFF
@@ -732,8 +732,8 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) DEFAULT NULL,
- `c2` decimal(65,30) DEFAULT NULL,
- `c3` longtext,
+ `c2` decimal(65,38) DEFAULT NULL,
+ `c3` longtext DEFAULT NULL,
`c4` double DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
@@ -823,7 +823,8 @@ set @@global.lc_time_names=fr_FR;
select @@global.lc_time_names, @@lc_time_names;
@@global.lc_time_names @@lc_time_names
fr_FR en_US
-New connection
+connect con1,localhost,root,,;
+connection con1;
select @@global.lc_time_names, @@lc_time_names;
@@global.lc_time_names @@lc_time_names
fr_FR fr_FR
@@ -831,7 +832,8 @@ set @@lc_time_names=ru_RU;
select @@global.lc_time_names, @@lc_time_names;
@@global.lc_time_names @@lc_time_names
fr_FR ru_RU
-Returnung to default connection
+disconnect con1;
+connection default;
select @@global.lc_time_names, @@lc_time_names;
@@global.lc_time_names @@lc_time_names
fr_FR en_US
@@ -1277,12 +1279,12 @@ ERROR HY000: Variable 'lower_case_table_names' is a read only variable
#
SHOW VARIABLES like 'myisam_recover_options';
Variable_name Value
-myisam_recover_options DEFAULT
+myisam_recover_options BACKUP,QUICK
SELECT @@session.myisam_recover_options;
ERROR HY000: Variable 'myisam_recover_options' is a GLOBAL variable
SELECT @@global.myisam_recover_options;
@@global.myisam_recover_options
-DEFAULT
+BACKUP,QUICK
SET @@session.myisam_recover_options= 'x';
ERROR HY000: Variable 'myisam_recover_options' is a read only variable
SET @@global.myisam_recover_options= 'x';
@@ -1444,7 +1446,7 @@ Warnings:
Warning 1292 Truncated incorrect auto_increment_offset value: '0'
select @@default_storage_engine;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def @@default_storage_engine 253 6 6 Y 0 31 8
+def @@default_storage_engine 253 6 6 Y 0 39 8
@@default_storage_engine
MyISAM
SET @old_server_id = @@GLOBAL.server_id;
@@ -1465,15 +1467,17 @@ SELECT @@GLOBAL.server_id;
@@GLOBAL.server_id
4294967295
SET GLOBAL server_id = 0;
+Warnings:
+Warning 1292 Truncated incorrect server_id value: '0'
SELECT @@GLOBAL.server_id;
@@GLOBAL.server_id
-0
+1
SET GLOBAL server_id = -1;
Warnings:
Warning 1292 Truncated incorrect server_id value: '-1'
SELECT @@GLOBAL.server_id;
@@GLOBAL.server_id
-0
+1
SET GLOBAL server_id = @old_server_id;
#
# BUG#10206 - InnoDB: Transaction requiring Max_BinLog_Cache_size > 4GB always rollsback
@@ -1529,7 +1533,7 @@ SET @@global.key_buffer_size=@kbs;
SET @@global.key_cache_block_size=@kcbs;
select @@max_long_data_size;
@@max_long_data_size
-4194304
+16777216
#
# Bug#11766424 59527:
# Assert in DECIMAL_BIN_SIZE:
@@ -1798,3 +1802,23 @@ select * from information_schema.session_variables where variable_name='sql_mode
VARIABLE_NAME VARIABLE_VALUE
SQL_MODE ANSI_QUOTES
End of 5.5 tests
+explain extended select @@VERsion from dual where rand() > @@verSION;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select @@VERsion AS "@@VERsion" from DUAL where rand() > @@version
+explain extended select @@SESsion.SQL_mode from dual where rand() > @@sesSION.sql_MODE;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select @@SESsion.SQL_mode AS "@@SESsion.SQL_mode" from DUAL where rand() > @@sql_mode
+explain extended select @@GLObal.COLLATION_connection from dual where rand() > @@gloBAL.collation_CONNECTION;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select @@GLObal.COLLATION_connection AS "@@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;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select @@FOObar.KEY_BUFfer_size AS "@@FOObar.KEY_BUFfer_size" from DUAL where rand() > @@fooBAR.key_buffer_size
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index e8c96e49977..c5c4df01abd 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -1,7 +1,3 @@
-drop table if exists t1,t2,t3,t4,t5,t6,t9,`t1a``b`,v1,v2,v3,v4,v5,v6;
-drop view if exists t1,t2,t3,t4,t5,t6,t9,`t1a``b`,v1,v2,v3,v4,v5,v6;
-drop database if exists mysqltest;
-use test;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
create view v1 (c,d) as select a,b from t1;
@@ -40,10 +36,10 @@ c
11
show create table v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci
show create view v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci
show create view t1;
ERROR HY000: 'test.t1' is not VIEW
drop table t1;
@@ -59,11 +55,11 @@ explain extended select c from v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
Warnings:
-Note 1003 select (`test`.`t1`.`b` + 1) AS `c` from `test`.`t1`
+Note 1003 select `test`.`t1`.`b` + 1 AS `c` from `test`.`t1`
create algorithm=temptable view v2 (c) as select b+1 from t1;
show create view v2;
View Create View character_set_client collation_connection
-v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
+v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci
select c from v2;
c
3
@@ -93,7 +89,7 @@ explain extended select c from v3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
Warnings:
-Note 1003 select ((`test`.`t1`.`b` + 1) + 1) AS `c` from `test`.`t1`
+Note 1003 select `test`.`t1`.`b` + 1 + 1 AS `c` from `test`.`t1`
create algorithm=temptable view v4 (c) as select c+1 from v2;
select c from v4;
c
@@ -122,7 +118,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5 100.00
3 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00
Warnings:
-Note 1003 select (`v2`.`c` + 1) AS `c` from `test`.`v2`
+Note 1003 select `v2`.`c` + 1 AS `c` from `test`.`v2`
create algorithm=temptable view v6 (c) as select c+1 from v1;
select c from v6;
c
@@ -253,7 +249,7 @@ drop view v1;
drop table t1;
create table t1 (a int);
create view v1 as select distinct a from t1 WITH CHECK OPTION;
-ERROR HY000: CHECK OPTION on non-updatable view 'test.v1'
+ERROR HY000: CHECK OPTION on non-updatable view `test`.`v1`
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;
@@ -392,7 +388,7 @@ explain extended select * from v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`b` AS `c` from `test`.`t1` where (`test`.`t1`.`a` < 3)
+Note 1003 select `test`.`t1`.`b` AS `c` from `test`.`t1` where `test`.`t1`.`a` < 3
update v1 set c=c+1;
select * from t1;
a b
@@ -793,7 +789,7 @@ a b
1 1
show create view v3;
View Create View character_set_client collation_connection
-v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `v1`.`col1` AS `a`,`v2`.`col1` AS `b` from (`v1` join `v2`) where (`v1`.`col1` = `v2`.`col1`) latin1 latin1_swedish_ci
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `v1`.`col1` AS `a`,`v2`.`col1` AS `b` from (`v1` join `v2`) where `v1`.`col1` = `v2`.`col1` latin1 latin1_swedish_ci
drop view v3, v2, v1;
drop table t2, t1;
create function `f``1` () returns int return 5;
@@ -817,10 +813,10 @@ 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;
View Create View character_set_client collation_connection
-v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t2`.`col1` collate latin1_german1_ci) AS `col1 collate latin1_german1_ci` from `t2` latin1 latin1_swedish_ci
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`col1` collate latin1_german1_ci AS `col1 collate latin1_german1_ci` from `t2` latin1 latin1_swedish_ci
show create view v2;
View Create View character_set_client collation_connection
-v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t2`.`col1` collate latin1_german1_ci) AS `col1 collate latin1_german1_ci` from `t2` latin1 latin1_swedish_ci
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`col1` collate latin1_german1_ci AS `col1 collate latin1_german1_ci` from `t2` latin1 latin1_swedish_ci
drop view v2;
drop table t2;
create table t1 (a int);
@@ -908,7 +904,7 @@ create view v1 as select a from t1;
create view v3 as select a from t1;
create database mysqltest;
rename table v1 to mysqltest.v1;
-ERROR HY000: Changing schema from 'test' to 'mysqltest' is not allowed.
+ERROR HY000: Changing schema from 'test' to 'mysqltest' is not allowed
rename table v1 to v2;
rename table v3 to v1, v2 to t1;
ERROR 42S01: Table 't1' already exists
@@ -923,14 +919,14 @@ select * from v4;
ERROR 21000: Subquery returns more than 1 row
drop view v4, v3, v2, v1;
create view v1 as select 5 into @w;
-ERROR HY000: View's SELECT contains a 'INTO' clause
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'into @w' at line 1
create view v1 as select 5 into outfile 'ttt';
-ERROR HY000: View's SELECT contains a 'INTO' clause
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'into outfile 'ttt'' at line 1
create table t1 (a int);
create view v1 as select a from t1 procedure analyse();
-ERROR HY000: View's SELECT contains a 'PROCEDURE' clause
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'procedure analyse()' at line 1
create view v1 as select 1 from (select 1) as d1;
-ERROR HY000: View's SELECT contains a subquery in the FROM clause
+drop view v1;
drop table t1;
create table t1 (s1 int, primary key (s1));
create view v1 as select * from t1;
@@ -948,29 +944,29 @@ 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;
update v2 set col1 = (select max(col1) from v1);
-ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'v2'.
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'v2'
update v2 set col1 = (select max(col1) from t1);
-ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 'v2'.
+ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 'v2'
update v2 set col1 = (select max(col1) from v2);
ERROR HY000: Table 'v2' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update v2,t2 set v2.col1 = (select max(col1) from v1) where v2.col1 = t2.col1;
-ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'v2'.
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'v2'
update t1,t2 set t1.col1 = (select max(col1) from v1) where t1.col1 = t2.col1;
-ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't1'.
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't1'
update v1,t2 set v1.col1 = (select max(col1) from v1) where v1.col1 = t2.col1;
ERROR HY000: Table 'v1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t2,v2 set v2.col1 = (select max(col1) from v1) where v2.col1 = t2.col1;
-ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't2'.
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't2'
update t2,t1 set t1.col1 = (select max(col1) from v1) where t1.col1 = t2.col1;
-ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't2'.
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't2'
update t2,v1 set v1.col1 = (select max(col1) from v1) where v1.col1 = t2.col1;
-ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't2'.
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't2'
update v2,t2 set v2.col1 = (select max(col1) from t1) where v2.col1 = t2.col1;
-ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 'v2'.
+ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 'v2'
update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
ERROR HY000: Table 't1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update v1,t2 set v1.col1 = (select max(col1) from t1) where v1.col1 = t2.col1;
-ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'v1'.
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'v1'
update t2,v2 set v2.col1 = (select max(col1) from t1) where v2.col1 = t2.col1;
ERROR HY000: Table 't2' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t2,t1 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
@@ -980,73 +976,73 @@ ERROR HY000: Table 't2' is specified twice, both as a target for 'UPDATE' and as
update v2,t2 set v2.col1 = (select max(col1) from v2) where v2.col1 = t2.col1;
ERROR HY000: Table 'v2' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t1,t2 set t1.col1 = (select max(col1) from v2) where t1.col1 = t2.col1;
-ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 't1'.
+ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 't1'
update v1,t2 set v1.col1 = (select max(col1) from v2) where v1.col1 = t2.col1;
-ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 'v1'.
+ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 'v1'
update t2,v2 set v2.col1 = (select max(col1) from v2) where v2.col1 = t2.col1;
-ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 't2'.
+ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 't2'
update t2,t1 set t1.col1 = (select max(col1) from v2) where t1.col1 = t2.col1;
-ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 't2'.
+ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 't2'
update t2,v1 set v1.col1 = (select max(col1) from v2) where v1.col1 = t2.col1;
-ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 't2'.
+ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 't2'
update v3 set v3.col1 = (select max(col1) from v1);
-ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'v3'.
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'v3'
update v3 set v3.col1 = (select max(col1) from t1);
-ERROR HY000: The definition of table 'v3' prevents operation UPDATE on table 'v3'.
+ERROR HY000: The definition of table 'v3' prevents operation UPDATE on table 'v3'
update v3 set v3.col1 = (select max(col1) from v2);
-ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 'v3'.
+ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 'v3'
update v3 set v3.col1 = (select max(col1) from v3);
ERROR HY000: Table 'v3' is specified twice, both as a target for 'UPDATE' and as a separate source for data
delete from v2 where col1 = (select max(col1) from v1);
-ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'v2'.
+ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'v2'
delete from v2 where col1 = (select max(col1) from t1);
-ERROR HY000: The definition of table 'v2' prevents operation DELETE on table 'v2'.
+ERROR HY000: The definition of table 'v2' prevents operation DELETE on table 'v2'
delete from v2 where col1 = (select max(col1) from v2);
ERROR HY000: Table 'v2' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete v2 from v2,t2 where (select max(col1) from v1) > 0 and v2.col1 = t2.col1;
-ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'v2'.
+ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'v2'
delete t1 from t1,t2 where (select max(col1) from v1) > 0 and t1.col1 = t2.col1;
-ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 't1'.
+ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 't1'
delete v1 from v1,t2 where (select max(col1) from v1) > 0 and v1.col1 = t2.col1;
ERROR HY000: Table 'v1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete v2 from v2,t2 where (select max(col1) from t1) > 0 and v2.col1 = t2.col1;
-ERROR HY000: The definition of table 'v2' prevents operation DELETE on table 'v2'.
+ERROR HY000: The definition of table 'v2' prevents operation DELETE on table 'v2'
delete t1 from t1,t2 where (select max(col1) from t1) > 0 and t1.col1 = t2.col1;
ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete v1 from v1,t2 where (select max(col1) from t1) > 0 and v1.col1 = t2.col1;
-ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'v1'.
+ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'v1'
delete v2 from v2,t2 where (select max(col1) from v2) > 0 and v2.col1 = t2.col1;
ERROR HY000: Table 'v2' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete t1 from t1,t2 where (select max(col1) from v2) > 0 and t1.col1 = t2.col1;
-ERROR HY000: The definition of table 'v2' prevents operation DELETE on table 't1'.
+ERROR HY000: The definition of table 'v2' prevents operation DELETE on table 't1'
delete v1 from v1,t2 where (select max(col1) from v2) > 0 and v1.col1 = t2.col1;
-ERROR HY000: The definition of table 'v2' prevents operation DELETE on table 'v1'.
+ERROR HY000: The definition of table 'v2' prevents operation DELETE on table 'v1'
insert into v2 values ((select max(col1) from v1));
-ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'v2'.
+ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'v2'
insert into t1 values ((select max(col1) from v1));
-ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 't1'.
+ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 't1'
insert into v2 values ((select max(col1) from v1));
-ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'v2'.
+ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'v2'
insert into v2 values ((select max(col1) from t1));
-ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 'v2'.
+ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 'v2'
insert into t1 values ((select max(col1) from t1));
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into v2 values ((select max(col1) from t1));
-ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 'v2'.
+ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 'v2'
insert into v2 values ((select max(col1) from v2));
ERROR HY000: Table 'v2' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into t1 values ((select max(col1) from v2));
-ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 't1'.
+ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 't1'
insert into v2 values ((select max(col1) from v2));
ERROR HY000: Table 'v2' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into v3 (col1) values ((select max(col1) from v1));
-ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'v3'.
+ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'v3'
insert into v3 (col1) values ((select max(col1) from t1));
-ERROR HY000: The definition of table 'v3' prevents operation INSERT on table 'v3'.
+ERROR HY000: The definition of table 'v3' prevents operation INSERT on table 'v3'
insert into v3 (col1) values ((select max(col1) from v2));
-ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 'v3'.
+ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 'v3'
insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from v2));
-ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 'v3'.
+ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 'v3'
insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from t2));
insert into t3 values ((select CONVERT_TZ('20050101000000','UTC','MET') from t2));
ERROR 23000: Column 'col1' cannot be null
@@ -1134,11 +1130,11 @@ create table t1 (a int);
create view v1 as select * from t1 where a < 2 with check option;
insert into v1 values(1);
insert into v1 values(3);
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
insert ignore into v1 values (2),(3),(0);
Warnings:
-Warning 1369 CHECK OPTION failed 'test.v1'
-Warning 1369 CHECK OPTION failed 'test.v1'
+Warning 1369 CHECK OPTION failed `test`.`v1`
+Warning 1369 CHECK OPTION failed `test`.`v1`
select * from t1;
a
1
@@ -1146,20 +1142,20 @@ a
delete from t1;
insert into v1 SELECT 1;
insert into v1 SELECT 3;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
create table t2 (a int);
insert into t2 values (2),(3),(0);
insert ignore into v1 SELECT a from t2;
Warnings:
-Warning 1369 CHECK OPTION failed 'test.v1'
-Warning 1369 CHECK OPTION failed 'test.v1'
+Warning 1369 CHECK OPTION failed `test`.`v1`
+Warning 1369 CHECK OPTION failed `test`.`v1`
select * from t1 order by a desc;
a
1
0
update v1 set a=-1 where a=0;
update v1 set a=2 where a=1;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
select * from t1 order by a desc;
a
1
@@ -1174,7 +1170,7 @@ a
update v1 set a=a+1;
update ignore v1,t2 set v1.a=v1.a+1 where v1.a=t2.a;
Warnings:
-Warning 1369 CHECK OPTION failed 'test.v1'
+Warning 1369 CHECK OPTION failed `test`.`v1`
select * from t1;
a
1
@@ -1188,12 +1184,12 @@ create view v3 as select * from v1 where a > 0 with cascaded check option;
insert into v2 values (1);
insert into v3 values (1);
insert into v2 values (0);
-ERROR HY000: CHECK OPTION failed 'test.v2'
+ERROR 44000: CHECK OPTION failed `test`.`v2`
insert into v3 values (0);
-ERROR HY000: CHECK OPTION failed 'test.v3'
+ERROR 44000: CHECK OPTION failed `test`.`v3`
insert into v2 values (2);
insert into v3 values (2);
-ERROR HY000: CHECK OPTION failed 'test.v3'
+ERROR 44000: CHECK OPTION failed `test`.`v3`
select * from t1;
a
1
@@ -1205,10 +1201,10 @@ 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;
insert into v1 values (1) on duplicate key update a=2;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
insert ignore into v1 values (1) on duplicate key update a=2;
Warnings:
-Warning 1369 CHECK OPTION failed 'test.v1'
+Warning 1369 CHECK OPTION failed `test`.`v1`
select * from t1;
a
1
@@ -1263,7 +1259,7 @@ s1
alter view v2 as select * from t2 where s1 in (select s1 from t1) with check option;
insert into v2 values (5);
update v2 set s1 = 1;
-ERROR HY000: CHECK OPTION failed 'test.v2'
+ERROR 44000: CHECK OPTION failed `test`.`v2`
insert into t1 values (1);
update v2 set s1 = 1;
select * from v2;
@@ -1300,26 +1296,27 @@ 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;
insert into v2 values (0);
-ERROR HY000: CHECK OPTION failed 'test.v2'
+ERROR 44000: CHECK OPTION failed `test`.`v2`
drop view v2, v1;
drop table t1;
create table t1 (s1 int);
create view v1 as select * from t1 where s1 < 5 with check option;
insert ignore into v1 values (6);
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
insert ignore into v1 values (6),(3);
Warnings:
-Warning 1369 CHECK OPTION failed 'test.v1'
+Warning 1369 CHECK OPTION failed `test`.`v1`
select * from t1;
s1
3
drop view v1;
drop table t1;
+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;
insert into v1 values (0);
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
select * from v1;
s1
select * from t1;
@@ -1327,11 +1324,12 @@ s1
drop trigger t1_bi;
drop view v1;
drop table t1;
+SET sql_mode = default;
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;
insert into v2 values (0);
-ERROR HY000: CHECK OPTION failed 'test.v2'
+ERROR 44000: CHECK OPTION failed `test`.`v2`
select * from v2;
s1
select * from t1;
@@ -1341,7 +1339,7 @@ drop table t1;
create table t1 (a int, b char(10));
create view v1 as select * from t1 where a != 0 with check option;
load data infile '../../std_data/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
select * from t1;
a b
1 row 1
@@ -1356,10 +1354,10 @@ Warnings:
Note 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
-Warning 1369 CHECK OPTION failed 'test.v1'
+Warning 1369 CHECK OPTION failed `test`.`v1`
Note 1265 Data truncated for column 'a' at row 3
Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 4
-Warning 1369 CHECK OPTION failed 'test.v1'
+Warning 1369 CHECK OPTION failed `test`.`v1`
select * from t1 order by a,b;
a b
1 row 1
@@ -1375,7 +1373,7 @@ drop table t1;
create table t1 (a text, b text);
create view v1 as select * from t1 where a <> 'Field A' with check option;
load data infile '../../std_data/loaddata2.dat' into table v1 fields terminated by ',' enclosed by '''';
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
select concat('|',a,'|'), concat('|',b,'|') from t1;
concat('|',a,'|') concat('|',b,'|')
select concat('|',a,'|'), concat('|',b,'|') from v1;
@@ -1383,7 +1381,7 @@ concat('|',a,'|') concat('|',b,'|')
delete from t1;
load data infile '../../std_data/loaddata2.dat' ignore into table v1 fields terminated by ',' enclosed by '''';
Warnings:
-Warning 1369 CHECK OPTION failed 'test.v1'
+Warning 1369 CHECK OPTION failed `test`.`v1`
Warning 1261 Row 2 doesn't contain data for all columns
select concat('|',a,'|'), concat('|',b,'|') from t1;
concat('|',a,'|') concat('|',b,'|')
@@ -1447,7 +1445,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join `test`.`t2` on((`test`.`t2`.`a` = `test`.`t3`.`a`))) on((`test`.`t1`.`a` = `test`.`t3`.`a`)) where 1
+Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t3`.`a`)) on(`test`.`t1`.`a` = `test`.`t3`.`a`) where 1
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);
@@ -1462,7 +1460,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join (`test`.`t2`) on((`test`.`t2`.`a` = `test`.`t3`.`a`))) on((`test`.`t1`.`a` = `test`.`t3`.`a`)) where 1
+Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join (`test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`)) on(`test`.`t1`.`a` = `test`.`t3`.`a`) where 1
prepare stmt1 from "select * from t3 left join v4 on (t3.a = v4.a);";
execute stmt1;
a a b
@@ -1494,7 +1492,7 @@ a
create view v2 (a,b) as select t1.b as a, t2.a as b from t1, t2;
set updatable_views_with_limit=NO;
update v2 set a= 10 where a=200 limit 1;
-ERROR HY000: The target table t1 of the UPDATE is not updatable
+ERROR HY000: The target table v2 of the UPDATE is not updatable
set updatable_views_with_limit=DEFAULT;
select * from v3;
a b
@@ -1581,22 +1579,22 @@ execute stmt1 using @a;
deallocate prepare stmt1;
select * from v3;
a b
-100 1000
-101 1000
-300 1000
-301 1000
+100 0
100 10
-101 10
-300 10
-301 10
+100 1000
100 2000
-101 2000
-300 2000
-301 2000
-100 0
101 0
+101 10
+101 1000
+101 2000
300 0
+300 10
+300 1000
+300 2000
301 0
+301 10
+301 1000
+301 2000
drop view v3;
drop tables t1,t2;
create table t1(f1 int);
@@ -1920,24 +1918,24 @@ 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;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t2`.`b` AS `b`,(`t1`.`a` < now()) AS `t1.a < now()` from (`t1` join `t2`) where (`t1`.`a` < now()) latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t2`.`b` AS `b`,`t1`.`a` < current_timestamp() AS `t1.a < now()` from (`t1` join `t2`) where `t1`.`a` < current_timestamp() latin1 latin1_swedish_ci
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;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` = current_user()) latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where `t1`.`a` = current_user() latin1 latin1_swedish_ci
DROP VIEW v1;
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = VERSION();
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` = version()) latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where `t1`.`a` = version() latin1 latin1_swedish_ci
DROP VIEW v1;
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = DATABASE();
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` = database()) latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where `t1`.`a` = database() latin1 latin1_swedish_ci
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (col1 time);
@@ -2033,7 +2031,7 @@ create view v1 as select f59, f60 from t1 where f59 in
update v1 set f60=2345;
ERROR HY000: The target table v1 of the UPDATE is not updatable
update t1 set f60=(select max(f60) from v1);
-ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't1'.
+ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't1'
drop view v1;
drop table t1;
create table t1 (s1 int);
@@ -2677,7 +2675,7 @@ create view v2 as select * from v1;
drop table t1;
rename table v2 to t1;
select * from v1;
-ERROR HY000: Recursive stored functions and triggers are not allowed.
+ERROR HY000: Recursive stored functions and triggers are not allowed
drop function f1;
drop view t1, v1;
create table t1 (dt datetime);
@@ -2712,7 +2710,7 @@ SELECT id, date(d) + INTERVAL TIME_TO_SEC(d) SECOND AS t, COUNT(*)
FROM t1 GROUP BY id, t;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`id` AS `id`,(cast(`t1`.`d` as date) + interval time_to_sec(`t1`.`d`) second) AS `t`,count(0) AS `COUNT(*)` from `t1` group by `t1`.`id`,(cast(`t1`.`d` as date) + interval time_to_sec(`t1`.`d`) second) latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`id` AS `id`,cast(`t1`.`d` as date) + interval time_to_sec(`t1`.`d`) second AS `t`,count(0) AS `COUNT(*)` from `t1` group by `t1`.`id`,cast(`t1`.`d` as date) + interval time_to_sec(`t1`.`d`) second latin1 latin1_swedish_ci
SELECT * FROM v1;
id t COUNT(*)
DROP VIEW v1;
@@ -2741,7 +2739,7 @@ SELECT (year(test_date)-year(DOB)) AS Age
FROM t1 HAVING Age < 75;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (year(`t1`.`test_date`) - year(`t1`.`DOB`)) AS `Age` from `t1` having (`Age` < 75) latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select year(`t1`.`test_date`) - year(`t1`.`DOB`) AS `Age` from `t1` having `Age` < 75 latin1 latin1_swedish_ci
SELECT (year(test_date)-year(DOB)) AS Age FROM t1 HAVING Age < 75;
Age
43
@@ -2796,7 +2794,7 @@ DROP VIEW v1;
DROP TABLE t1,t2;
CREATE TABLE t1 (a INT NOT NULL, b INT NULL DEFAULT NULL);
CREATE VIEW v1 AS SELECT a, b FROM t1;
-INSERT INTO v1 (b) VALUES (2);
+INSERT IGNORE INTO v1 (b) VALUES (2);
Warnings:
Warning 1423 Field of view 'test.v1' underlying table doesn't have a default value
SET SQL_MODE = STRICT_ALL_TABLES;
@@ -2912,17 +2910,24 @@ 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;
x
1
@@ -2931,14 +2936,17 @@ 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;
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;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` where (`t1`.`f1` between now() and (now() + interval 1 minute)) latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` where `t1`.`f1` between current_timestamp() and current_timestamp() + interval 1 minute latin1 latin1_swedish_ci
drop view v1;
drop table t1;
DROP TABLE IF EXISTS t1;
@@ -3015,7 +3023,7 @@ SHOW WARNINGS;
Level Code Message
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`pk` AS `pk` from (`t1` join `t2` on(((`t2`.`fk` = `t1`.`pk`) and (`t2`.`ver` = (select max(`t`.`ver`) from `t2` `t` where (`t`.`org` = `t2`.`org`)))))) latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`pk` AS `pk` from (`t1` join `t2` on(`t2`.`fk` = `t1`.`pk` and `t2`.`ver` = (select max(`t`.`ver`) from `t2` `t` where `t`.`org` = `t2`.`org`))) latin1 latin1_swedish_ci
DROP VIEW v1;
DROP TABLE t1, t2;
DROP FUNCTION IF EXISTS f1;
@@ -3037,9 +3045,9 @@ CREATE VIEW v1 AS SELECT id, val FROM t1 WHERE val >= 1 AND val <= 5 WITH CHECK
INSERT INTO v1 (val) VALUES (2);
INSERT INTO v1 (val) VALUES (4);
INSERT INTO v1 (val) VALUES (6);
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
UPDATE v1 SET val=6 WHERE id=2;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
DROP VIEW v1;
DROP TABLE t1;
DROP VIEW IF EXISTS v1, v2;
@@ -3079,7 +3087,7 @@ DROP TABLE t1;
CREATE VIEW v AS SELECT !0 * 5 AS x FROM DUAL;
SHOW CREATE VIEW v;
View Create View character_set_client collation_connection
-v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select ((not(0)) * 5) AS `x` latin1 latin1_swedish_ci
+v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select !0 * 5 AS `x` latin1 latin1_swedish_ci
SELECT !0 * 5 AS x FROM DUAL;
x
5
@@ -3125,7 +3133,7 @@ b
1
2
UPDATE v1 SET b=3;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM v1;
b
1
@@ -3176,7 +3184,7 @@ explain extended select * from v1 order by f1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 100.00 Using filesort
Warnings:
-Note 1926 View 'test'.'v1' ORDER BY clause ignored because there is other ORDER BY clause already.
+Note 1926 View 'test'.'v1' ORDER BY clause ignored because there is other ORDER BY clause already
Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2` from `test`.`t1` order by `test`.`t1`.`f1`
drop view v1;
drop table t1;
@@ -3199,15 +3207,11 @@ code COUNT(DISTINCT country)
DROP VIEW v1;
DROP TABLE t1;
DROP VIEW IF EXISTS v1;
-SELECT * FROM (SELECT 1) AS t;
-1
-1
-CREATE VIEW v1 AS SELECT * FROM (SELECT 1) AS t;
-ERROR HY000: View's SELECT contains a subquery in the FROM clause
+SELECT * FROM (SELECT 1) AS t into @w;
+CREATE VIEW v1 AS SELECT * FROM (SELECT 1) AS t into @w;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'into @w' at line 1
# Previously the following would fail.
-SELECT * FROM (SELECT 1) AS t;
-1
-1
+SELECT * FROM (SELECT 1) AS t into @w;
drop view if exists view_24532_a;
drop view if exists view_24532_b;
drop table if exists table_24532;
@@ -3317,7 +3321,7 @@ a IS NOT FALSE int(1) NO 0
old_isnotfalse int(1) NO 0
show create view view_24532_b;
View Create View character_set_client collation_connection
-view_24532_b CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_24532_b` AS select (`table_24532`.`a` is true) AS `a IS TRUE`,if(ifnull(`table_24532`.`a`,0),1,0) AS `old_istrue`,(`table_24532`.`a` is not true) AS `a IS NOT TRUE`,if(ifnull(`table_24532`.`a`,0),0,1) AS `old_isnottrue`,(`table_24532`.`a` is false) AS `a IS FALSE`,if(ifnull(`table_24532`.`a`,1),0,1) AS `old_isfalse`,(`table_24532`.`a` is not false) AS `a IS NOT FALSE`,if(ifnull(`table_24532`.`a`,1),1,0) AS `old_isnotfalse` from `table_24532` latin1 latin1_swedish_ci
+view_24532_b CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_24532_b` AS select `table_24532`.`a` is true AS `a IS TRUE`,if(ifnull(`table_24532`.`a`,0),1,0) AS `old_istrue`,`table_24532`.`a` is not true AS `a IS NOT TRUE`,if(ifnull(`table_24532`.`a`,0),0,1) AS `old_isnottrue`,`table_24532`.`a` is false AS `a IS FALSE`,if(ifnull(`table_24532`.`a`,1),0,1) AS `old_isfalse`,`table_24532`.`a` is not false AS `a IS NOT FALSE`,if(ifnull(`table_24532`.`a`,1),1,0) AS `old_isnotfalse` from `table_24532` latin1 latin1_swedish_ci
insert into table_24532 values (0, 0, 0, 0);
select * from view_24532_b;
a IS TRUE old_istrue a IS NOT TRUE old_isnottrue a IS FALSE old_isfalse a IS NOT FALSE old_isnotfalse
@@ -3461,14 +3465,14 @@ a1 c
1 0
2 0
UPDATE v1 SET c=3;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
PREPARE t FROM 'UPDATE v1 SET c=3';
EXECUTE t;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
EXECUTE t;
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
INSERT INTO v1(a1, c) VALUES (3, 3);
-ERROR HY000: CHECK OPTION failed 'test.v1'
+ERROR 44000: CHECK OPTION failed `test`.`v1`
UPDATE v1 SET c=1 WHERE a1=1;
SELECT * FROM v1;
a1 c
@@ -3487,14 +3491,14 @@ a1 c
1 1
2 0
UPDATE v2 SET c=3;
-ERROR HY000: CHECK OPTION failed 'test.v2'
+ERROR 44000: CHECK OPTION failed `test`.`v2`
PREPARE t FROM 'UPDATE v2 SET c=3';
EXECUTE t;
-ERROR HY000: CHECK OPTION failed 'test.v2'
+ERROR 44000: CHECK OPTION failed `test`.`v2`
EXECUTE t;
-ERROR HY000: CHECK OPTION failed 'test.v2'
+ERROR 44000: CHECK OPTION failed `test`.`v2`
INSERT INTO v2(a1, c) VALUES (3, 3);
-ERROR HY000: CHECK OPTION failed 'test.v2'
+ERROR 44000: CHECK OPTION failed `test`.`v2`
UPDATE v2 SET c=2 WHERE a1=1;
SELECT * FROM v2;
a1 c
@@ -3637,7 +3641,7 @@ DROP TABLE t1;
#
create table t1(f1 int, f2 int not null);
create view v1 as select f1 from t1;
-insert into v1 values(1);
+insert ignore into v1 values(1);
Warnings:
Warning 1423 Field of view 'test.v1' underlying table doesn't have a default value
set @old_mode=@@sql_mode;
@@ -3854,7 +3858,7 @@ CREATE TABLE t1 (c INT);
CREATE VIEW v1 (view_column) AS SELECT c AS alias FROM t1 HAVING alias;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`c` AS `view_column` from `t1` having (`view_column` <> 0) latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`c` AS `view_column` from `t1` having `view_column` <> 0 latin1 latin1_swedish_ci
SELECT * FROM v1;
view_column
@@ -4090,7 +4094,7 @@ ERROR HY000: The target table v1 of the INSERT is not insertable-into
DELETE from v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
UPDATE v3 SET b= 10;
-ERROR HY000: The target table v2 of the UPDATE is not updatable
+ERROR HY000: The target table v3 of the UPDATE is not updatable
REPLACE v3 SET b= 10;
ERROR HY000: The target table v3 of the INSERT is not insertable-into
INSERT into v3(b) values (20);
@@ -4252,7 +4256,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 16 100.00 Using where
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`pk` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 8))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`pk` = `test`.`t1`.`a` and `test`.`t1`.`a` > 8
FLUSH STATUS;
SELECT t1.a,t2.c FROM t1,t2 WHERE t2.pk = t1.a AND t2.pk > 8;
a c
@@ -4276,7 +4280,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 16 100.00 Using where
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`pk` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 8))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`pk` = `test`.`t1`.`a` and `test`.`t1`.`a` > 8
FLUSH STATUS;
SELECT t1.a,v.c FROM t1,v WHERE v.pk = t1.a AND v.pk > 8;
a c
@@ -4335,7 +4339,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where (((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 3)) or ((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t1`.`b` >= 4)))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3 or `test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t1`.`b` >= 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;
a b c
@@ -4349,7 +4353,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where (((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 3)) or ((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t1`.`b` >= 4)))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3 or `test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t1`.`b` >= 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;
a b c
@@ -4363,7 +4367,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where (((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 3)) or ((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t1`.`b` >= 4)))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3 or `test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t1`.`b` >= 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;
a b c
@@ -4377,7 +4381,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where (((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 3)) or ((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t1`.`b` >= 4)))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3 or `test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t1`.`b` >= 4
drop view v1,v2,v3;
drop table t1,t2;
#
@@ -4400,7 +4404,7 @@ SELECT * FROM v1 WHERE a > -1 OR a > 6 AND a = 3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > <cache>(-(1)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > -1
SELECT * FROM v1 WHERE a > -1 OR a AND a = 0;
a
2
@@ -4415,7 +4419,7 @@ SELECT * FROM v1 WHERE a > -1 OR a AND a = 0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > <cache>(-(1)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > -1
CREATE VIEW v2 AS SELECT * FROM v1;
SELECT * FROM v2 WHERE a > -1 OR a AND a = 0;
a
@@ -4431,7 +4435,7 @@ SELECT * FROM v2 WHERE a > -1 OR a AND a = 0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > <cache>(-(1)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > -1
DROP VIEW v1,v2;
DROP TABLE t1;
CREATE TABLE t1 (a varchar(10), KEY (a)) ;
@@ -4457,13 +4461,13 @@ SELECT * FROM v1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` > 'JJ') or ((`test`.`t1`.`a` = 'VV') and (`test`.`t1`.`a` <> 0)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 'JJ' or `test`.`t1`.`a` = 'VV' and `test`.`t1`.`a` <> 0
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` > 'JJ') or ((`test`.`t1`.`a` = 'VV') and (`test`.`t1`.`a` <> 0)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 'JJ' or `test`.`t1`.`a` = 'VV' and `test`.`t1`.`a` <> 0
# t1 and v1 should return the same result set
SELECT * FROM v1 WHERE a > 'JJ' OR a AND a = 'VV';
a
@@ -4483,13 +4487,13 @@ SELECT * FROM v1 WHERE a > 'JJ' OR a AND a = 'VV';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` > 'JJ') or ((`test`.`t1`.`a` = 'VV') and (`test`.`t1`.`a` <> 0)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 'JJ' or `test`.`t1`.`a` = 'VV' and `test`.`t1`.`a` <> 0
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE a > 'JJ' OR a AND a = 'VV';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` > 'JJ') or ((`test`.`t1`.`a` = 'VV') and (`test`.`t1`.`a` <> 0)))
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 'JJ' or `test`.`t1`.`a` = 'VV' and `test`.`t1`.`a` <> 0
DROP VIEW v1;
DROP TABLE t1;
#
@@ -4558,7 +4562,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` left join `test`.`t2` on((`test`.`t2`.`a` = `test`.`t1`.`a`)) where ((`test`.`t1`.`b` = 1) or ((`test`.`t1`.`a` = 'a') and (length(`test`.`t1`.`a`) >= `test`.`t1`.`b`)))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t1`.`a`) where `test`.`t1`.`b` = 1 or `test`.`t1`.`a` = 'a' and length(`test`.`t1`.`a`) >= `test`.`t1`.`b`
DROP VIEW v1;
DROP TABLE t1,t2;
# Bug#798625: duplicate of the previous one, but without crash
@@ -4638,7 +4642,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
5 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00
3 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
-Note 1926 View 'test'.'v2' ORDER BY clause ignored because there is other ORDER BY clause already.
+Note 1926 View 'test'.'v2' ORDER BY clause ignored because there is other ORDER BY clause already
Note 1003 select `v1`.`f1` AS `f1`,`v1`.`f1` AS `f1` from `test`.`v1` join `test`.`v1` order by `v1`.`f1`
DROP VIEW v1, v2;
DROP TABLE t1;
@@ -4665,7 +4669,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where (not(<expr_cache><10,`test`.`t1`.`a`>(<in_optimizer>(10,<exists>(select NULL from `test`.`t4` where ((`test`.`t4`.`a` >= `test`.`t1`.`a`) and trigcond(((<cache>(10) = NULL) or <cache>(isnull(NULL))))) having trigcond(<is_not_null_test>(NULL)))))))
+Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<expr_cache><10,`test`.`t1`.`a`>(<in_optimizer>(10,<exists>(select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond(<cache>(10) = NULL or <cache>(NULL is null)) having trigcond(NULL is null))))
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);
@@ -4681,7 +4685,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'v1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where (not(<expr_cache><10,`test`.`t1`.`a`>(<in_optimizer>(10,<exists>(select NULL from `test`.`t4` where ((`test`.`t4`.`a` >= `test`.`t1`.`a`) and trigcond(((<cache>(10) = NULL) or <cache>(isnull(NULL))))) having trigcond(<is_not_null_test>(NULL)))))))
+Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<expr_cache><10,`test`.`t1`.`a`>(<in_optimizer>(10,<exists>(select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond(<cache>(10) = NULL or <cache>(NULL is null)) having trigcond(NULL is null))))
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);
@@ -4712,7 +4716,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
Note 1276 Field or reference 'test.t4.b' of SELECT #2 was resolved in SELECT #1
-Note 1003 select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where (`test`.`t4`.`c` <= <expr_cache><`test`.`t4`.`b`>((select 0 from dual where (7 > `test`.`t4`.`b`))))
+Note 1003 select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where `test`.`t4`.`c` <= <expr_cache><`test`.`t4`.`b`>((select 0 from dual where 7 > `test`.`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);
@@ -4729,7 +4733,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
Note 1276 Field or reference 'v4.b' of SELECT #2 was resolved in SELECT #1
-Note 1003 select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where (`test`.`t4`.`c` <= <expr_cache><`test`.`t4`.`b`>((select 0 from dual where (7 > `test`.`t4`.`b`))))
+Note 1003 select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where `test`.`t4`.`c` <= <expr_cache><`test`.`t4`.`b`>((select 0 from dual where 7 > `test`.`t4`.`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);
@@ -4742,13 +4746,13 @@ drop view if exists v_9801;
create table t_9801 (s1 int);
create view v_9801 as
select sum(s1) from t_9801 with check option;
-ERROR HY000: CHECK OPTION on non-updatable view 'test.v_9801'
+ERROR HY000: CHECK OPTION on non-updatable view `test`.`v_9801`
create view v_9801 as
select sum(s1) from t_9801 group by s1 with check option;
-ERROR HY000: CHECK OPTION on non-updatable view 'test.v_9801'
+ERROR HY000: CHECK OPTION on non-updatable view `test`.`v_9801`
create view v_9801 as
select sum(s1) from t_9801 group by s1 with rollup with check option;
-ERROR HY000: CHECK OPTION on non-updatable view 'test.v_9801'
+ERROR HY000: CHECK OPTION on non-updatable view `test`.`v_9801`
drop table t_9801;
#
# Bug #47335 assert in get_table_share
@@ -4786,35 +4790,46 @@ DROP TABLE t1, t2;
# Bug#48315 Metadata lock is not taken for merged views that
# use an INFORMATION_SCHEMA table
#
-DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
DROP PROCEDURE IF EXISTS p1;
-# Connection default
+connect con2, localhost, root;
+connect con3, localhost, root;
+connection default;
CREATE VIEW v1 AS SELECT schema_name FROM information_schema.schemata;
-CREATE TABLE t1 (str VARCHAR(50));
-CREATE PROCEDURE p1() INSERT INTO t1 SELECT * FROM v1;
+CREATE PROCEDURE p1() SELECT COUNT(*), GET_LOCK('blocker', 100) FROM v1;
# CALL p1() so the view is merged.
CALL p1();
-# Connection 3
-LOCK TABLE t1 READ;
-# Connection default
-# Try to CALL p1() again, this time it should block for t1.
+SELECT RELEASE_LOCK('blocker');
+RELEASE_LOCK('blocker')
+1
+connection con3;
+SELECT GET_LOCK('blocker', 100);
+GET_LOCK('blocker', 100)
+1
+connection default;
+# Try to CALL p1() again, this time it should block on "blocker".
# Sending:
CALL p1();
-# Connection 2
+connection con2;
# ... then try to drop the view. This should block.
# Sending:
DROP VIEW v1;
-# Connection 3
+connection con3;
# Now allow CALL p1() to complete
-UNLOCK TABLES;
-# Connection default
+SELECT RELEASE_LOCK('blocker');
+RELEASE_LOCK('blocker')
+1
+connection default;
# Reaping: CALL p1()
-# Connection 2
+SELECT RELEASE_LOCK('blocker');
+RELEASE_LOCK('blocker')
+1
+connection con2;
# Reaping: DROP VIEW v1
-# Connection default
+connection default;
DROP PROCEDURE p1;
-DROP TABLE t1;
+disconnect con2;
+disconnect con3;
#
# Bug#12626844: WRONG ERROR MESSAGE WHILE CREATING A VIEW ON A
# NON EXISTING DATABASE
@@ -5356,7 +5371,7 @@ DROP FUNCTION f1;
DROP VIEW v1;
DROP TABLE t1, t2;
create view v1 as select 1;
-FOUND /mariadb-version/ in v1.frm
+FOUND 1 /mariadb-version/ in v1.frm
drop view v1;
#
# MDEV-7260: Crash in get_best_combination when executing multi-table
@@ -5378,15 +5393,15 @@ create table t1 (a int, b int);
create algorithm=temptable view v2 (c) as select b+1 from t1;
show create view v2;
View Create View character_set_client collation_connection
-v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
+v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci
alter algorithm=undefined view v2 (c) as select b+1 from t1;
show create view v2;
View Create View character_set_client collation_connection
-v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci
alter algorithm=merge view v2 (c) as select b+1 from t1;
show create view v2;
View Create View character_set_client collation_connection
-v2 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
+v2 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci
drop view v2;
drop table t1;
#
@@ -5508,7 +5523,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where
1 SIMPLE t3 ref f,e e 5 test.t2.d 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`e` = `test`.`t2`.`d`) and (`test`.`t3`.`f` is not null) and (`test`.`t1`.`b` is not null) and (`test`.`t2`.`d` is not null))) where (`test`.`t1`.`a` < 5)
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t3`.`e` = `test`.`t2`.`d` and `test`.`t3`.`f` is not null and `test`.`t1`.`b` is not null and `test`.`t2`.`d` is not null) where `test`.`t1`.`a` < 5
explain extended
select *
from t1 left join ( t2 left join t3 on t3.e=t2.d )
@@ -5519,7 +5534,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where
1 SIMPLE t3 ref f,e e 5 test.t2.d 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`e` = `test`.`t2`.`d`) and (`test`.`t3`.`f` is not null) and (`test`.`t1`.`b` is not null) and (`test`.`t2`.`d` is not null))) where (`test`.`t1`.`a` < 5)
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t3`.`e` = `test`.`t2`.`d` and `test`.`t3`.`f` is not null and `test`.`t1`.`b` is not null and `test`.`t2`.`d` is not null) where `test`.`t1`.`a` < 5
explain extended
select *
from t1 left join v1 on v1.c=t1.b and v1.f=t1.a
@@ -5529,7 +5544,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 eq_ref f,e f 4 test.t1.a 1 100.00 Using where
1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`f` = `test`.`t1`.`a`) and (`test`.`t2`.`d` = `test`.`t3`.`e`) and (`test`.`t1`.`a` is not null) and (`test`.`t1`.`a` is not null) and (`test`.`t1`.`b` is not null))) where (`test`.`t1`.`a` < 5)
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t3`.`f` = `test`.`t1`.`a` and `test`.`t2`.`d` = `test`.`t3`.`e` and `test`.`t1`.`a` is not null and `test`.`t1`.`a` is not null and `test`.`t1`.`b` is not null) where `test`.`t1`.`a` < 5
explain extended
select *
from t1 left join ( t2 left join t3 on t3.e=t2.d )
@@ -5540,7 +5555,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 eq_ref f,e f 4 test.t1.a 1 100.00 Using where
1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`f` = `test`.`t1`.`a`) and (`test`.`t2`.`d` = `test`.`t3`.`e`) and (`test`.`t1`.`a` is not null) and (`test`.`t1`.`a` is not null) and (`test`.`t1`.`b` is not null))) where (`test`.`t1`.`a` < 5)
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t3`.`f` = `test`.`t1`.`a` and `test`.`t2`.`d` = `test`.`t3`.`e` and `test`.`t1`.`a` is not null and `test`.`t1`.`a` is not null and `test`.`t1`.`b` is not null) where `test`.`t1`.`a` < 5
drop view v1;
drop table t1,t2,t3;
#
@@ -5781,7 +5796,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
-Note 1003 select `test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) AS `c` from `test`.`t1`
+Note 1003 select `test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) AS `c` from `test`.`t1`
select * from v1;
a c
1 2
@@ -5798,7 +5813,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) AS `c` from `test`.`t2` join `test`.`t1` where (`test`.`t1`.`a` = `test`.`t2`.`a`)
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) AS `c` from `test`.`t2` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2, v1 where t2.a=v1.a;
a b a c
1 2 1 2
@@ -5817,7 +5832,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) AS `c` from `test`.`t1` join `test`.`t1` where (`test`.`t1`.`a` = `test`.`t1`.`a`)
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) AS `c` from `test`.`t1` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t1`.`a`
select * from t1, v1 where t1.a=v1.a;
a b a c
1 2 1 2
@@ -5836,7 +5851,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) AS `c` from `test`.`t1` join `test`.`t1` where (`test`.`t1`.`b` = (select max(`test`.`t2`.`b`) from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) AS `c` from `test`.`t1` join `test`.`t1` where `test`.`t1`.`b` = (select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)
select * from t1, v1 where t1.b=v1.c;
a b a c
1 2 1 2
@@ -5854,7 +5869,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) AS `c` from `test`.`t2` join `test`.`t1` join `test`.`t1` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`))
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a`,(select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) AS `c` from `test`.`t2` join `test`.`t1` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`a` = `test`.`t2`.`a`
select * from t2, t1, v1 where t1.a=t2.a and t1.a=v1.a;
a b a b a c
1 2 1 2 1 2
@@ -6107,7 +6122,7 @@ NULL
CREATE VIEW test.v_no_db AS SELECT DATABASE() = 'temporary_two';
SHOW CREATE VIEW test.v_no_db;
View Create View character_set_client collation_connection
-v_no_db CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v_no_db` AS select (database() = 'temporary_two') AS `DATABASE() = 'temporary_two'` latin1 latin1_swedish_ci
+v_no_db CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v_no_db` AS select database() = 'temporary_two' AS `DATABASE() = 'temporary_two'` latin1 latin1_swedish_ci
PREPARE prepared_no_database FROM "SELECT DATABASE() = 'temporary_two'";
#
# All statements should return NULL
@@ -6261,3 +6276,479 @@ drop table t1,t2;
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+# 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;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `a` union select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
+SELECT * FROM v1;
+a
+1
+10
+20
+30
+DROP VIEW v1;
+CREATE VIEW v1 AS SELECT 1 AS a UNION SELECT a FROM t1 LIMIT 1;
+SHOW CREATE VIEW v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `a` union select `t1`.`a` AS `a` from `t1` limit 1 latin1 latin1_swedish_ci
+SELECT * FROM v1;
+a
+1
+DROP VIEW v1;
+CREATE VIEW v1 AS SELECT 1 AS a UNION (SELECT a FROM t1);
+SHOW CREATE VIEW v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `a` union (select `t1`.`a` AS `a` from `t1`) latin1 latin1_swedish_ci
+SELECT * FROM v1;
+a
+1
+10
+20
+30
+DROP VIEW v1;
+CREATE VIEW v1 AS SELECT 1 AS a UNION (SELECT a FROM t1 LIMIT 1);
+SHOW CREATE VIEW v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `a` union (select `t1`.`a` AS `a` from `t1` limit 1) latin1 latin1_swedish_ci
+SELECT * FROM v1;
+a
+1
+10
+DROP VIEW v1;
+CREATE VIEW v1 AS SELECT 1 AS a UNION (SELECT a FROM t1) LIMIT 1;
+SHOW CREATE VIEW v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `a` union (select `t1`.`a` AS `a` from `t1`) limit 1 latin1 latin1_swedish_ci
+SELECT * FROM v1;
+a
+1
+DROP VIEW v1;
+DROP TABLE t1;
+#
+# MDEV-9408 CREATE TABLE SELECT MAX(int_column) creates different columns for table vs view
+#
+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;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `code` int(11) DEFAULT NULL,
+ `COUNT(DISTINCT country)` bigint(21) NOT NULL,
+ `MAX(id)` int(11)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+CREATE TABLE t3 AS
+SELECT code, COUNT(DISTINCT country), MAX(id) FROM v1 GROUP BY code ORDER BY MAX(id);
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `code` int(11) DEFAULT NULL,
+ `COUNT(DISTINCT country)` bigint(21) NOT NULL,
+ `MAX(id)` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP VIEW v1;
+DROP TABLE t1,t2,t3;
+#
+# MDEV-3944: Allow derived tables in VIEWS
+#
+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;
+select * from v1;
+s1
+2
+3
+select * from v2;
+s1
+1
+2
+select * from v1 natural join v2;
+s1
+2
+select * from v1 natural join t1;
+s1
+2
+3
+select * from v1 natural join (SELECT s1 FROM t1 WHERE s1<3) as x;
+s1
+2
+select * from v1 left join v2 on (v1.s1=v2.s1);
+s1 s1
+2 2
+3 NULL
+select * from v1 left join t1 on (v1.s1=t1.s1);
+s1 s1
+2 2
+3 3
+select * from t1 left join v2 on (t1.s1=v2.s1);
+s1 s1
+1 1
+2 2
+3 NULL
+select * from v1 left join (SELECT s1 FROM t1 WHERE s1<3) as x on (v1.s1=x.s1);
+s1 s1
+2 2
+3 NULL
+select * from (SELECT s1 FROM t1 WHERE s1>1) AS x left join v2 on (x.s1=v2.s1);
+s1 s1
+2 2
+3 NULL
+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);
+select * from t1;
+s1
+-200
+1
+2
+200
+3
+select * from v1;
+s1
+2
+3
+select * from v2;
+s1
+1
+2
+select * from v1 natural join v2;
+s1
+2
+select * from v1 natural join t1;
+s1
+2
+3
+select * from v1 natural join (SELECT s1 FROM t1 WHERE s1<3) as x;
+s1
+2
+select * from v1 left join v2 on (v1.s1=v2.s1);
+s1 s1
+2 2
+3 NULL
+select * from v1 left join t1 on (v1.s1=t1.s1);
+s1 s1
+2 2
+3 3
+select * from t1 left join v2 on (t1.s1=v2.s1);
+s1 s1
+-200 NULL
+1 1
+2 2
+200 NULL
+3 NULL
+select * from v1 left join (SELECT s1 FROM t1 WHERE s1<3) as x on (v1.s1=x.s1);
+s1 s1
+2 2
+3 NULL
+select * from (SELECT s1 FROM t1 WHERE s1>1) AS x left join v2 on (x.s1=v2.s1);
+s1 s1
+2 2
+200 NULL
+3 NULL
+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;
+select * from t1;
+s1
+-200
+1
+2
+200
+3
+select * from v1;
+s1
+2
+3
+select * from v2;
+s1
+1
+2
+select * from v1 natural join v2;
+s1
+2
+select * from v1 natural join t1;
+s1
+2
+3
+select * from v1 natural join (SELECT s1 FROM t1 WHERE s1<3) as x;
+s1
+2
+select * from v1 left join v2 on (v1.s1=v2.s1);
+s1 s1
+2 2
+3 NULL
+select * from v1 left join t1 on (v1.s1=t1.s1);
+s1 s1
+2 2
+3 3
+select * from t1 left join v2 on (t1.s1=v2.s1);
+s1 s1
+-200 NULL
+1 1
+2 2
+200 NULL
+3 NULL
+select * from v1 left join (SELECT s1 FROM t1 WHERE s1<3) as x on (v1.s1=x.s1);
+s1 s1
+2 2
+3 NULL
+select * from (SELECT s1 FROM t1 WHERE s1>1) AS x left join v2 on (x.s1=v2.s1);
+s1 s1
+2 2
+200 NULL
+3 NULL
+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;
+insert into v1 values (-300);
+ERROR HY000: The target table v1 of the INSERT is not insertable-into
+update v1 set s1=s1+1;
+ERROR HY000: The target table v1 of the UPDATE is not updatable
+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;
+s1 s2
+1 1
+2 2
+3 3
+-200 -200
+insert into v1 (s1) values (-300);
+update v1 set s1=s1+1;
+select * from v1;
+s1 s2
+2 2
+3 3
+4 4
+-199 -199
+-299 -299
+select * from t1;
+s1
+2
+3
+4
+200
+-199
+-299
+insert into v1(s2) values (-300);
+ERROR HY000: The target table v1 of the INSERT is not insertable-into
+update v1 set s2=s2+1;
+ERROR HY000: The target table v1 of the UPDATE is not updatable
+drop view v1;
+CREATE VIEW v1 AS SELECT * FROM (SELECT s1 FROM t1 WHERE s1
+< 100) AS x;
+insert into v1 values (-300);
+ERROR HY000: The target table v1 of the INSERT is not insertable-into
+update v1 set s1=s1+1;
+ERROR HY000: The target table v1 of the UPDATE is not updatable
+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;
+insert into v1 values (-300);
+ERROR HY000: The target table v1 of the INSERT is not insertable-into
+update v1 set s1=s1+1;
+ERROR HY000: The target table v1 of the UPDATE is not updatable
+create view v2 as select * from v1;
+insert into v2 values (-300);
+ERROR HY000: The target table v2 of the INSERT is not insertable-into
+update v2 set s1=s1+1;
+ERROR HY000: The target table v2 of the UPDATE is not updatable
+drop view v1, v2;
+drop table t1;
+#
+# MDEV-9671:Wrong result upon select from a view with a FROM subquery
+#
+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;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i`,`alias1`.`j` AS `j` from (`test`.`t1` left join (select `test`.`t2`.`j` AS `j` from (`test`.`t2` join `test`.`t3` on(`test`.`t3`.`k` = `test`.`t2`.`j`))) `alias1` on(`test`.`t1`.`i` = `alias1`.`j`)) latin1 latin1_swedish_ci
+SELECT * FROM t1 LEFT JOIN ( SELECT t2.* FROM t2 INNER JOIN t3 ON ( k = j ) ) AS alias1 ON ( i = j );
+i j
+3 NULL
+2 NULL
+SELECT * FROM v1;
+i j
+3 NULL
+2 NULL
+DROP VIEW v1;
+DROP TABLE t1, t2, t3;
+#
+# MDEV-10035: DBUG_ASSERT on CREATE VIEW v1 AS SELECT * FROM t1
+# FOR UPDATE
+#
+CREATE TABLE t1 (a INT);
+insert into t1 values (1),(2);
+CREATE VIEW v1 AS SELECT * FROM t1 FOR UPDATE;
+SHOW CREATE VIEW v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` for update latin1 latin1_swedish_ci
+select * from v1;
+a
+1
+2
+DROP VIEW v1;
+CREATE VIEW v1 AS SELECT * FROM t1 LOCK IN SHARE MODE;
+SHOW CREATE VIEW v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` lock in share mode latin1 latin1_swedish_ci
+select * from v1;
+a
+1
+2
+DROP VIEW v1;
+DROP TABLE t1;
+#
+# MDEV-10724:Assertion `vcol_table == 0 || vcol_table == table'
+# failed in fill_record(THD*, TABLE*, List<Item>&, List<Item>&,
+# bool, bool)
+#
+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;
+INSERT INTO v (f1, f3) VALUES (1,1), (2,2);
+ERROR HY000: Can not modify more than one base table through a join view 'test.v'
+drop view v;
+drop tables t1,t2,t3;
+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;
+(2, 3) not in (select i, j from t1)
+1
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select !((2,3) in (select `t1`.`i`,`t1`.`j` from `t1`)) AS `(2, 3) not in (select i, j from t1)` latin1 latin1_swedish_ci
+drop view v1;
+drop table t1;
+#
+# MDEV-10704: Assertion `field->field->table == table_arg'
+# failed in fill_record(THD*, TABLE*, List<Item>&, List<Item>&,
+# bool, bool)
+#
+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;
+REPLACE INTO v (f1,f2) VALUES (1,1);
+ERROR HY000: Can not modify more than one base table through a join view 'test.v'
+drop view v;
+drop table t1,t2,t3;
+#
+# MDEV-12379: Server crashes in TABLE_LIST::is_with_table on
+# SHOW CREATE VIEW
+#
+CREATE TABLE t (i INT);
+CREATE VIEW v AS SELECT * FROM ( SELECT * FROM t ) sq;
+DROP TABLE IF EXISTS t;
+SHOW CREATE VIEW v;
+View Create View character_set_client collation_connection
+v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `sq`.`i` AS `i` from (select `test`.`t`.`i` AS `i` from `test`.`t`) `sq` latin1 latin1_swedish_ci
+Warnings:
+Warning 1356 View 'test.v' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+DROP VIEW v;
+#
+# MDEV-13439: Database permissions are not enough to run a subquery
+# with GROUP BY within a view
+#
+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;
+i
+disconnect con1;
+connection default;
+use test;
+drop database test_db;
+drop user foo@localhost;
+#
+# MDEV-13523: Group By in a View, called within a Stored Routine
+# causes Error Code 1356 when a non-root user runs the routine for
+# a second time
+#
+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;
+id
+1
+2
+execute stmt;
+id
+1
+2
+disconnect con1;
+connection default;
+drop user procView;
+drop view procViewSimple;
+drop table procViewTable;
+use test;
+drop database bugTest;
+#
+# MDEV-13436: PREPARE doesn't work as expected & throws errors but
+# MySQL is working fine
+#
+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;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `testalias`.`testcase` AS `testcase` from (select case when 1 in (select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` < 2) then 1 end AS `testcase`) `testalias` latin1 latin1_swedish_ci
+SELECT * FROM v1;
+testcase
+1
+drop view v1;
+drop table t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/view_alias.result b/mysql-test/r/view_alias.result
index e07b40dba13..f3ae7aef3a6 100644
--- a/mysql-test/r/view_alias.result
+++ b/mysql-test/r/view_alias.result
@@ -90,7 +90,7 @@ CREATE TABLE t2 LIKE t1;
# Test alias in subquery
CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT 1 FROM t2 AS b WHERE b.a = 0);
DROP VIEW v1;
-CREATE VIEW v1 AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select 1 from `test`.`t2` `b` where (`b`.`a` = 0));
+CREATE VIEW v1 AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select 1 from `test`.`t2` `b` where `b`.`a` = 0);
DROP VIEW v1;
# Test column alias in subquery
CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT a AS alias FROM t1 GROUP BY alias);
diff --git a/mysql-test/r/view_debug.result b/mysql-test/r/view_debug.result
index 0aab5c5ac33..cfb70b5e74c 100644
--- a/mysql-test/r/view_debug.result
+++ b/mysql-test/r/view_debug.result
@@ -5,14 +5,19 @@ 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;
CALL proc();
ERROR HY000: View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
SET DEBUG_SYNC= 'after_cached_view_opened SIGNAL oppp WAIT_FOR created';
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;
3
3
SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result
index 525f9fbb5e1..04ad19c5ddc 100644
--- a/mysql-test/r/view_grant.result
+++ b/mysql-test/r/view_grant.result
@@ -11,12 +11,16 @@ show grants for test@localhost;
Grants for test@localhost
GRANT USAGE ON *.* TO 'test'@'localhost'
drop user test@localhost;
+connect root,localhost,root,,test;
+connection root;
create database mysqltest;
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;
create definer=root@localhost view v1 as select * from mysqltest.t1;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
create view v1 as select * from mysqltest.t1;
@@ -28,13 +32,16 @@ create view mysqltest.v2 as select * from mysqltest.t1;
ERROR 42000: CREATE VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2'
create view v2 as select * from mysqltest.t2;
ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2'
+connection root;
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` latin1 latin1_swedish_ci
grant create view,drop,select on test.* to mysqltest_1@localhost;
+connection user1;
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;
@@ -43,10 +50,12 @@ create database mysqltest;
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;
c
select d from mysqltest.v1;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 'v1'
+connection root;
revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop database mysqltest;
@@ -55,13 +64,16 @@ 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;
c
select d from mysqltest.v1;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 'v1'
+connection root;
revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop database mysqltest;
+connection root;
create database mysqltest;
create table mysqltest.t1 (a int, b int);
create table mysqltest.t2 (a int, b int);
@@ -76,6 +88,7 @@ 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;
select c from mysqltest.v1;
c
select c from mysqltest.v2;
@@ -114,23 +127,27 @@ explain select c from mysqltest.v5;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v5'
show create view mysqltest.v5;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v5'
+connection root;
grant select on mysqltest.v5 to mysqltest_1@localhost;
+connection user1;
show create view mysqltest.v5;
View Create View character_set_client collation_connection
-v5 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v5` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci
+v5 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v5` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci
explain select c from mysqltest.v1;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show create view mysqltest.v1;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1'
+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 select c from mysqltest.v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
show create view mysqltest.v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci
explain select c from mysqltest.v2;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show create view mysqltest.v2;
@@ -145,33 +162,37 @@ show create view mysqltest.v4;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v4'
explain select c from mysqltest.v5;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v5'
+connection root;
grant show view on mysqltest.* to mysqltest_1@localhost;
+connection user1;
explain select c from mysqltest.v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
show create view mysqltest.v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci
explain select c from mysqltest.v2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
show create view mysqltest.v2;
View Create View character_set_client collation_connection
-v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v2` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci
+v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v2` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci
explain select c from mysqltest.v3;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show create view mysqltest.v3;
View Create View character_set_client collation_connection
-v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v3` AS select (`mysqltest`.`t2`.`a` + 1) AS `c`,(`mysqltest`.`t2`.`b` + 1) AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v3` AS select `mysqltest`.`t2`.`a` + 1 AS `c`,`mysqltest`.`t2`.`b` + 1 AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci
explain select c from mysqltest.v4;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show create view mysqltest.v4;
View Create View character_set_client collation_connection
-v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v4` AS select (`mysqltest`.`t2`.`a` + 1) AS `c`,(`mysqltest`.`t2`.`b` + 1) AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci
+v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v4` AS select `mysqltest`.`t2`.`a` + 1 AS `c`,`mysqltest`.`t2`.`b` + 1 AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci
+connection root;
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop database mysqltest;
+connection root;
create database mysqltest;
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);
@@ -184,6 +205,7 @@ 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 t2,v1 set v1.a=v1.a+v1.c where t2.x=v1.c;
select * from t1;
@@ -226,9 +248,11 @@ ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table '
update v3 set a=a+c;
ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table 'v3'
use test;
+connection root;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop database mysqltest;
+connection root;
create database mysqltest;
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);
@@ -239,6 +263,7 @@ 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;
delete from v1 where c < 4;
select * from t1;
@@ -256,9 +281,11 @@ ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table '
delete from v2 where c < 4;
ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table 'v2'
use test;
+connection root;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop database mysqltest;
+connection root;
create database mysqltest;
create table mysqltest.t1 (a int, b int, primary key(a));
insert into mysqltest.t1 values (1,2), (2,3);
@@ -269,6 +296,7 @@ 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;
insert into v1 values (5,6);
select * from t1;
@@ -288,9 +316,11 @@ ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table '
insert into v2 select x,y from t2;
ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table 'v2'
use test;
+connection root;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop database mysqltest;
+connection root;
create database mysqltest;
create table mysqltest.t1 (a int, b int);
create table mysqltest.t2 (a int, b int);
@@ -298,46 +328,62 @@ 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;
create view mysqltest.v1 as select * from mysqltest.t1;
ERROR 42000: CREATE VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1'
create view v3 as select a from mysqltest.t2;
ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for column 'a' in table 't2'
+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;
+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;
create view v4 as select b+1 from mysqltest.t2;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't2'
+connection root;
grant create view,update,select on test.* to mysqltest_1@localhost;
+connection user1;
create view v4 as select b+1 from mysqltest.t2;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't2'
+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;
+connection root;
create database mysqltest;
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;
+connection root;
create database mysqltest;
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;
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` latin1 latin1_swedish_ci
@@ -351,6 +397,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop view v1;
drop database mysqltest;
+connection root;
create database mysqltest;
use mysqltest;
create table t1 (a int);
@@ -370,6 +417,7 @@ 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;
f2()
@@ -384,6 +432,7 @@ ERROR HY000: View 'mysqltest.v4' references invalid table(s) or column(s) or fun
select * from v5;
ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
use test;
+connection root;
drop view v1, v2, v3, v4, v5;
drop function f2;
drop table t1, t2;
@@ -391,6 +440,7 @@ use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop database mysqltest;
+connection root;
create database mysqltest;
use mysqltest;
create table t1 (a int);
@@ -403,12 +453,14 @@ 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;
select * from v1;
@@ -430,6 +482,7 @@ use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop database mysqltest;
+connection root;
create database mysqltest;
use mysqltest;
create table t1 (a int);
@@ -440,6 +493,7 @@ 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;
@@ -447,6 +501,7 @@ create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select *, a as b from
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;
select * from v1;
ERROR HY000: View 'mysqltest.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
@@ -465,6 +520,7 @@ use test;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop database mysqltest;
+connection root;
create database mysqltest;
use mysqltest;
create table t1 (a int);
@@ -480,6 +536,7 @@ 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;
a b
@@ -494,6 +551,7 @@ ERROR HY000: View 'mysqltest.v4' references invalid table(s) or column(s) or fun
select * from v5;
ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
use test;
+connection root;
drop view v1, v2, v3, v4, v5;
drop table t1;
use test;
@@ -507,6 +565,8 @@ delete from mysql.user where user='';
flush privileges;
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;
@@ -525,10 +585,13 @@ drop view v1;
select @v1def1, @v1def2, @v1def1=@v1def2;
@v1def1 @v1def2 @v1def1=@v1def2
test14256@% test14256@% 1
+connection root;
+disconnect test14256;
drop user test14256;
insert into mysql.user select * from t1;
flush privileges;
drop table t1;
+connection root;
create database mysqltest;
use mysqltest;
CREATE TABLE t1 (i INT);
@@ -538,15 +601,20 @@ View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
create user mysqltest_1@localhost;
GRANT SELECT, LOCK TABLES ON mysqltest.* TO mysqltest_1@localhost;
+connection user1;
use mysqltest;
LOCK TABLES v1 READ;
SHOW CREATE TABLE v1;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1'
UNLOCK TABLES;
use test;
+connection root;
use test;
drop user mysqltest_1@localhost;
drop database mysqltest;
+disconnect user1;
+disconnect root;
+connection default;
create definer=some_user@`` sql security invoker view v1 as select 1;
Warnings:
Note 1449 The user specified as a definer ('some_user'@'%') does not exist
@@ -579,6 +647,8 @@ 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;
SELECT * FROM mysqltest1.v_t1;
ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
INSERT INTO mysqltest1.v_t1 VALUES(4);
@@ -621,6 +691,8 @@ DELETE FROM mysqltest1.v_td WHERE x= 200;
ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for column 'x' in table 'v_td'
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;
@@ -648,6 +720,7 @@ DROP TABLE t1;
USE test;
CREATE USER mysqltest_db1@localhost identified by 'PWD';
GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION;
+connect session1,localhost,mysqltest_db1,PWD,test;
CREATE SCHEMA mysqltest_db1 ;
USE mysqltest_db1 ;
CREATE TABLE t1 (f1 INTEGER);
@@ -669,6 +742,8 @@ CREATE VIEW view3 AS
SELECT * FROM view2;
SELECT * from view3;
f1
+connection default;
+disconnect session1;
DROP VIEW mysqltest_db1.view3;
DROP VIEW mysqltest_db1.view2;
DROP VIEW mysqltest_db1.view1;
@@ -708,6 +783,7 @@ END|
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,,;
The following tests should all return 1.
@@ -733,6 +809,8 @@ cu = 'root@localhost'
SELECT cu = 'root@localhost' FROM v3;
cu = 'root@localhost'
1
+disconnect conn1;
+connection default;
DROP VIEW v3;
DROP FUNCTION f2;
DROP PROCEDURE p1;
@@ -740,6 +818,8 @@ DROP FUNCTION f1;
DROP VIEW v2;
DROP VIEW v1;
DROP USER mysqltest_u1@localhost;
+connect root,localhost,root,,;
+connection root;
CREATE DATABASE db17254;
USE db17254;
CREATE TABLE t1 (f1 INT);
@@ -749,16 +829,24 @@ 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;
for a user
SELECT * FROM v1;
ERROR 42000: SELECT command denied to user 'inv_17254'@'localhost' for table 'v1'
+connection root;
for a superuser
SELECT * FROM v1;
ERROR HY000: The user specified as a definer ('def_17254'@'localhost') does not exist
DROP USER inv_17254@localhost;
DROP DATABASE db17254;
+disconnect def;
+disconnect inv;
DROP DATABASE IF EXISTS mysqltest_db1;
DROP DATABASE IF EXISTS mysqltest_db2;
DROP USER mysqltest_u1;
@@ -769,6 +857,7 @@ 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);
CREATE VIEW v1 AS SELECT i FROM t1 WHERE 1 IN (SELECT * FROM t1);
@@ -776,6 +865,7 @@ 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;
i s
1 public
@@ -787,20 +877,26 @@ PREPARE stmt2 FROM "SELECT * FROM mysqltest_db1.v1, mysqltest_db1.t2";
EXECUTE stmt2;
i s
1 public
+connection conn1;
REVOKE SELECT ON t2 FROM mysqltest_u2@localhost;
UPDATE t2 SET s = 'private' WHERE s = 'public';
+connection conn2;
SELECT * FROM mysqltest_db1.v1, mysqltest_db1.t2;
ERROR 42000: SELECT command denied to user 'mysqltest_u2'@'localhost' for table 't2'
EXECUTE stmt1;
ERROR 42000: SELECT command denied to user 'mysqltest_u2'@'localhost' for table 't2'
EXECUTE stmt2;
ERROR 42000: SELECT command denied to user 'mysqltest_u2'@'localhost' for table 't2'
+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;
+connection root;
CREATE DATABASE db26813;
USE db26813;
CREATE TABLE t1(f1 INT, f2 INT);
@@ -812,20 +908,25 @@ 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;
ALTER VIEW v1 AS SELECT f2 FROM t1;
ERROR 42000: CREATE VIEW command denied to user 'u26813'@'localhost' for table 'v1'
ALTER VIEW v2 AS SELECT f2 FROM t1;
ERROR 42000: DROP command denied to user 'u26813'@'localhost' for table 'v2'
ALTER VIEW v3 AS SELECT f2 FROM t1;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
+connection root;
SHOW CREATE VIEW v3;
View Create View character_set_client collation_connection
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci
DROP USER u26813@localhost;
DROP DATABASE db26813;
+disconnect u1;
#
# Bug#29908 A user can gain additional access through the ALTER VIEW.
#
+connection root;
CREATE DATABASE mysqltest_29908;
USE mysqltest_29908;
CREATE TABLE t1(f1 INT, f2 INT);
@@ -840,6 +941,7 @@ 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;
ALTER VIEW v1 AS SELECT f2 FROM t1;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
ALTER VIEW v2 AS SELECT f2 FROM t1;
@@ -847,6 +949,7 @@ ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) fo
SHOW CREATE VIEW v2;
View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci
+connect u1,localhost,u29908_1,,mysqltest_29908;
ALTER VIEW v1 AS SELECT f2 FROM t1;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -855,6 +958,7 @@ ALTER VIEW v2 AS SELECT f2 FROM t1;
SHOW CREATE VIEW v2;
View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f2` AS `f2` from `t1` latin1 latin1_swedish_ci
+connection root;
ALTER VIEW v1 AS SELECT f1 FROM t1;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -866,6 +970,8 @@ v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKE
DROP USER u29908_1@localhost;
DROP USER u29908_2@localhost;
DROP DATABASE mysqltest_29908;
+disconnect u1;
+disconnect u2;
#######################################################################
DROP DATABASE IF EXISTS mysqltest1;
DROP DATABASE IF EXISTS mysqltest2;
@@ -885,8 +991,7 @@ GRANT INSERT ON mysqltest1.t2 TO mysqltest_u1@localhost;
GRANT SELECT, UPDATE ON mysqltest1.t3 TO mysqltest_u1@localhost;
GRANT SELECT, DELETE ON mysqltest1.t4 TO mysqltest_u1@localhost;
GRANT ALL PRIVILEGES ON mysqltest2.* TO mysqltest_u1@localhost;
-
----> connection: bug24040_con
+connect bug24040_con,localhost,mysqltest_u1,,mysqltest2;
SELECT * FROM mysqltest1.t1;
c1
11
@@ -927,8 +1032,7 @@ CREATE VIEW v41 AS SELECT c4, c1 FROM mysqltest1.t4, mysqltest1.t1;
CREATE VIEW v42 AS SELECT c4, c2 FROM mysqltest1.t4, mysqltest1.t2;
ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c2' in table 'v42'
CREATE VIEW v43 AS SELECT c4, c3 FROM mysqltest1.t4, mysqltest1.t3;
-
----> connection: default
+connection default;
SELECT * FROM mysqltest1.t1;
c1
11
@@ -953,6 +1057,7 @@ SELECT * FROM mysqltest1.t4;
c4
41
42
+disconnect bug24040_con;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
DROP USER mysqltest_u1@localhost;
@@ -963,6 +1068,8 @@ 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;
f1
@@ -976,6 +1083,9 @@ SELECT f2 FROM v1;
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'f2' in table 'v1'
SELECT * FROM v1;
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table '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;
@@ -983,8 +1093,11 @@ DROP USER foo;
DROP VIEW db1.v1;
DROP TABLE db1.t1;
DROP DATABASE db1;
+connection default;
Bug #11765687/#58677:
No privilege on table/view, but can know #rows / underlying table's name
+connect root,localhost,root,,test;
+connection root;
create database mysqltest1;
create table mysqltest1.t1 (i int);
create table mysqltest1.t2 (j int);
@@ -1008,6 +1121,8 @@ create user pjotr@localhost;
create user quintessa@localhost;
grant all privileges on mysqltest1.* to alice@localhost with grant option;
... 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;
@@ -1051,28 +1166,43 @@ 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;
... as bob
+connect test11765687,localhost,bob,,mysqltest1;
+connection test11765687;
select * from v1;
i
explain select * from v1;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
+disconnect test11765687;
... as cecil
+connect test11765687,localhost,cecil,,mysqltest1;
+connection test11765687;
select * from v1;
ERROR 42000: SELECT command denied to user 'cecil'@'localhost' for table 'v1'
explain select * from v1;
ERROR 42000: SELECT command denied to user 'cecil'@'localhost' for table 'v1'
+disconnect test11765687;
... as dan
+connect test11765687,localhost,dan,,mysqltest1;
+connection test11765687;
select * from v1;
i
explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+disconnect test11765687;
... as eugene
+connect test11765687,localhost,eugene,,mysqltest1;
+connection test11765687;
select * from v1;
i
explain select * from v1;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
+disconnect test11765687;
... as fiona
+connect test11765687,localhost,fiona,,mysqltest1;
+connection test11765687;
select * from v2;
i j
show create view v2;
@@ -1086,14 +1216,20 @@ explain select * from t2;
ERROR 42000: SELECT command denied to user 'fiona'@'localhost' for table 't2'
explain select * from v2;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
+disconnect test11765687;
... as greg
+connect test11765687,localhost,greg,,mysqltest1;
+connection test11765687;
select * from v2;
i j
explain select * from v1;
ERROR 42000: SELECT command denied to user 'greg'@'localhost' for table 'v1'
explain select * from v2;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
+disconnect test11765687;
... as han
+connect test11765687,localhost,han,,mysqltest1;
+connection test11765687;
select * from t3;
ERROR 42000: SELECT command denied to user 'han'@'localhost' for table 't3'
explain select * from t3;
@@ -1108,54 +1244,83 @@ k
explain select * from v3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
+disconnect test11765687;
... as inga
+connect test11765687,localhost,inga,,mysqltest1;
+connection test11765687;
select * from v2;
i j
explain select * from v2;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
+disconnect test11765687;
... as jamie
+connect test11765687,localhost,jamie,,mysqltest1;
+connection test11765687;
select * from v2;
i j
explain select * from v2;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
+disconnect test11765687;
... as karl
+connect test11765687,localhost,karl,,mysqltest1;
+connection test11765687;
select * from v2;
i j
explain select * from v2;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
+disconnect test11765687;
... as lena
+connect test11765687,localhost,lena,,mysqltest1;
+connection test11765687;
select * from v2;
ERROR 42000: SELECT command denied to user 'lena'@'localhost' for table 'v2'
explain select * from v2;
ERROR 42000: SELECT command denied to user 'lena'@'localhost' for table 'v2'
+disconnect test11765687;
... as mhairi
+connect test11765687,localhost,mhairi,,mysqltest1;
+connection test11765687;
select * from v2;
i j
explain select * from v2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found
+disconnect test11765687;
... as noam
+connect test11765687,localhost,noam,,mysqltest1;
+connection test11765687;
select * from v2;
i j
explain select * from v2;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
+disconnect test11765687;
... as olga
+connect test11765687,localhost,olga,,mysqltest1;
+connection test11765687;
select * from v2;
i j
explain select * from v2;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
+disconnect test11765687;
... as pjotr
+connect test11765687,localhost,pjotr,,mysqltest1;
+connection test11765687;
select * from v2;
i j
explain select * from v2;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
+disconnect test11765687;
... as quintessa
+connect test11765687,localhost,quintessa,,mysqltest1;
+connection test11765687;
select * from v1;
i
explain select * from v1;
ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
+disconnect test11765687;
... as root again at last: clean-up time!
+connection root;
drop user alice@localhost;
drop user bob@localhost;
drop user cecil@localhost;
@@ -1174,9 +1339,12 @@ drop user olga@localhost;
drop user pjotr@localhost;
drop user quintessa@localhost;
drop database mysqltest1;
+disconnect root;
+connection default;
select * from information_schema.table_privileges;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
End of 5.0 tests.
+connection default;
DROP VIEW IF EXISTS v1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT);
@@ -1221,12 +1389,15 @@ 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;
This would lead to failed assertion.
CREATE VIEW v1 AS SELECT a, b FROM t1, t2;
SELECT * FROM v1;
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1'
SELECT b FROM v1;
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1'
+disconnect connection1;
+connection default;
DROP TABLE t1, t2;
DROP VIEW v1;
DROP DATABASE mysqltest1;
@@ -1241,10 +1412,13 @@ 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;
SELECT * FROM mysqltest1.v1;
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1'
CREATE VIEW v1 AS SELECT * FROM mysqltest1.t2;
ERROR 42000: ANY command denied to user 'mysqluser1'@'localhost' for table 't2'
+disconnect connection1;
+connection default;
DROP TABLE t1, t2;
DROP VIEW v1;
DROP DATABASE mysqltest1;
@@ -1255,19 +1429,27 @@ 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;
EXECUTE stmt_v1;
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1'
EXECUTE stmt_v2;
ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v2'
+disconnect connection1;
+connect connection2, localhost, mysqluser1,,;
PREPARE stmt FROM "SELECT a FROM v3";
EXECUTE stmt;
a
1
+disconnect connection2;
+connection default;
DROP VIEW v1, v2;
DROP DATABASE mysqltest1;
DROP VIEW test.v3;
@@ -1303,6 +1485,7 @@ 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;
@@ -1338,10 +1521,12 @@ v_mysqluser1_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL
SHOW CREATE VIEW v_mysqluser1_v2;
View Create View character_set_client collation_connection
v_mysqluser1_v2 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_v2` AS select `v2`.`a` AS `a`,`v2`.`b` AS `b` from `mysqltest1`.`v2` latin1 latin1_swedish_ci
+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;
View Create View character_set_client collation_connection
v_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_t1` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci
@@ -1372,12 +1557,14 @@ v_mysqluser1_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL
SHOW CREATE VIEW v_mysqluser1_v2;
View Create View character_set_client collation_connection
v_mysqluser1_v2 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_v2` AS select `v2`.`a` AS `a`,`v2`.`b` AS `b` from `mysqltest1`.`v2` latin1 latin1_swedish_ci
+connection default;
# Testing the case when the views reference missing objects.
# Obviously, there are no privileges to check for, so we
# need only each object type once.
DROP TABLE t1;
DROP FUNCTION f1;
DROP VIEW v1;
+connection connection1;
SHOW CREATE VIEW mysqltest1.v_t1;
View Create View character_set_client collation_connection
v_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_t1` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci
@@ -1408,9 +1595,11 @@ View Create View character_set_client collation_connection
v_mysqluser1_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_v1` AS select `v1`.`a` AS `a` from `mysqltest1`.`v1` latin1 latin1_swedish_ci
Warnings:
Warning 1356 View 'mysqltest2.v_mysqluser1_v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+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;
SHOW CREATE VIEW mysqltest1.v_t1;
ERROR 42000: SHOW VIEW command denied to user 'mysqluser1'@'localhost' for table 'v_t1'
SHOW CREATE VIEW mysqltest1.v_f1;
@@ -1432,6 +1621,8 @@ View Create View character_set_client collation_connection
v_mysqluser1_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_v1` AS select `v1`.`a` AS `a` from `mysqltest1`.`v1` latin1 latin1_swedish_ci
Warnings:
Warning 1356 View 'mysqltest2.v_mysqluser1_v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+disconnect connection1;
+connection default;
DROP USER mysqluser1@localhost;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
@@ -1460,10 +1651,13 @@ 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;
a
SELECT a FROM v2;
a
+connection default;
+disconnect mysqluser1;
DROP USER mysqluser1;
DROP DATABASE mysqltest1;
USE test;
@@ -1502,12 +1696,10 @@ GRANT SELECT ON t1 TO 'mysqluser1'@'%';
GRANT SELECT ON t2 TO 'mysqluser1'@'%';
GRANT SELECT ON v1_uses_t1 TO 'mysqluser1'@'%';
GRANT SELECT ON v1_uses_t2 TO 'mysqluser1'@'%';
-#
-# Connection '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'.
+connection default;
CREATE USER 'mysqluser2'@'%';
GRANT SELECT ON v2_uses_t1 TO 'mysqluser2'@'%';
GRANT SELECT ON v2_uses_t2 TO 'mysqluser2'@'%';
@@ -1515,8 +1707,7 @@ GRANT SELECT ON t2 TO 'mysqluser2'@'%';
GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser2'@'%';
# Make 'mysqluser1' unable to access t2.
REVOKE SELECT ON t2 FROM 'mysqluser1'@'%';
-#
-# Connection 'mysqluser2'.
+connect mysqluser2, localhost, mysqluser2,,mysqltest1;
# The below statement should succeed thanks to suid nature of v2_uses_t1.
SELECT * FROM v2_uses_t1;
i
@@ -1526,8 +1717,7 @@ SELECT * FROM v2_uses_t2;
ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
#
# 2) INVOKER-security view uses INVOKER-security view.
-#
-# Connection 'default'.
+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;
@@ -1535,16 +1725,14 @@ 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'.
+connection mysqluser1;
# For both versions of 'v2' 'mysqluser1' privileges should be used.
SELECT * FROM v2_uses_t1;
i
1
SELECT * FROM v2_uses_t2;
ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
-#
-# Connection 'mysqluser2'.
+connection mysqluser2;
# And now for both versions of 'v2' 'mysqluser2' privileges should
# be used.
SELECT * FROM v2_uses_t1;
@@ -1554,21 +1742,17 @@ j
2
#
# 3) INVOKER-security view uses DEFINER-security view.
-#
-# Connection 'default'.
+connection default;
DROP VIEW v1_uses_t1, v1_uses_t2;
# To be able create 'v1_uses_t2' we also need select on t2.
GRANT SELECT ON t2 TO 'mysqluser1'@'%';
-#
-# Connection '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'.
+connection default;
# Make 'mysqluser1' unable to access t2.
REVOKE SELECT ON t2 FROM 'mysqluser1'@'%';
-#
-# Connection 'mysqluser2'.
+connection mysqluser2;
# Due to suid nature of v1_uses_t1 and v1_uses_t2 the first
# select should succeed and the second select should fail.
SELECT * FROM v2_uses_t1;
@@ -1578,27 +1762,26 @@ SELECT * FROM v2_uses_t2;
ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
#
# 4) DEFINER-security view uses DEFINER-security view.
-#
-# Connection 'default'.
+connection default;
DROP VIEW v2_uses_t1, v2_uses_t2;
# To be able create 'v2_uses_t2' we also need select on t2.
GRANT SELECT ON t2 TO 'mysqluser1'@'%';
-#
-# Connection 'mysqluser2'.
+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'.
+connection default;
# Make 'mysqluser1' unable to access t2.
REVOKE SELECT ON t2 FROM 'mysqluser1'@'%';
-#
-# Connection 'mysqluser2'.
+connection mysqluser2;
# Again privileges of creator of innermost views should apply.
SELECT * FROM v2_uses_t1;
i
1
SELECT * FROM v2_uses_t2;
ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+disconnect mysqluser1;
+disconnect mysqluser2;
+connection default;
USE test;
DROP DATABASE mysqltest1;
DROP USER 'mysqluser1'@'%';
@@ -1656,8 +1839,7 @@ 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 as user_11766767
+connect conn_11766767, localhost, user_11766767,,;
#
# A) Check how we handle privilege checking in multi-update for
# directly used views.
@@ -1748,7 +1930,8 @@ update mysqltest1.t11 as t11, mysqltest2.v42 as v4 set v4.val= 'test20'
#
# Clean-up.
#
-# Switching to connection 'default'.
+disconnect conn_11766767;
+connection default;
drop user user_11766767;
drop database mysqltest1;
drop database mysqltest2;
diff --git a/mysql-test/r/wait_timeout.result b/mysql-test/r/wait_timeout.result
index adb7d6bafd9..8e5e5147f8b 100644
--- a/mysql-test/r/wait_timeout.result
+++ b/mysql-test/r/wait_timeout.result
@@ -1,6 +1,8 @@
SET @@global.wait_timeout= 2;
disconnect default;
+connect wait_con,localhost,root,,test,,;
connection wait_con;
+connect default,localhost,root,,test,,;
connection default;
--disable_reconnect;
SELECT 1;
@@ -14,14 +16,15 @@ Got one of the listed errors
SELECT 3;
3
3
-disconnection default;
+disconnect default;
connection wait_con;
-connection con1;
+connect con1,127.0.0.1,root,,test,$MASTER_MYPORT,;
--disable_reconnect;
SELECT 1;
1
1
connection wait_con;
+disconnect wait_con;
connection con1;
SELECT 2;
Got one of the listed errors
@@ -30,4 +33,11 @@ SELECT 3;
3
3
SET @@global.wait_timeout= <start_value>;
-disconnection con1;
+disconnect con1;
+connect default,localhost,root,,test,,;
+set global log_warnings=2;
+connect foo,localhost,root;
+set @@wait_timeout=1;
+connection default;
+FOUND 1 /Aborted.*Got timeout reading communication packets/ in mysqld.1.err
+set global log_warnings=@@log_warnings;
diff --git a/mysql-test/r/wait_timeout_not_windows.result b/mysql-test/r/wait_timeout_not_windows.result
deleted file mode 100644
index 867787a8ed3..00000000000
--- a/mysql-test/r/wait_timeout_not_windows.result
+++ /dev/null
@@ -1,4 +0,0 @@
-set global log_warnings=2;
-set @@wait_timeout=1;
-FOUND /Aborted.*Got timeout reading communication packets/ in mysqld.1.err
-set global log_warnings=@@log_warnings;
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index b4b345ca260..596cf5f2795 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -29,18 +29,18 @@ show errors;
Level Code Message
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
insert into t1 values (1);
-insert into t1 values ("hej");
+insert ignore into t1 values ("hej");
Warnings:
Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1
-insert into t1 values ("hej"),("då");
+insert ignore into t1 values ("hej"),("då");
Warnings:
Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1
Warning 1366 Incorrect integer value: 'då' for column 'a' at row 2
set SQL_WARNINGS=1;
-insert into t1 values ("hej");
+insert ignore into t1 values ("hej");
Warnings:
Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1
-insert into t1 values ("hej"),("då");
+insert ignore into t1 values ("hej"),("då");
Warnings:
Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1
Warning 1366 Incorrect integer value: 'då' for column 'a' at row 2
@@ -73,7 +73,7 @@ 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 ',';
Warnings:
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2
-Warning 1265 Data truncated for column 'd' at row 3
+Warning 1406 Data too long for column 'd' at row 3
Warning 1265 Data truncated for column 'c' at row 4
Warning 1261 Row 5 doesn't contain data for all columns
Warning 1265 Data truncated for column 'b' at row 6
@@ -84,7 +84,7 @@ select @@warning_count;
7
drop table t1;
create table t1(a tinyint NOT NULL, b tinyint unsigned, c char(5));
-insert into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test');
+insert ignore into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test');
Warnings:
Warning 1048 Column 'a' cannot be null
Warning 1264 Out of range value for column 'b' at row 2
@@ -92,37 +92,38 @@ Warning 1265 Data truncated for column 'c' at row 2
Warning 1264 Out of range value for column 'a' at row 3
Warning 1264 Out of range value for column 'b' at row 3
Warning 1265 Data truncated for column 'c' at row 3
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 modify c char(4);
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
Warning 1265 Data truncated for column 'c' at row 2
alter table t1 add d char(2);
-update t1 set a=NULL where a=10;
+update ignore t1 set a=NULL where a=10;
Warnings:
Warning 1048 Column 'a' cannot be null
-update t1 set c='mysql ab' where c='test';
+update ignore t1 set c='mysql ab' where c='test';
Warnings:
Warning 1265 Data truncated for column 'c' at row 4
-update t1 set d=c;
+update ignore t1 set d=c;
Warnings:
Warning 1265 Data truncated for column 'd' at row 1
Warning 1265 Data truncated for column 'd' at row 2
Warning 1265 Data truncated for column 'd' at row 3
Warning 1265 Data truncated for column 'd' at row 4
create table t2(a tinyint NOT NULL, b char(3));
-insert into t2 select b,c from t1;
+insert ignore into t2 select b,c from t1;
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'b' at row 2
Warning 1265 Data truncated for column 'b' at row 3
Warning 1048 Column 'a' cannot be null
Warning 1265 Data truncated for column 'b' at row 4
-insert into t2(b) values('mysqlab');
+insert ignore into t2(b) values('mysqlab');
Warnings:
Warning 1364 Field 'a' doesn't have a default value
Warning 1265 Data truncated for column 'b' at row 1
set sql_warnings=1;
-insert into t2(b) values('mysqlab');
+insert ignore into t2(b) values('mysqlab');
Warnings:
Warning 1364 Field 'a' doesn't have a default value
Warning 1265 Data truncated for column 'b' at row 1
@@ -131,7 +132,7 @@ drop table t1, t2;
create table t1(a char(10));
alter table t1 add b char;
set max_error_count=10;
-update t1 set b=a;
+update ignore t1 set b=a;
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'b' at row 2
@@ -150,7 +151,7 @@ set max_error_count=0;
show variables like 'max_error_count';
Variable_name Value
max_error_count 0
-update t1 set b='hi';
+update ignore t1 set b='hi';
Warnings:
select @@warning_count;
@@warning_count
@@ -168,7 +169,7 @@ max_error_count 10
drop table t1;
create table t1 (a int);
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
-update t1 set a='abc';
+update ignore t1 set a='abc';
Warnings:
Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 1
Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 2
@@ -235,6 +236,7 @@ Note 1305 PROCEDURE test.sp2 does not exist
DROP PROCEDURE IF EXISTS sp3;
Warnings:
Note 1305 PROCEDURE test.sp3 does not exist
+SET sql_mode = '';
CREATE PROCEDURE sp1()
BEGIN
DECLARE x NUMERIC ZEROFILL;
@@ -259,7 +261,9 @@ Warning 1366 Incorrect decimal value: 'a`' for column 'x' at row 1
CALL sp3();
Warnings:
Warning 1366 Incorrect decimal value: 'a`' for column 'x' at row 1
+SET sql_mode = DEFAULT;
DROP PROCEDURE IF EXISTS sp1;
+SET sql_mode = '';
CREATE PROCEDURE sp1()
BEGIN
declare x numeric unsigned zerofill;
@@ -268,6 +272,7 @@ END//
CALL sp1();
Warnings:
Warning 1366 Incorrect decimal value: 'a`' for column 'x' at row 1
+SET sql_mode = DEFAULT;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
@@ -352,3 +357,15 @@ Error 1062 Duplicate entry '11' for key 'a'
DROP TABLE t1;
DROP FUNCTION f1;
+connect con1,localhost,root,,;
+SELECT TIME('10:10:10.11111111111');
+TIME('10:10:10.11111111111')
+10:10:10.111111
+Warnings:
+Note 1292 Truncated incorrect time value: '10:10:10.11111111111'
+disconnect con1;
+connect con2,localhost,root,,;
+SHOW WARNINGS;
+Level Code Message
+disconnect con2;
+connection default;
diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result
new file mode 100644
index 00000000000..e3cb40e8343
--- /dev/null
+++ b/mysql-test/r/win.result
@@ -0,0 +1,3301 @@
+drop table if exists t1,t2;
+drop view if exists v1;
+# ########################################################################
+# # Parser tests
+# ########################################################################
+#
+# 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);
+select row_number() from t1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'from t1' at line 1
+select rank() from t1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'from t1' at line 1
+# Attempt to use window function in the WHERE clause
+select * from t1 where 1=rank() over (order by a);
+ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause
+select * from t1 where 1>row_number() over (partition by b order by a);
+ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause
+drop table t1;
+# ########################################################################
+# # Functionality tests
+# ########################################################################
+#
+# 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');
+select a, row_number() over (partition by a order by b) from t1;
+a row_number() over (partition by a order by b)
+2 1
+2 2
+2 3
+3 1
+3 2
+select a, b, x, row_number() over (partition by a order by x) from t1;
+a b x row_number() over (partition by a order by x)
+2 10 xx 1
+2 10 zz 3
+2 20 yy 2
+3 10 xxx 2
+3 20 vvv 1
+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;
+pk a b row_number() over (order by a) row_number() over (order by b)
+1 10 22 1 5
+2 11 21 2 4
+3 12 20 3 3
+4 13 19 4 2
+5 14 18 5 1
+drop table t1;
+#
+# Try RANK() function
+#
+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);
+select pk, a, rank() over (order by a) from t2;
+pk a rank() over (order by a)
+1 0 1
+10 4 9
+2 0 1
+3 1 3
+4 1 3
+5 2 5
+6 2 5
+7 2 5
+8 2 5
+9 4 9
+select pk, a, rank() over (order by a desc) from t2;
+pk a rank() over (order by a desc)
+1 0 9
+10 4 1
+2 0 9
+3 1 7
+4 1 7
+5 2 3
+6 2 3
+7 2 3
+8 2 3
+9 4 1
+drop table t2;
+#
+# Try Aggregates as window functions. With frames.
+#
+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;
+pk c
+1 1
+2 1
+3 1
+4 1
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+select
+pk, c,
+count(*) over (partition by c order by pk
+rows between 2 preceding and 2 following) as CNT
+from t1;
+pk c CNT
+1 1 3
+2 1 4
+3 1 4
+4 1 3
+5 2 3
+6 2 4
+7 2 5
+8 2 5
+9 2 4
+10 2 3
+select
+pk, c,
+count(*) over (partition by c order by pk
+rows between 1 preceding and 2 following) as CNT
+from t1;
+pk c CNT
+1 1 3
+2 1 4
+3 1 3
+4 1 2
+5 2 3
+6 2 4
+7 2 4
+8 2 4
+9 2 3
+10 2 2
+select
+pk, c,
+count(*) over (partition by c order by pk
+rows between 2 preceding and current row) as CNT
+from t1;
+pk c CNT
+1 1 1
+2 1 2
+3 1 3
+4 1 3
+5 2 1
+6 2 2
+7 2 3
+8 2 3
+9 2 3
+10 2 3
+select
+pk,c,
+count(*) over (partition by c order by pk rows
+between 1 following and 2 following) as CNT
+from t1;
+pk c CNT
+1 1 2
+2 1 2
+3 1 1
+4 1 0
+5 2 2
+6 2 2
+7 2 2
+8 2 2
+9 2 1
+10 2 0
+select
+pk,c,
+count(*) over (partition by c order by pk rows
+between 2 preceding and 1 preceding) as CNT
+from t1;
+pk c CNT
+1 1 0
+2 1 1
+3 1 2
+4 1 2
+5 2 0
+6 2 1
+7 2 2
+8 2 2
+9 2 2
+10 2 2
+select
+pk, c,
+count(*) over (partition by c order by pk
+rows between current row and 1 following) as CNT
+from t1;
+pk c CNT
+1 1 2
+2 1 2
+3 1 2
+4 1 1
+5 2 2
+6 2 2
+7 2 2
+8 2 2
+9 2 2
+10 2 1
+# 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;
+pk c CNT
+1 1 3
+2 1 4
+3 1 4
+4 1 3
+5 2 3
+6 2 4
+7 2 5
+8 2 5
+9 2 4
+10 2 3
+drop table t0,t1;
+#
+# Resolution of window names
+#
+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;
+pk c
+1 1
+2 1
+3 1
+4 1
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+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);
+pk c CNT
+1 1 3
+2 1 4
+3 1 4
+4 1 3
+5 2 3
+6 2 4
+7 2 5
+8 2 5
+9 2 4
+10 2 3
+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);
+pk c CNT
+1 1 3
+2 1 4
+3 1 4
+4 1 3
+5 2 3
+6 2 4
+7 2 5
+8 2 5
+9 2 4
+10 2 3
+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);
+pk c CNT
+1 1 3
+2 1 4
+3 1 4
+4 1 3
+5 2 3
+6 2 4
+7 2 5
+8 2 5
+9 2 4
+10 2 3
+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);
+pk c CNT
+1 1 3
+2 1 4
+3 1 4
+4 1 3
+5 2 3
+6 2 4
+7 2 5
+8 2 5
+9 2 4
+10 2 3
+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);
+pk c CNT
+1 1 3
+2 1 4
+3 1 4
+4 1 3
+5 2 3
+6 2 4
+7 2 5
+8 2 5
+9 2 4
+10 2 3
+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 HY000: Window specification with name 'w' is not defined
+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 HY000: Multiple window specifications with the same name 'w1'
+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 HY000: Window specification with name 'w' is not defined
+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 HY000: Window specification referencing another one 'w1' cannot contain partition list
+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 HY000: Referenced window specification 'w1' already contains order list
+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 HY000: Referenced window specification 'w2' cannot contain window frame
+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 HY000: Unacceptable combination of window frame bound specifications
+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 HY000: Unacceptable combination of window frame bound specifications
+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 HY000: Unacceptable combination of window frame bound specifications
+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 HY000: Unacceptable combination of window frame bound specifications
+select
+pk, c
+from t1 where rank() over w1 > 2
+window w1 as (partition by c order by pk);
+ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause
+select
+c, max(pk) as m
+from t1
+group by c + rank() over w1
+window w1 as (order by m);
+ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause
+select
+c, max(pk) as m, rank() over w1 as r
+from t1
+group by c+r
+window w1 as (order by m);
+ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause
+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 HY000: Window function is allowed only in SELECT list and ORDER BY clause
+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 HY000: Window function is not allowed in window specification
+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 HY000: Window function is not allowed in window specification
+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 HY000: Window function is not allowed in window specification
+select
+pk, c,
+row_number() over (partition by c order by pk
+range between unbounded preceding and current row) as r
+from t1;
+ERROR HY000: Window frame is not allowed with 'row_number'
+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 HY000: Window frame is not allowed with 'rank'
+select
+pk, c,
+dense_rank() over (partition by c order by pk
+rows between 1 preceding and 1 following) as r
+from t1;
+ERROR HY000: Window frame is not allowed with 'dense_rank'
+select
+pk, c,
+rank() over w1 as r
+from t1
+window w1 as (partition by c);
+ERROR HY000: No order list in window specification for 'rank'
+select
+pk, c,
+dense_rank() over (partition by c) as r
+from t1;
+ERROR HY000: No order list in window specification for 'dense_rank'
+drop table t0,t1;
+#
+# MDEV-9634: Window function produces incorrect value
+#
+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;
+part_id pk a
+0 0 NULL
+0 1 NULL
+0 2 NULL
+0 3 NULL
+0 4 NULL
+1 5 1
+1 6 1
+1 7 1
+1 8 1
+1 9 1
+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;
+part_id pk a CNT
+0 0 NULL 0
+0 1 NULL 0
+0 2 NULL 0
+0 3 NULL 0
+0 4 NULL 0
+1 5 1 2
+1 6 1 3
+1 7 1 3
+1 8 1 3
+1 9 1 2
+drop table t0, t2;
+#
+# RANGE-type bounds
+#
+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;
+pk val CNT
+0 1 3
+1 1 3
+2 1 3
+3 2 4
+4 2 4
+5 2 4
+6 2 4
+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;
+pk val CNT
+0 1 3
+1 1 3
+2 1 3
+3 2 4
+4 2 4
+5 2 4
+6 2 4
+7 3 2
+8 3 2
+drop table t3;
+# 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;
+part_id pk val CNT
+1234 100 1 3
+1234 101 1 3
+1234 102 1 3
+1234 103 2 4
+1234 104 2 4
+1234 105 2 4
+1234 106 2 4
+1234 107 3 2
+1234 108 3 2
+5678 200 1 3
+5678 201 1 3
+5678 202 1 3
+5678 203 2 4
+5678 204 2 4
+5678 205 2 4
+5678 206 2 4
+5678 207 3 2
+5678 208 3 2
+#
+# Try RANGE UNBOUNDED PRECEDING | FOLLOWING
+#
+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;
+part_id pk val CNT
+1234 100 1 3
+1234 101 1 3
+1234 102 1 3
+1234 103 2 7
+1234 104 2 7
+1234 105 2 7
+1234 106 2 7
+1234 107 3 9
+1234 108 3 9
+5678 200 1 3
+5678 201 1 3
+5678 202 1 3
+5678 203 2 7
+5678 204 2 7
+5678 205 2 7
+5678 206 2 7
+5678 207 3 9
+5678 208 3 9
+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;
+part_id pk val CNT
+1234 100 1 9
+1234 101 1 9
+1234 102 1 9
+1234 103 2 6
+1234 104 2 6
+1234 105 2 6
+1234 106 2 6
+1234 107 3 2
+1234 108 3 2
+5678 200 1 9
+5678 201 1 9
+5678 202 1 9
+5678 203 2 6
+5678 204 2 6
+5678 205 2 6
+5678 206 2 6
+5678 207 3 2
+5678 208 3 2
+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;
+part_id pk val CNT
+1234 100 1 9
+1234 101 1 9
+1234 102 1 9
+1234 103 2 9
+1234 104 2 9
+1234 105 2 9
+1234 106 2 9
+1234 107 3 9
+1234 108 3 9
+5678 200 1 9
+5678 201 1 9
+5678 202 1 9
+5678 203 2 9
+5678 204 2 9
+5678 205 2 9
+5678 206 2 9
+5678 207 3 9
+5678 208 3 9
+drop table t4;
+#
+# MDEV-9695: Wrong window frame when using RANGE BETWEEN N FOLLOWING AND PRECEDING
+#
+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;
+pk a b bit_or
+1 0 1 3
+2 0 2 3
+3 1 4 12
+4 1 8 12
+5 2 32 96
+6 2 64 224
+7 2 128 208
+8 2 16 144
+# 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;
+pk a b bit_or
+1 0 1 0
+2 0 2 1
+3 1 4 0
+4 1 8 4
+5 2 32 0
+6 2 64 32
+7 2 128 64
+8 2 16 128
+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;
+pk a b bit_or
+1 0 1 0
+2 0 2 1
+3 0 4 2
+4 0 8 4
+5 1 16 0
+6 1 32 16
+7 1 64 32
+8 1 128 64
+9 2 256 0
+10 2 512 256
+11 2 1024 512
+12 2 2048 1024
+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;
+pk a b bit_or
+1 0 1 0
+2 0 2 0
+3 0 4 1
+4 0 8 2
+5 1 16 0
+6 1 32 0
+7 1 64 16
+8 1 128 32
+9 2 256 0
+10 2 512 0
+11 2 1024 256
+12 2 2048 512
+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;
+pk a b bit_or
+1 0 1 0
+2 0 2 1
+3 0 4 3
+4 0 8 6
+5 1 16 0
+6 1 32 16
+7 1 64 48
+8 1 128 96
+9 2 256 0
+10 2 512 256
+11 2 1024 768
+12 2 2048 1536
+# 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;
+pk a b bit_or
+1 0 1 1
+2 0 2 2
+3 0 4 4
+4 0 8 8
+5 1 16 16
+6 1 32 32
+7 1 64 64
+8 1 128 128
+9 2 256 256
+10 2 512 512
+11 2 1024 1024
+12 2 2048 2048
+drop table t2;
+#
+# Try RANGE PRECEDING|FOLLWING n
+#
+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;
+pk a cnt
+1 1 4
+2 2 4
+3 4 4
+4 8 4
+5 26 6
+6 27 6
+7 40 7
+8 71 9
+9 72 9
+select
+pk, a,
+count(a) over (ORDER BY a DESC
+RANGE BETWEEN UNBOUNDED PRECEDING
+AND 10 FOLLOWING) as cnt
+from t1;
+pk a cnt
+1 1 9
+2 2 9
+3 4 9
+4 8 9
+5 26 5
+6 27 5
+7 40 3
+8 71 2
+9 72 2
+select
+pk, a,
+count(a) over (ORDER BY a
+RANGE BETWEEN UNBOUNDED PRECEDING
+AND 1 FOLLOWING) as cnt
+from t1;
+pk a cnt
+1 1 2
+2 2 2
+3 4 3
+4 8 4
+5 26 6
+6 27 6
+7 40 7
+8 71 9
+9 72 9
+select
+pk, a,
+count(a) over (ORDER BY a
+RANGE BETWEEN UNBOUNDED PRECEDING
+AND 10 PRECEDING) as cnt
+from t1;
+pk a cnt
+1 1 0
+2 2 0
+3 4 0
+4 8 0
+5 26 4
+6 27 4
+7 40 6
+8 71 7
+9 72 7
+select
+pk, a,
+count(a) over (ORDER BY a DESC
+RANGE BETWEEN UNBOUNDED PRECEDING
+AND 10 PRECEDING) as cnt
+from t1;
+pk a cnt
+1 1 5
+2 2 5
+3 4 5
+4 8 5
+5 26 3
+6 27 3
+7 40 2
+8 71 0
+9 72 0
+select
+pk, a,
+count(a) over (ORDER BY a
+RANGE BETWEEN UNBOUNDED PRECEDING
+AND 1 PRECEDING) as cnt
+from t1;
+pk a cnt
+1 1 0
+2 2 1
+3 4 2
+4 8 3
+5 26 4
+6 27 5
+7 40 6
+8 71 7
+9 72 8
+select
+pk, a,
+count(a) over (ORDER BY a
+RANGE BETWEEN 1 PRECEDING
+AND CURRENT ROW) as cnt
+from t1;
+pk a cnt
+1 1 1
+2 2 2
+3 4 1
+4 8 1
+5 26 1
+6 27 2
+7 40 1
+8 71 1
+9 72 2
+select
+pk, a,
+count(a) over (ORDER BY a DESC
+RANGE BETWEEN 1 PRECEDING
+AND CURRENT ROW) as cnt
+from t1;
+pk a cnt
+1 1 2
+2 2 1
+3 4 1
+4 8 1
+5 26 2
+6 27 1
+7 40 1
+8 71 2
+9 72 1
+select
+pk, a,
+count(a) over (ORDER BY a
+RANGE BETWEEN 1 FOLLOWING
+AND 3 FOLLOWING) as cnt
+from t1;
+pk a cnt
+1 1 2
+2 2 1
+3 4 0
+4 8 0
+5 26 1
+6 27 0
+7 40 0
+8 71 1
+9 72 0
+# 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;
+pk a cnt
+1 1 2
+2 2 1
+3 4 1
+4 8 1
+5 26 2
+6 27 1
+7 40 1
+8 71 2
+9 72 1
+select
+pk, a,
+count(a) over (order by a desc
+range between current row
+and 1 following) as cnt
+from t1;
+pk a cnt
+1 1 1
+2 2 2
+3 4 1
+4 8 1
+5 26 1
+6 27 2
+7 40 1
+8 71 1
+9 72 2
+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;
+part_id pk a cnt
+10 1 1 4
+10 2 2 4
+10 3 4 4
+10 4 8 4
+10 5 26 6
+10 6 27 6
+10 7 40 7
+10 8 71 9
+10 9 72 9
+22 1 1 4
+22 2 2 4
+22 3 4 4
+22 4 8 4
+22 5 26 6
+22 6 27 6
+22 7 40 7
+22 8 71 9
+22 9 72 9
+select
+pk, a,
+count(a) over (PARTITION BY part_id
+ORDER BY a
+RANGE BETWEEN UNBOUNDED PRECEDING
+AND 1 PRECEDING) as cnt
+from t1;
+pk a cnt
+1 1 0
+2 2 1
+3 4 2
+4 8 3
+5 26 4
+6 27 5
+7 40 6
+8 71 7
+9 72 8
+1 1 0
+2 2 1
+3 4 2
+4 8 3
+5 26 4
+6 27 5
+7 40 6
+8 71 7
+9 72 8
+drop table t1;
+# 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;
+a count(col1) over (order by a
+range between 0.1 preceding
+and 0.1 following)
+0.450 3
+0.500 3
+0.550 3
+1.210 2
+1.220 2
+3.330 1
+drop table t1;
+#
+# RANGE-type frames and NULL values
+#
+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;
+pk a CNT
+1 NULL 3
+2 NULL 3
+3 NULL 3
+4 10 3
+5 11 4
+6 12 5
+7 13 4
+8 14 3
+drop table t1;
+#
+# Try ranges that have bound1 > bound2. The standard actually allows them
+#
+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;
+pk c
+1 1
+2 1
+3 1
+4 1
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+select
+pk, c,
+count(*) over (partition by c
+order by pk
+rows between 1 preceding
+and 2 preceding)
+as cnt
+from t1;
+pk c cnt
+1 1 0
+2 1 0
+3 1 0
+4 1 0
+5 2 0
+6 2 0
+7 2 0
+8 2 0
+9 2 0
+10 2 0
+select
+pk, c,
+sum(c) over (partition by c
+order by pk
+rows between 1 preceding
+and 2 preceding)
+as sum
+from t1;
+pk c sum
+1 1 NULL
+2 1 NULL
+3 1 NULL
+4 1 NULL
+5 2 NULL
+6 2 NULL
+7 2 NULL
+8 2 NULL
+9 2 NULL
+10 2 NULL
+select
+pk, c,
+sum(c) over (partition by c
+order by pk
+rows between 2 following
+and 1 following)
+as sum
+from t1;
+pk c sum
+1 1 NULL
+2 1 NULL
+3 1 NULL
+4 1 NULL
+5 2 NULL
+6 2 NULL
+7 2 NULL
+8 2 NULL
+9 2 NULL
+10 2 NULL
+select
+pk, c,
+count(*) over (partition by c
+order by pk
+range between 1 preceding
+and 2 preceding)
+as cnt
+from t1;
+pk c cnt
+1 1 0
+2 1 0
+3 1 0
+4 1 0
+5 2 0
+6 2 0
+7 2 0
+8 2 0
+9 2 0
+10 2 0
+drop table t0, t1;
+#
+# Error checking for frame bounds
+#
+create table t1 (a int, b int, c varchar(32));
+insert into t1 values (1,1,'foo');
+insert into t1 values (2,2,'bar');
+select
+count(*) over (order by a,b
+range between unbounded preceding and current row)
+from t1;
+ERROR HY000: RANGE-type frame requires ORDER BY clause with single sort key
+select
+count(*) over (order by c
+range between unbounded preceding and current row)
+from t1;
+ERROR HY000: Numeric datatype is required for RANGE-type frame
+select
+count(*) over (order by a
+range between 'abcd' preceding and current row)
+from t1;
+ERROR HY000: Numeric datatype is required for RANGE-type frame
+select
+count(*) over (order by a
+range between current row and 'foo' following)
+from t1;
+ERROR HY000: Numeric datatype is required for RANGE-type frame
+# Try range frame with invalid bounds
+select
+count(*) over (order by a
+rows between 0.5 preceding and current row)
+from t1;
+ERROR HY000: Integer is required for ROWS-type frame
+select
+count(*) over (order by a
+rows between current row and 3.14 following)
+from t1;
+ERROR HY000: Integer is required for ROWS-type frame
+#
+# EXCLUDE clause is parsed but not supported
+#
+select
+count(*) over (order by a
+rows between 1 preceding and 1 following
+exclude current row)
+from t1;
+ERROR HY000: Frame exclusion is not supported yet
+select
+count(*) over (order by a
+range between 1 preceding and 1 following
+exclude ties)
+from t1;
+ERROR HY000: Frame exclusion is not supported yet
+select
+count(*) over (order by a
+range between 1 preceding and 1 following
+exclude group)
+from t1;
+ERROR HY000: Frame exclusion is not supported yet
+select
+count(*) over (order by a
+rows between 1 preceding and 1 following
+exclude no others)
+from t1;
+count(*) over (order by a
+rows between 1 preceding and 1 following
+exclude no others)
+2
+2
+drop table t1;
+#
+# Window function in grouping query
+#
+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;
+username s rank() over (order by s desc)
+user1 9 2
+user2 60 1
+drop table t1;
+#
+# mdev-9719: Window function in prepared statement
+#
+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';
+execute stmt;
+a row_number() over (partition by a order by b)
+2 1
+2 2
+2 3
+3 1
+3 2
+drop table t1;
+#
+# mdev-9754: Window name resolution in prepared statement
+#
+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;
+pk c
+1 1
+2 1
+3 1
+4 1
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+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;
+pk c CNT
+1 1 3
+2 1 4
+3 1 4
+4 1 3
+5 2 3
+6 2 4
+7 2 5
+8 2 5
+9 2 4
+10 2 3
+drop table t0,t1;
+#
+# EXPLAIN FORMAT=JSON support for window functions
+#
+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;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t0.a"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+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
+{
+ "query_block": {
+ "select_id": 1,
+ "filesort": {
+ "sort_key": "t1.a",
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "sum(t1.b)"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+}
+explain format=json
+select
+a,
+rank() over (order by sum(b))
+from t1
+group by a
+order by null;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "sum(t1.b)"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+#
+# Check how window function works together with GROUP BY and HAVING
+#
+select b,max(a) as MX, rank() over (order by b) from t1 group by b having MX in (3,5,7);
+b MX rank() over (order by b)
+3 3 1
+5 5 2
+7 7 3
+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);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "having_condition": "MX in (3,5,7)",
+ "filesort": {
+ "sort_key": "t1.b",
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.b"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+}
+drop table t1;
+drop table t0;
+#
+# Building ordering index for window functions
+#
+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);
+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);
+c1 c2 c5 c3 c4
+1 1.0000 42 1.0000 1
+1 1.0000 NULL 1.0000 2
+10 1.0000 NULL 1.0000 3
+10 10.0000 3 10.0000 20
+10 10.0000 9 10.0000 20
+10 15.0000 9 17.5000 30
+11 1.0000 NULL 1.0000 3
+12 1.0000 -10 1.0000 2
+2 1.0000 24 1.0000 3
+20 10.0000 12 10.0000 20
+20 10.0000 6 10.0000 20
+20 20.0000 27 20.0000 40
+3 1.0000 -7 1.0000 3
+30 16.6667 13 17.5000 50
+4 1.0000 NULL 1.0000 3
+40 20.0000 19 20.0000 40
+5 1.0000 NULL 1.0000 3
+50 20.0000 21 17.5000 60
+6 1.0000 NULL 1.0000 3
+7 1.0000 13 1.0000 3
+70 20.0000 24 17.5000 40
+8 1.0000 32 1.0000 3
+9 1.0000 -9 1.0000 3
+NULL 1.0000 29 1.0000 1
+NULL NULL 24 1.0000 NULL
+NULL NULL 38 1.0000 NULL
+NULL NULL 42 1.0000 NULL
+drop table t1;
+#
+# MDEV-9848: Window functions: reuse sorting and/or scanning
+#
+create table t1 (a int, b int, c int);
+insert into t1 values
+(1,3,1),
+(2,2,1),
+(3,1,1);
+# Check using counters
+flush status;
+select
+rank() over (partition by c order by a),
+rank() over (partition by c order by b)
+from t1;
+rank() over (partition by c order by a) rank() over (partition by c order by b)
+1 3
+2 2
+3 1
+show status like '%sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 0
+Sort_range 0
+Sort_rows 6
+Sort_scan 2
+flush status;
+select
+rank() over (partition by c order by a),
+rank() over (partition by c order by a)
+from t1;
+rank() over (partition by c order by a) rank() over (partition by c order by a)
+1 1
+2 2
+3 3
+show status like '%sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 0
+Sort_range 0
+Sort_rows 3
+Sort_scan 1
+explain format=json
+select
+rank() over (partition by c order by a),
+rank() over (partition by c order by a)
+from t1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.c, t1.a"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+explain format=json
+select
+rank() over (order by a),
+row_number() over (order by a)
+from t1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.a"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+explain format=json
+select
+rank() over (partition by c order by a),
+count(*) over (partition by c)
+from t1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.c, t1.a"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+explain format=json
+select
+count(*) over (partition by c),
+rank() over (partition by c order by a)
+from t1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.c, t1.a"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+drop table t1;
+#
+# MDEV-9847: Window functions: crash with big_tables=1
+#
+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;
+rank() over (order by a)
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+set big_tables=@tmp;
+drop table t1;
+#
+# Check if "ORDER BY window_func" works
+#
+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;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "filesort": {
+ "sort_key": "row_number() over ( order by t1.s1,t1.s2) desc",
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.s1, t1.s2"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+}
+select *, row_number() over (order by s1, s2) as X from t1 order by X desc;
+s1 s2 X
+2 b 6
+1 a 5
+1 NULL 4
+-1 3
+NULL a 2
+NULL NULL 1
+drop table t1;
+#
+# Try window functions that are not directly present in the select list
+#
+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;
+a b rank() over (order by a) rank() over (order by b) diff
+1 3 1 3 -2
+2 2 2 2 0
+3 1 3 1 2
+drop table t1;
+create table t1 (i int);
+insert into t1 values (1),(2);
+SELECT MAX(i) OVER (PARTITION BY (i)) FROM t1;
+MAX(i) OVER (PARTITION BY (i))
+1
+2
+drop table t1;
+#
+# Check the 0 in ROWS 0 PRECEDING
+#
+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;
+pk a sum(a) over (order by pk rows between 0 preceding and current row)
+1 1 1
+2 2 2
+3 4 4
+4 8 8
+select
+pk, a,
+sum(a) over (order by pk rows between 1 preceding and 0 preceding)
+from t1;
+pk a sum(a) over (order by pk rows between 1 preceding and 0 preceding)
+1 1 1
+2 2 3
+3 4 6
+4 8 12
+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;
+part_id pk a sum(a) over (partition by part_id order by pk rows between 0 preceding and current row)
+1 1 1 1
+1 2 2 2
+1 3 4 4
+1 4 8 8
+200 1 1 1
+200 2 2 2
+200 3 4 4
+200 4 8 8
+select
+part_id, pk, a,
+sum(a) over (partition by part_id order by pk rows between 1 preceding and 0 preceding)
+from t1;
+part_id pk a sum(a) over (partition by part_id order by pk rows between 1 preceding and 0 preceding)
+1 1 1 1
+1 2 2 3
+1 3 4 6
+1 4 8 12
+200 1 1 1
+200 2 2 3
+200 3 4 6
+200 4 8 12
+drop table t1;
+#
+# MDEV-9780, The "DISTINCT must not bet converted into GROUP BY when
+# window functions are present" part
+#
+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;
+rank() over (partition by part_id order by a)
+1
+2
+2
+4
+1
+2
+3
+3
+3
+select distinct rank() over (partition by part_id order by a) from t1;
+rank() over (partition by part_id order by a)
+1
+2
+4
+3
+explain format=json
+select distinct rank() over (partition by part_id order by a) from t1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "duplicate_removal": {
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.part_id, t1.a"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+}
+drop table t1;
+#
+# MDEV-9893: Window functions with different ORDER BY lists,
+# one of these lists containing an expression
+#
+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;
+s1 s2 ROW_NUMBER() OVER (order by s1) CUME_DIST() OVER (order by -s1)
+1 a 3 0.8333333333
+NULL NULL 1 0.1666666667
+3 NULL 5 0.5000000000
+4 a 6 0.3333333333
+2 b 4 0.6666666667
+-1 2 1.0000000000
+drop table t1;
+#
+# MDEV-9925: Wrong result with aggregate function as a window function
+#
+create table t1 (i int);
+insert into t1 values (1),(2);
+select i, sum(i) over (partition by i) from t1;
+i sum(i) over (partition by i)
+1 1
+2 2
+drop table t1;
+#
+# MDEV-9922: Assertion `!join->only_const_tables() && fsort' failed in int create_sort_index
+#
+create view v1 as select 1 as i;
+select rank() over (order by i) from v1;
+rank() over (order by i)
+1
+drop view v1;
+#
+# MDEV-10097: Assertion `count > 0' failed in Item_sum_sum::add_helper(bool)
+#
+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;
+o_custkey avg(o_custkey) OVER (PARTITION BY abs(o_custkey)
+ORDER BY o_custkey
+RANGE BETWEEN 15 FOLLOWING
+AND 15 FOLLOWING)
+242 NULL
+238 NULL
+DROP table orders;
+#
+# MDEV-10842: window functions with the same order column
+# but different directions
+#
+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;
+pk r_desc r_asc
+1 11 1
+2 10 2
+3 9 3
+4 8 4
+5 7 5
+6 6 6
+7 5 7
+8 4 8
+9 3 9
+10 2 10
+11 1 11
+drop table t1;
+#
+# MDEV-10874: two window functions with ccompatible sorting
+#
+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;
+pk a d sum_1 sum_2
+1 0 0.100 0.100 0.600
+2 0 0.200 0.300 1.000
+3 0 0.300 0.500 1.400
+4 1 0.400 0.400 1.800
+5 1 0.500 0.900 2.000
+6 1 0.600 1.100 1.600
+7 2 0.500 0.500 1.800
+8 2 NULL 0.500 2.000
+9 2 0.700 0.700 2.400
+10 2 0.800 1.500 2.400
+11 2 0.900 1.700 1.700
+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;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.a, t1.pk"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+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;
+pk a d sum_1 sum_2
+1 0 0.100 0.300 1.400
+2 0 0.200 0.500 1.200
+3 0 0.300 0.300 0.600
+4 1 0.400 0.900 2.600
+5 1 0.500 1.100 2.400
+6 1 0.600 0.600 1.600
+7 2 0.500 0.500 0.500
+8 2 NULL 0.700 1.200
+9 2 0.700 1.500 2.000
+10 2 0.800 1.700 2.400
+11 2 0.900 0.900 2.800
+drop table t1;
+#
+# MDEV-9941: two window functions with compatible partitions
+#
+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;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.a, t1.b"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+drop table t1;
+#
+# MDEV-10815: Window Function Expressions Wrong Results
+#
+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;
+a b simple_sum sum_and_const sum_and_sum
+0.0000000000 1 0.0000000000 1.0000000000 1.0000000000
+1.0000000000 1 1.0000000000 2.0000000000 3.0000000000
+2.0000000000 1 3.0000000000 4.0000000000 6.0000000000
+1.0000000000 2 1.0000000000 2.0000000000 3.0000000000
+1.5000000000 2 2.5000000000 3.5000000000 6.5000000000
+3.0000000000 2 5.5000000000 6.5000000000 11.5000000000
+4.5000000000 2 10.0000000000 11.0000000000 18.0000000000
+drop table t;
+#
+# MDEV-10669: Crash in SELECT with window function used
+#
+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;
+a
+NULL
+NULL
+NULL
+SELECT ifnull(((t.a) / CASE WHEN sum(t.a) over(partition by t.b) =0 then null else null end) ,0) from t;
+ifnull(((t.a) / CASE WHEN sum(t.a) over(partition by t.b) =0 then null else null end) ,0)
+0.00000000000000
+0.00000000000000
+0.00000000000000
+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;
+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))
+1.0000000000 1
+3.0000000000 1.7320508075688772
+0.0000000000 0
+drop table t;
+#
+# MDEV-10868: view definitions with window functions
+#
+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;
+pk c
+1 1
+2 1
+3 1
+4 1
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+select pk, c, c/count(*) over (partition by c order by pk
+rows between 1 preceding and 2 following) as CNT
+from t1;
+pk c CNT
+1 1 0.3333
+2 1 0.2500
+3 1 0.3333
+4 1 0.5000
+5 2 0.6667
+6 2 0.5000
+7 2 0.5000
+8 2 0.5000
+9 2 0.6667
+10 2 1.0000
+create view v1 as select pk, c, c/count(*) over (partition by c order by pk
+rows between 1 preceding and 2 following) as CNT
+from t1;
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` rows between 1 preceding and 2 following ) AS `CNT` from `t1` latin1 latin1_swedish_ci
+select * from v1;
+pk c CNT
+1 1 0.3333
+2 1 0.2500
+3 1 0.3333
+4 1 0.5000
+5 2 0.6667
+6 2 0.5000
+7 2 0.5000
+8 2 0.5000
+9 2 0.6667
+10 2 1.0000
+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);
+pk c CNT
+1 1 0.3333
+2 1 0.2500
+3 1 0.3333
+4 1 0.5000
+5 2 0.6667
+6 2 0.5000
+7 2 0.5000
+8 2 0.5000
+9 2 0.6667
+10 2 1.0000
+create view v2 as 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);
+show create view v2;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` rows between 1 preceding and 2 following ) AS `CNT` from `t1` latin1 latin1_swedish_ci
+select * from v2;
+pk c CNT
+1 1 0.3333
+2 1 0.2500
+3 1 0.3333
+4 1 0.5000
+5 2 0.6667
+6 2 0.5000
+7 2 0.5000
+8 2 0.5000
+9 2 0.6667
+10 2 1.0000
+select pk, c, c/count(*) over w1 as CNT from t1
+window w1 as (partition by c order by pk rows unbounded preceding);
+pk c CNT
+1 1 1.0000
+2 1 0.5000
+3 1 0.3333
+4 1 0.2500
+5 2 2.0000
+6 2 1.0000
+7 2 0.6667
+8 2 0.5000
+9 2 0.4000
+10 2 0.3333
+create view v3 as select pk, c, c/count(*) over w1 as CNT from t1
+window w1 as (partition by c order by pk rows unbounded preceding);
+show create view v3;
+View Create View character_set_client collation_connection
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` rows between unbounded preceding and current row ) AS `CNT` from `t1` latin1 latin1_swedish_ci
+select * from v3;
+pk c CNT
+1 1 1.0000
+2 1 0.5000
+3 1 0.3333
+4 1 0.2500
+5 2 2.0000
+6 2 1.0000
+7 2 0.6667
+8 2 0.5000
+9 2 0.4000
+10 2 0.3333
+select pk, c, c/count(*) over (partition by c order by pk
+range between 3 preceding and current row) as CNT
+from t1;
+pk c CNT
+1 1 1.0000
+2 1 0.5000
+3 1 0.3333
+4 1 0.2500
+5 2 2.0000
+6 2 1.0000
+7 2 0.6667
+8 2 0.5000
+9 2 0.5000
+10 2 0.5000
+create view v4 as select pk, c, c/count(*) over (partition by c order by pk
+range between 3 preceding and current row) as CNT
+from t1;
+show create view v4;
+View Create View character_set_client collation_connection
+v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` range between 3 preceding and current row ) AS `CNT` from `t1` latin1 latin1_swedish_ci
+select * from v4;
+pk c CNT
+1 1 1.0000
+2 1 0.5000
+3 1 0.3333
+4 1 0.2500
+5 2 2.0000
+6 2 1.0000
+7 2 0.6667
+8 2 0.5000
+9 2 0.5000
+10 2 0.5000
+drop view v1,v2,v3,v4;
+drop table t0,t1;
+#
+# MDEV-10875: window function in subquery
+#
+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;
+COUNT(*) OVER (PARTITION BY c)
+2
+1
+2
+SELECT * FROM t1 WHERE i IN ( SELECT COUNT(*) OVER (PARTITION BY c) FROM t2 );
+i
+1
+DROP TABLE t1, t2;
+#
+# MDEV-9976: window function without PARTITION BY and ORDER BY
+#
+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);
+SELECT id, sum(a) OVER (PARTITION BY id
+ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
+FROM t1;
+id sum(a) OVER (PARTITION BY id
+1 1000
+2 1100
+3 1800
+4 1500
+5 1700
+6 1200
+7 2000
+8 2100
+9 1600
+ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
+SELECT id, sum(a) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
+FROM t1;
+id sum(a) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
+1 14000
+2 13000
+3 5900
+4 10700
+5 7600
+6 11900
+7 4100
+8 2100
+9 9200
+DROP TABLE t1;
+#
+# MDEV-11867: window function with aggregation
+# over the result of grouping
+#
+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;
+username s avg(sum(amount)) over (order by s desc)
+user1 9 34.5000
+user2 60 60.0000
+select username, sum(amount), avg(sum(amount)) over (order by sum(amount) desc)
+from t1
+group by username;
+username sum(amount) avg(sum(amount)) over (order by sum(amount) desc)
+user1 9 34.5000
+user2 60 60.0000
+drop table t1;
+#
+# MDEV-11594: window function over implicit grouping
+#
+create table t1 (id int);
+insert into t1 values (1), (2), (3), (2);
+select sum(id) over (order by sum(id)) from t1;
+sum(id) over (order by sum(id))
+1
+select sum(sum(id)) over (order by sum(id)) from t1;
+sum(sum(id)) over (order by sum(id))
+8
+drop table t1;
+#
+# MDEV-9923: integer constant in order by list
+# of window specification
+#
+create table t1 (id int);
+insert into t1 values (1), (2), (3), (2);
+select rank() over (order by 1) from t1;
+rank() over (order by 1)
+1
+1
+1
+1
+select rank() over (order by 2) from t1;
+rank() over (order by 2)
+1
+1
+1
+1
+select rank() over (partition by id order by 2) from t1;
+rank() over (partition by id order by 2)
+1
+1
+1
+1
+drop table t1;
+#
+# MDEV-10660: view using a simple window function
+#
+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;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`id` AS `id`,rank() over ( order by `t1`.`id`) AS `rnk` from `t1` latin1 latin1_swedish_ci
+select id, rank() over (order by id) from t1;
+id rank() over (order by id)
+1 1
+2 2
+3 4
+2 2
+select * from v1;
+id rnk
+1 1
+2 2
+3 4
+2 2
+drop view v1;
+drop table t1;
+#
+# MDEV-11138: window function in the query without tables
+#
+select row_number() over ();
+row_number() over ()
+1
+select count(*) over ();
+count(*) over ()
+1
+select sum(5) over ();
+sum(5) over ()
+5
+select row_number() over (), sum(5) over ();
+row_number() over () sum(5) over ()
+1 5
+select row_number() over (order by 2);
+row_number() over (order by 2)
+1
+select row_number() over (partition by 2);
+row_number() over (partition by 2)
+1
+select row_number() over (partition by 4 order by 1+2);
+row_number() over (partition by 4 order by 1+2)
+1
+#
+# MDEV-11999: execution of prepared statement for
+# tableless query with window functions
+#
+prepare stmt from
+"select row_number() over (partition by 4 order by 1+2)";
+execute stmt;
+row_number() over (partition by 4 order by 1+2)
+1
+execute stmt;
+row_number() over (partition by 4 order by 1+2)
+1
+deallocate prepare stmt;
+#
+# MDEV-11745: window function with min/max
+#
+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;
+b f
+1 1
+1 1
+1 1
+4 4
+4 4
+4 4
+8 7
+8 7
+8 7
+8 7
+select b, min(i) over (partition by b) as f
+from (select * from t1) as tt
+order by i;
+b f
+1 1
+1 1
+1 1
+4 4
+4 4
+4 4
+8 7
+8 7
+8 7
+8 7
+select b, min(i+10) over (partition by b) as f
+from t1 as tt
+order by i;
+b f
+1 11
+1 11
+1 11
+4 14
+4 14
+4 14
+8 17
+8 17
+8 17
+8 17
+select b, min(i) over (partition by b) as f
+from (select i+10 as i, b from t1) as tt
+order by i;
+b f
+1 11
+1 11
+1 11
+4 14
+4 14
+4 14
+8 17
+8 17
+8 17
+8 17
+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;
+b f
+1 31
+1 31
+1 31
+4 34
+4 34
+4 34
+8 37
+8 37
+8 37
+8 37
+select b, max(i) over (partition by b) as f
+from t1 as tt
+order by i;
+b f
+1 3
+1 3
+1 3
+4 6
+4 6
+4 6
+8 10
+8 10
+8 10
+8 10
+select b, max(i) over (partition by b) as f
+from (select * from t1) as tt
+order by i;
+b f
+1 3
+1 3
+1 3
+4 6
+4 6
+4 6
+8 10
+8 10
+8 10
+8 10
+select b, max(i+10) over (partition by b) as f
+from t1 as tt
+order by i;
+b f
+1 13
+1 13
+1 13
+4 16
+4 16
+4 16
+8 20
+8 20
+8 20
+8 20
+select b, max(i) over (partition by b) as f
+from (select i+10 as i, b from t1) as tt
+order by i;
+b f
+1 13
+1 13
+1 13
+4 16
+4 16
+4 16
+8 20
+8 20
+8 20
+8 20
+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;
+b f
+1 33
+1 33
+1 33
+4 36
+4 36
+4 36
+8 40
+8 40
+8 40
+8 40
+select max(i), max(i), sum(i), count(i)
+from t1 as tt
+group by b;
+max(i) max(i) sum(i) count(i)
+3 3 6 3
+6 6 15 3
+10 10 34 4
+select max(i), min(sum(i)) over (partition by count(i)) f
+from t1 as tt
+group by b;
+max(i) f
+3 6
+6 6
+10 34
+select max(i), min(sum(i)) over (partition by count(i)) f
+from (select * from t1) as tt
+group by b;
+max(i) f
+3 6
+6 6
+10 34
+select max(i+10), min(sum(i)+10) over (partition by count(i)) f
+from t1 as tt
+group by b;
+max(i+10) f
+13 16
+16 16
+20 44
+select max(i), max(i), sum(i), count(i)
+from (select i+10 as i, b from t1) as tt
+group by b;
+max(i) max(i) sum(i) count(i)
+13 13 36 3
+16 16 45 3
+20 20 74 4
+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;
+max(i) f
+13 36
+16 36
+20 74
+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;
+max(i) min(i) f
+13 11 2
+16 14 2
+20 17 3
+drop table t1;
+#
+# MDEV-12015: window function over select with WHERE
+# that is always FALSE
+#
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (3), (1), (2);
+SELECT i, ROW_NUMBER() OVER () FROM t1 WHERE 1 = 2;
+i ROW_NUMBER() OVER ()
+SELECT i, COUNT(*) OVER () FROM t1 WHERE 1 = 2;
+i COUNT(*) OVER ()
+DROP TABLE t1;
+#
+# MDEV-12051: window function in query with implicit grouping
+# on always empty set
+#
+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;
+max(a) row_number() over ()
+NULL 1
+select max(a), sum(max(a)) over () from t1 where a > 10;
+max(a) sum(max(a)) over ()
+NULL NULL
+select max(a), sum(max(a)) over (partition by max(a)) from t1 where a > 10;
+max(a) sum(max(a)) over (partition by max(a))
+NULL NULL
+select max(a), row_number() over () from t1 where 1 = 2;
+max(a) row_number() over ()
+NULL 1
+select max(a), sum(max(a)) over () from t1 where 1 = 2;
+max(a) sum(max(a)) over ()
+NULL NULL
+select max(a), sum(max(a)) over (partition by max(a)) from t1 where 1 = 2;
+max(a) sum(max(a)) over (partition by max(a))
+NULL NULL
+select max(a), row_number() over () from t1 where 1 = 2
+having max(a) is not null;
+max(a) row_number() over ()
+select max(a), sum(max(a)) over () from t1 where 1 = 2
+having max(a) is not null;
+max(a) sum(max(a)) over ()
+drop table t1;
+#
+# MDEV-10885: window function in query with implicit grouping
+# with constant condition evaluated to false
+#
+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 ) );
+MAX(a) ROW_NUMBER() OVER (PARTITION BY MAX(a))
+NULL 1
+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 ) );
+MAX(a) COUNT(MAX(a)) OVER (PARTITION BY MAX(a))
+NULL 0
+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 ) );
+MAX(a) SUM(MAX(a)) OVER (PARTITION BY MAX(a))
+NULL NULL
+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;
+MAX(a) ROW_NUMBER() OVER (PARTITION BY MAX(a))
+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 ) );
+a MAX(a) ROW_NUMBER() OVER (PARTITION BY b)
+NULL NULL 1
+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 ) );
+a COUNT(a) AVG(a) OVER (PARTITION BY b)
+NULL 0 NULL
+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 ) );
+a MAX(a) AVG(a) OVER (PARTITION BY b)
+NULL NULL NULL
+DROP TABLE t1,t2,t3;
+#
+# MDEV-10859: Wrong result of aggregate window function in query
+# with HAVING and no ORDER BY
+#
+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);
+SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary;
+depname empno salary avg(salary) OVER (PARTITION BY depname)
+develop 1 5000 4500.0000
+develop 2 4000 4500.0000
+sales 3 6000 5500.0000
+sales 4 5000 5500.0000
+SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary ORDER BY depname;
+depname empno salary avg(salary) OVER (PARTITION BY depname)
+develop 1 5000 4500.0000
+develop 2 4000 4500.0000
+sales 3 6000 5500.0000
+sales 4 5000 5500.0000
+#
+# These last 2 should have the same row results, ignoring order.
+#
+SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary HAVING empno > 1;
+depname empno salary avg(salary) OVER (PARTITION BY depname)
+develop 2 4000 4000.0000
+sales 3 6000 5500.0000
+sales 4 5000 5500.0000
+SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary HAVING empno > 1 ORDER BY depname;
+depname empno salary avg(salary) OVER (PARTITION BY depname)
+develop 2 4000 4000.0000
+sales 3 6000 5500.0000
+sales 4 5000 5500.0000
+drop table empsalary;
+#
+# MDEV-11868: min(distinct) over () returns wrong value
+#
+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;
+CDEC min(TDEC.CDEC) over ()
+NULL -1
+-1 -1
+0 -1
+1 -1
+0 -1
+10 -1
+select VDEC.CDEC, min(VDEC.CDEC) over () from VDEC;
+CDEC min(VDEC.CDEC) over ()
+NULL -1
+-1 -1
+0 -1
+1 -1
+0 -1
+10 -1
+select TDEC.CDEC, max(TDEC.CDEC) over () from TDEC;
+CDEC max(TDEC.CDEC) over ()
+NULL 10
+-1 10
+0 10
+1 10
+0 10
+10 10
+select VDEC.CDEC, max(VDEC.CDEC) over () from VDEC;
+CDEC max(VDEC.CDEC) over ()
+NULL 10
+-1 10
+0 10
+1 10
+0 10
+10 10
+select TDEC.CDEC, min(distinct TDEC.CDEC) over () from TDEC;
+CDEC min(distinct TDEC.CDEC) over ()
+NULL -1
+-1 -1
+0 -1
+1 -1
+0 -1
+10 -1
+select VDEC.CDEC, min(distinct VDEC.CDEC) over () from VDEC;
+CDEC min(distinct VDEC.CDEC) over ()
+NULL -1
+-1 -1
+0 -1
+1 -1
+0 -1
+10 -1
+select TDEC.CDEC, max(distinct TDEC.CDEC) over () from TDEC;
+CDEC max(distinct TDEC.CDEC) over ()
+NULL 10
+-1 10
+0 10
+1 10
+0 10
+10 10
+select VDEC.CDEC, max(distinct VDEC.CDEC) over () from VDEC;
+CDEC max(distinct VDEC.CDEC) over ()
+NULL 10
+-1 10
+0 10
+1 10
+0 10
+10 10
+#
+# These should be removed once support for them is added.
+#
+select TDEC.CDEC, count(distinct TDEC.CDEC) over () from TDEC;
+ERROR 42000: This version of MariaDB doesn't yet support 'COUNT(DISTINCT) aggregate as window function'
+select VDEC.CDEC, count(distinct VDEC.CDEC) over () from VDEC;
+ERROR 42000: This version of MariaDB doesn't yet support 'COUNT(DISTINCT) aggregate as window function'
+select TDEC.CDEC, sum(distinct TDEC.CDEC) over () from TDEC;
+ERROR 42000: This version of MariaDB doesn't yet support 'SUM(DISTINCT) aggregate as window function'
+select VDEC.CDEC, sum(distinct VDEC.CDEC) over () from VDEC;
+ERROR 42000: This version of MariaDB doesn't yet support 'SUM(DISTINCT) aggregate as window function'
+select TDEC.CDEC, avg(distinct TDEC.CDEC) over () from TDEC;
+ERROR 42000: This version of MariaDB doesn't yet support 'AVG(DISTINCT) aggregate as window function'
+select VDEC.CDEC, avg(distinct VDEC.CDEC) over () from VDEC;
+ERROR 42000: This version of MariaDB doesn't yet support 'AVG(DISTINCT) aggregate as window function'
+select TDEC.CDEC, GROUP_CONCAT(TDEC.CDEC) over () from TDEC;
+ERROR 42000: This version of MariaDB doesn't yet support 'GROUP_CONCAT() aggregate as window function'
+select VDEC.CDEC, GROUP_CONCAT(distinct VDEC.CDEC) over () from VDEC;
+ERROR 42000: This version of MariaDB doesn't yet support 'GROUP_CONCAT() aggregate as window function'
+drop table TDEC;
+drop view VDEC;
+#
+# MDEV-10700: 10.2.2 windowing function returns incorrect result
+#
+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;
+count(distinct s)
+993
+select count(distinct s) from (select sum(d) as s from t group by a,b,c) Z where s > 0;
+count(distinct s)
+993
+select count(distinct s) from (select sum(d) over(partition by a,b) as s from t) Z where s > 0;
+count(distinct s)
+993
+select count(distinct s) from (select sum(d) as s from t group by a,b) Z where s > 0;
+count(distinct s)
+993
+select count(distinct s) from (select sum(d) over(partition by a) as s from t) Z where s > 0;
+count(distinct s)
+1
+select count(distinct s) from (select sum(d) as s from t group by a) Z where s > 0;
+count(distinct s)
+1
+drop table t;
+#
+# MDEV-9924: window function in query with group by optimized away
+#
+create table t1 (i int);
+insert into t1 values (2),(3),(1);
+select row_number() over () from t1 group by 1+2;
+row_number() over ()
+1
+select max(i), row_number() over () from t1 group by 1+2;
+max(i) row_number() over ()
+3 1
+select rank() over (order by max(i)) from t1 group by 1+2;
+rank() over (order by max(i))
+1
+select i, row_number() over () from t1 group by 1+2;
+i row_number() over ()
+2 1
+select i, rank() over (order by i) rnk from t1 group by 1+2;
+i rnk
+2 1
+drop table t1;
+#
+# MDEV-11907: window function as the second operand of division
+#
+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;
+pk c CNT
+1 1 0.3333
+2 1 0.2500
+3 1 0.3333
+4 1 0.5000
+5 2 2.0000
+show warnings;
+Level Code Message
+set sql_mode=@sql_mode_save;
+drop table t1;
+#
+# MDEV-12336: several functions over a window function
+#
+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;
+name row_cnt pct_of_total
+Fred 2 66.67
+Joe 1 33.33
+drop table t1;
+#
+# MDEV-11990: window function over min/max aggregation
+#
+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;
+sum(max(id)) over (order by max(id))
+4
+explain
+select sum(max(id)) over (order by max(id)) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary
+create index idx on t1(id);
+select sum(max(id)) over (order by max(id)) from t1;
+sum(max(id)) over (order by max(id))
+4
+explain
+select sum(max(id)) over (order by max(id)) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+select sum(max(id)) over (order by max(id)) from t1 where id < 3;
+sum(max(id)) over (order by max(id))
+2
+select count(max(id)) over (order by max(id)) from t1 where id < 3;
+count(max(id)) over (order by max(id))
+1
+select max(id), rank() over (order by max(id)) from t1 where id < 3;
+max(id) rank() over (order by max(id))
+2 1
+drop table t1;
+#
+# main.win failure post MDEV-12336
+#
+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;
+a
+1000
+300
+300
+drop table t;
+#
+# MDEV-12851 case with window functions query crashes server
+#
+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;
+dt x x
+2017-05-17 00:00:00 2017-05-18 00:00:00 9999-12-31 12:00:00
+2017-05-18 00:00:00 9999-12-31 12:00:00 NULL
+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;
+max(i) over (order by i) max(i) over (order by i) is null max(i) over (order by i) is not null
+NULL 1 0
+1 0 1
+2 0 1
+drop table t1;
+#
+# MDEV-13189: Window functions crash when using INTERVAL function
+#
+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;
+sum(i) over (order by i) interval(sum(i) over (order by i), 10, 20)
+1 0
+3 0
+13 1
+33 2
+63 2
+drop table t1;
+#
+# MDEV-13352: Server crashes in st_join_table::remove_duplicates
+#
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1),(2);
+SELECT DISTINCT ROW_NUMBER() OVER(), i FROM t1 WHERE 0;
+ROW_NUMBER() OVER() i
+SELECT ROW_NUMBER() OVER(), i FROM t1 WHERE 0;
+ROW_NUMBER() OVER() i
+DROP TABLE t1;
+#
+# MDEV-13344: Server crashes in in AGGR_OP::put_record on subquery
+# with window function and constant table
+# (Testcase only)
+#
+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);
+('bar',1) IN ( SELECT c, ROW_NUMBER() OVER (PARTITION BY c) FROM t1)
+0
+DROP TABLE t1;
+#
+# MDEV-13351: Server crashes in st_select_lex::set_explain_type upon UNION with window function
+#
+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 )
+;
+Nth_value(i,1) OVER()
+1
+1
+DROP TABLE t1;
+#
+# A regression after MDEV-13351:
+# MDEV-13374 : Server crashes in first_linear_tab / st_select_lex::set_explain_type
+# upon UNION with aggregate function
+#
+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;
+fld
+1
+2
+DROP TABLE t1;
+#
+# MDEV-13240 Wrong warning with MAX(datetime_field) OVER (...)
+#
+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;
+MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING)
+NULL
+DROP TABLE t1;
+#
+# MDEV-13358 FIRST_VALUE throws SQL Error (1292): Incorrect datetime value
+#
+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;
+Table Create Table
+fv_result CREATE TABLE `fv_result` (
+ `somedate` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM fv_result;
+somedate
+2017-07-20 12:47:56
+DROP TABLE fv_test, fv_result;
+#
+# MDEV-13649: Server crashes in set_field_to_null_with_conversions or in Field::set_notnull
+#
+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;
+lead a_and_lead_part
+NULL 0
+NULL NULL
+NULL NULL
+SELECT a OR LEAD(a) OVER (ORDER BY a) AS a_or_lead_order
+FROM t1
+ORDER BY a;
+a_or_lead_order
+1
+1
+1
+SELECT a AND LEAD(a) OVER (ORDER BY a) AS a_and_lead_order
+FROM t1
+ORDER BY a;
+a_and_lead_order
+0
+1
+NULL
+SELECT a XOR LEAD(a) OVER (ORDER BY a) AS a_xor_lead_order
+FROM t1
+ORDER BY a;
+a_xor_lead_order
+1
+0
+NULL
+SELECT NOT LEAD(a) OVER (ORDER BY a) AS not_lead_order
+FROM t1
+ORDER BY a;
+not_lead_order
+0
+0
+NULL
+SELECT LEAD(a) OVER (ORDER BY a) is not null AS is_not_null_lead_order
+FROM t1
+ORDER BY a;
+is_not_null_lead_order
+1
+1
+0
+drop table t1;
+#
+# MDEV-13354: Server crashes in find_field_in_tables upon PS with window function and subquery
+#
+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;
+row_number() over (partition by i order by i) i
+1 1
+1 2
+DROP TABLE t1;
+#
+# MDEV-13384: "window" seems like a reserved column name but it's not listed as one
+#
+# Currently we allow window as an identifier, except for table aliases.
+#
+CREATE TABLE door (id INT, window VARCHAR(10));
+SELECT id
+FROM door as window;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'window' at line 2
+SELECT id, window
+FROM door;
+id window
+SELECT id, window
+FROM door as window;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'window' at line 2
+DROP TABLE door;
+#
+# MDEV-13352: Server crashes in st_join_table::remove_duplicates
+#
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1),(2);
+SELECT DISTINCT ROW_NUMBER() OVER(), i FROM t1 WHERE 0;
+ROW_NUMBER() OVER() i
+SELECT ROW_NUMBER() OVER(), i FROM t1 WHERE 0;
+ROW_NUMBER() OVER() i
+DROP TABLE t1;
diff --git a/mysql-test/r/win_as_arg_to_aggregate_func.result b/mysql-test/r/win_as_arg_to_aggregate_func.result
new file mode 100644
index 00000000000..e3f0091d6d2
--- /dev/null
+++ b/mysql-test/r/win_as_arg_to_aggregate_func.result
@@ -0,0 +1,114 @@
+create table t1 (i int);
+insert into t1 values (5),(6),(0);
+#
+# Try out all set functions with window functions as arguments.
+# Any such usage should return an error.
+#
+select MIN( SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select MIN(DISTINCT SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select MAX( SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select MAX(DISTINCT SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select SUM( SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select SUM(DISTINCT SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select AVG( SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select AVG(DISTINCT SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select COUNT( SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select COUNT(DISTINCT SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select BIT_AND( SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select BIT_OR( SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select BIT_XOR( SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select STD( SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select STDDEV( SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select STDDEV_POP( SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select STDDEV_SAMP(SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select VARIANCE(SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select VAR_POP(SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select VAR_SAMP(SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select GROUP_CONCAT(SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+select GROUP_CONCAT(DISTINCT SUM(i) OVER (order by i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+#
+# Test that partition instead of order by in over doesn't change result.
+#
+select SUM( SUM(i) OVER (PARTITION BY i) )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+#
+# Test that no arguments in OVER() clause lead to crash in this case.
+#
+select SUM( SUM(i) OVER () )
+from t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+drop table t1;
+#
+# MDEV-13774: Server Crash on Execuate of SQL Statement
+#
+create table t1 (i int);
+insert into t1 values (5),(6),(0);
+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;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+#
+# A way to get the aggregation result.
+#
+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;
+i if_col
+0 0
+5 1
+6 1
+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;
+sum(if_col)
+2
+drop table t1;
diff --git a/mysql-test/r/win_avg.result b/mysql-test/r/win_avg.result
new file mode 100644
index 00000000000..7e539d933d8
--- /dev/null
+++ b/mysql-test/r/win_avg.result
@@ -0,0 +1,95 @@
+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);
+select pk, a, b, avg(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
+from t1;
+pk a b avg(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
+101 0 10 10.0000
+102 0 10 10.0000
+103 1 10 10.0000
+104 1 10 10.0000
+105 2 20 20.0000
+106 2 20 20.0000
+107 2 20 16.6667
+108 2 10 15.0000
+109 4 20 20.0000
+110 4 20 20.0000
+111 5 NULL 1.0000
+112 5 1 1.0000
+113 5 NULL 1.0000
+114 5 NULL NULL
+115 5 NULL NULL
+116 6 1 1.0000
+117 6 1 1.0000
+118 6 1 1.0000
+119 6 1 1.0000
+120 6 1 1.0000
+121 6 1 1.0000
+122 6 1 1.0000
+123 6 1 1.0000
+124 6 1 1.0000
+125 6 1 1.0000
+126 6 1 1.0000
+127 6 1 1.0000
+select pk, a, c, avg(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
+from t1;
+pk a c avg(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
+101 0 1.1 1.6
+102 0 2.1 1.6
+103 1 3.1 3.5999999999999996
+104 1 4.1 3.5999999999999996
+105 2 6.1 6.6
+106 2 7.1 7.116666666666667
+107 2 8.15 6.783333333333334
+108 2 5.1 6.625000000000001
+109 4 9.15 9.65
+110 4 10.15 9.65
+111 5 11.15 11.7
+112 5 12.25 12.25
+113 5 13.35 13.366666666666667
+114 5 14.5 14.5
+115 5 15.65 15.075
+116 6 NULL 10
+117 6 10 5.55
+118 6 1.1 5.55
+119 6 NULL 1.0999999999999996
+120 6 NULL NULL
+121 6 NULL 2.1999999999999997
+122 6 2.2 11.15
+123 6 20.1 3.966666666666667
+124 6 -10.4 4.85
+125 6 NULL -10.400000000000002
+126 6 NULL NULL
+127 6 NULL NULL
+drop table t1;
diff --git a/mysql-test/r/win_big-mdev-10092.result b/mysql-test/r/win_big-mdev-10092.result
new file mode 100644
index 00000000000..dc8b7b9c3bd
--- /dev/null
+++ b/mysql-test/r/win_big-mdev-10092.result
@@ -0,0 +1,328 @@
+#
+# MDEV-10092: Server crashes in in ha_heap::rnd_pos / Table_read_cursor::get_next
+#
+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;
+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;
+//
+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;
+o_custkey Avg(o_custkey) OVER ( ORDER BY o_custkey )
+593 593
+593 593
+892 742.5
+892 742.5
+1175 886.6666666666666
+1175 886.6666666666666
+1178 959.5
+1178 959.5
+1390 1045.6
+1390 1045.6
+1613 1140.1666666666667
+1613 1140.1666666666667
+1732 1224.7142857142858
+1732 1224.7142857142858
+1828 1300.125
+1828 1300.125
+1894 1366.111111111111
+1894 1366.111111111111
+1897 1419.2
+1897 1419.2
+2504 1517.8181818181818
+2504 1517.8181818181818
+2692 1615.6666666666667
+2692 1615.6666666666667
+2819 1708.2307692307693
+2819 1708.2307692307693
+3220 1816.2142857142858
+3220 1816.2142857142858
+3316 1916.2
+3316 1916.2
+3685 2026.75
+3685 2026.75
+4418 2167.4117647058824
+4418 2167.4117647058824
+4681 2307.0555555555557
+4681 2307.0555555555557
+4924 2444.7894736842104
+4924 2444.7894736842104
+4978 2571.45
+4978 2571.45
+5173 2695.3333333333335
+5173 2695.3333333333335
+5185 2808.5
+5185 2808.5
+5437 2922.782608695652
+5437 2922.782608695652
+5623 3035.2916666666665
+5623 3035.2916666666665
+5656 3140.12
+5656 3140.12
+5687 3238.076923076923
+5687 3238.076923076923
+5818 3333.6296296296296
+5818 3333.6296296296296
+6664 3452.5714285714284
+6664 3452.5714285714284
+6839 3569.344827586207
+6839 3569.344827586207
+6958 3682.3
+6958 3682.3
+7213 3796.1935483870966
+7213 3796.1935483870966
+7550 3913.5
+7550 3913.5
+7787 4030.878787878788
+7787 4030.878787878788
+8101 4150.588235294118
+8101 4150.588235294118
+8395 4271.857142857143
+8395 4271.857142857143
+8780 4397.083333333333
+8780 4397.083333333333
+8875 4518.108108108108
+8875 4518.108108108108
+9362 4645.578947368421
+9362 4645.578947368421
+10106 4785.589743589743
+10106 4785.589743589743
+10333 4924.275
+10333 4924.275
+10486 5059.926829268293
+10486 5059.926829268293
+11410 5211.119047619048
+11410 5211.119047619048
+12013 5369.302325581395
+12013 5369.302325581395
+12226 5525.136363636364
+12226 5525.136363636364
+12230 5674.133333333333
+12230 5674.133333333333
+12494 5822.391304347826
+12494 5822.391304347826
+12976 5974.595744680851
+12976 5974.595744680851
+13318 6127.583333333333
+13318 6127.583333333333
+13871 6285.6122448979595
+13871 6285.6122448979595
+14107 6442.04
+14107 6442.04
+14116 6592.509803921569
+14116 6592.509803921569
+14257 6739.903846153846
+14257 6739.903846153846
+14566 6887.566037735849
+14566 6887.566037735849
+14605 7030.481481481482
+14605 7030.481481481482
+14755 7170.927272727273
+14755 7170.927272727273
+14770 7306.625
+14770 7306.625
+14935 7440.456140350877
+14935 7440.456140350877
+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';
+variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
+SORT_MERGE_PASSES WITH PASSES
+flush status;
+select o_custkey, Avg(o_custkey) OVER ( ORDER BY o_custkey RANGE CURRENT ROW ) from orders;
+o_custkey Avg(o_custkey) OVER ( ORDER BY o_custkey RANGE CURRENT ROW )
+593 593
+593 593
+892 892
+892 892
+1175 1175
+1175 1175
+1178 1178
+1178 1178
+1390 1390
+1390 1390
+1613 1613
+1613 1613
+1732 1732
+1732 1732
+1828 1828
+1828 1828
+1894 1894
+1894 1894
+1897 1897
+1897 1897
+2504 2504
+2504 2504
+2692 2692
+2692 2692
+2819 2819
+2819 2819
+3220 3220
+3220 3220
+3316 3316
+3316 3316
+3685 3685
+3685 3685
+4418 4418
+4418 4418
+4681 4681
+4681 4681
+4924 4924
+4924 4924
+4978 4978
+4978 4978
+5173 5173
+5173 5173
+5185 5185
+5185 5185
+5437 5437
+5437 5437
+5623 5623
+5623 5623
+5656 5656
+5656 5656
+5687 5687
+5687 5687
+5818 5818
+5818 5818
+6664 6664
+6664 6664
+6839 6839
+6839 6839
+6958 6958
+6958 6958
+7213 7213
+7213 7213
+7550 7550
+7550 7550
+7787 7787
+7787 7787
+8101 8101
+8101 8101
+8395 8395
+8395 8395
+8780 8780
+8780 8780
+8875 8875
+8875 8875
+9362 9362
+9362 9362
+10106 10106
+10106 10106
+10333 10333
+10333 10333
+10486 10486
+10486 10486
+11410 11410
+11410 11410
+12013 12013
+12013 12013
+12226 12226
+12226 12226
+12230 12230
+12230 12230
+12494 12494
+12494 12494
+12976 12976
+12976 12976
+13318 13318
+13318 13318
+13871 13871
+13871 13871
+14107 14107
+14107 14107
+14116 14116
+14116 14116
+14257 14257
+14257 14257
+14566 14566
+14566 14566
+14605 14605
+14605 14605
+14755 14755
+14755 14755
+14770 14770
+14770 14770
+14935 14935
+14935 14935
+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';
+variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
+SORT_MERGE_PASSES WITH PASSES
+drop table orders;
+drop procedure add_data;
diff --git a/mysql-test/r/win_big-mdev-11697.result b/mysql-test/r/win_big-mdev-11697.result
new file mode 100644
index 00000000000..e5dc271839c
--- /dev/null
+++ b/mysql-test/r/win_big-mdev-11697.result
@@ -0,0 +1,71 @@
+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;
+Table Op Msg_type Msg_text
+test.test_table analyze status OK
+explain select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 1000
+2 DERIVED test_table ALL NULL NULL NULL NULL 1000 Using temporary; Using filesort
+select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10;
+id next_id
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+9 10
+10 11
+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;
+Table Op Msg_type Msg_text
+test.test_table analyze status OK
+explain select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 100000
+2 DERIVED test_table ALL NULL NULL NULL NULL 100000 Using temporary; Using filesort
+flush status;
+select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10;
+id next_id
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+9 10
+10 11
+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';
+variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
+SORT_MERGE_PASSES WITH PASSES
+drop table test_table;
diff --git a/mysql-test/r/win_big.result b/mysql-test/r/win_big.result
new file mode 100644
index 00000000000..c8b27b9a1aa
--- /dev/null
+++ b/mysql-test/r/win_big.result
@@ -0,0 +1,111 @@
+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;
+#################################################################
+## 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';
+variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
+SORT_MERGE_PASSES NO 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';
+variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
+SORT_MERGE_PASSES WITH PASSES
+include/diff_tables.inc [t21, t22]
+drop table t21, t22;
+#################################################################
+# 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';
+variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
+SORT_MERGE_PASSES NO 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';
+variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
+SORT_MERGE_PASSES WITH PASSES
+include/diff_tables.inc [t21, t22]
+drop table t21, t22;
+#################################################################
+# Try having cursors pointing at different IO_CACHE pages
+# 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';
+variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
+SORT_MERGE_PASSES NO 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';
+variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
+SORT_MERGE_PASSES WITH PASSES
+include/diff_tables.inc [t21, t22]
+drop table t21, t22;
+#################################################################
+drop table t10;
+drop table t0,t1;
diff --git a/mysql-test/r/win_bit.result b/mysql-test/r/win_bit.result
new file mode 100644
index 00000000000..ac7625beb90
--- /dev/null
+++ b/mysql-test/r/win_bit.result
@@ -0,0 +1,117 @@
+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);
+# 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;
+pk a b bit_or bit_and bit_xor
+1 0 1 1 1 1
+2 0 2 3 0 3
+3 1 4 7 0 7
+4 1 8 15 0 15
+5 2 32 47 0 47
+6 2 64 111 0 111
+7 2 128 239 0 239
+8 2 16 255 0 255
+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;
+pk a b bit_or bit_and bit_xor
+1 0 2 2 2 2
+2 0 2 2 2 0
+3 1 4 6 0 4
+4 1 4 6 0 0
+5 2 16 22 0 16
+6 2 64 86 0 80
+7 2 128 214 0 208
+8 2 16 214 0 192
+# 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;
+pk a b bit_or bit_and bit_xor
+1 0 1 1 1 1
+2 0 2 3 0 3
+3 1 4 4 4 4
+4 1 8 12 0 12
+5 2 32 32 32 32
+6 2 64 96 0 96
+7 2 128 224 0 224
+8 2 16 240 0 240
+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;
+pk a b bit_or bit_and bit_xor
+1 0 2 2 2 2
+2 0 2 2 2 0
+3 1 4 4 4 4
+4 1 4 4 4 0
+5 2 16 16 16 16
+6 2 64 80 0 80
+7 2 128 208 0 208
+8 2 16 208 0 192
+# 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;
+pk a b bit_or bit_and bit_xor
+1 0 1 3 1 1
+2 0 2 3 0 3
+3 1 4 12 4 4
+4 1 8 12 0 12
+5 2 32 96 32 32
+6 2 64 224 0 96
+7 2 128 208 0 224
+8 2 16 144 0 240
+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;
+pk a b bit_or bit_and bit_xor
+1 0 2 2 2 2
+2 0 2 2 2 0
+3 1 4 4 4 4
+4 1 4 4 4 0
+5 2 16 16 16 16
+6 2 64 80 0 80
+7 2 128 208 0 208
+8 2 16 208 0 192
+drop table t1;
+drop table t2;
diff --git a/mysql-test/r/win_empty_over.result b/mysql-test/r/win_empty_over.result
new file mode 100644
index 00000000000..a5ee74b943a
--- /dev/null
+++ b/mysql-test/r/win_empty_over.result
@@ -0,0 +1,145 @@
+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;
+pk row_number() over ()
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+explain FORMAT=JSON select pk, row_number() over () from t1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "pk"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "index",
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["pk"],
+ "rows": 11,
+ "filtered": 100,
+ "using_index": true
+ }
+ }
+ }
+ }
+}
+explain FORMAT=JSON select row_number() over (), pk from t1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "`row_number() over ()`"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "index",
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["pk"],
+ "rows": 11,
+ "filtered": 100,
+ "using_index": true
+ }
+ }
+ }
+ }
+}
+select row_number() over () from (select 4) as t;
+row_number() over ()
+1
+select min(a) over (), max(a) over (), a, row_number() over ()
+from t1
+where a = 0;
+min(a) over () max(a) over () a row_number() over ()
+0 0 0 1
+0 0 0 2
+0 0 0 3
+select a, min(a) over (), max(a) over (), row_number() over ()
+from t1
+where a = 0;
+a min(a) over () max(a) over () row_number() over ()
+0 0 0 1
+0 0 0 2
+0 0 0 3
+select min(a) over () + 1, max(a) over (), row_number() over ()
+from t1
+where a = 0;
+min(a) over () + 1 max(a) over () row_number() over ()
+1 0 1
+1 0 2
+1 0 3
+select min(a) over () + a, max(a) over (), row_number() over ()
+from t1
+where a = 1;
+min(a) over () + a max(a) over () row_number() over ()
+2 1 1
+2 1 2
+2 1 3
+select a + min(a) over (), max(a) over (), row_number() over ()
+from t1
+where a = 1;
+a + min(a) over () max(a) over () row_number() over ()
+2 1 1
+2 1 2
+2 1 3
+select a + min(a) over () from t1 where a = 1;
+a + min(a) over ()
+2
+2
+2
+create view win_view
+as (select a, min(a) over () from t1 where a = 1);
+select * from win_view;
+a min(a) over ()
+1 1
+1 1
+1 1
+drop view win_view;
+create view win_view
+as (select a, max(a + 1) over () from t1 where a = 1);
+select * from win_view;
+a max(a + 1) over ()
+1 2
+1 2
+1 2
+drop view win_view;
+drop table t1;
diff --git a/mysql-test/r/win_first_last_value.result b/mysql-test/r/win_first_last_value.result
new file mode 100644
index 00000000000..b8fab458249
--- /dev/null
+++ b/mysql-test/r/win_first_last_value.result
@@ -0,0 +1,131 @@
+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;
+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)
+11 1 11 11 11
+10 1 10 11 10
+9 1 9 11 9
+8 1 8 11 8
+7 1 7 11 7
+6 1 6 11 6
+5 1 5 11 5
+4 1 4 11 4
+3 1 3 11 3
+2 1 2 11 2
+1 1 1 11 1
+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;
+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)
+1 1 11 11 1
+2 1 11 11 1
+3 1 11 11 1
+4 1 11 11 1
+5 1 11 11 1
+6 1 11 11 1
+7 1 11 11 1
+8 1 11 11 1
+9 1 11 11 1
+10 1 11 11 1
+11 1 11 11 1
+select pk,
+first_value(pk) over (order by pk desc),
+last_value(pk) over (order by pk desc)
+from t1;
+pk first_value(pk) over (order by pk desc) last_value(pk) over (order by pk desc)
+1 11 1
+2 11 2
+3 11 3
+4 11 4
+5 11 5
+6 11 6
+7 11 7
+8 11 8
+9 11 9
+10 11 10
+11 11 11
+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;
+pk a b c d e fst_b lst_b fst_c lst_c fst_d lst_d fst_e lst_e
+1 0 1 one 0.100 0.001 1 1 one one 0.100 0.100 0.001 0.001
+2 0 2 two 0.200 0.002 1 2 one two 0.100 0.200 0.001 0.002
+3 0 3 three 0.300 0.003 1 3 one three 0.100 0.300 0.001 0.003
+4 1 2 three 0.400 0.004 2 2 three three 0.400 0.400 0.004 0.004
+5 1 1 two 0.500 0.005 2 1 three two 0.400 0.500 0.004 0.005
+6 1 1 one 0.600 0.006 2 1 three one 0.400 0.600 0.004 0.006
+7 2 NULL n_one 0.500 0.007 NULL NULL n_one n_one 0.500 0.500 0.007 0.007
+8 2 1 n_two NULL 0.008 NULL 1 n_one n_two 0.500 NULL 0.007 0.008
+9 2 2 NULL 0.700 0.009 NULL 2 n_one NULL 0.500 0.700 0.007 0.009
+10 2 0 n_four 0.800 0.01 NULL 0 n_one n_four 0.500 0.800 0.007 0.01
+11 2 10 NULL 0.900 NULL NULL 10 n_one NULL 0.500 0.900 0.007 NULL
+drop table t1;
+#
+# MDEV-11746: Wrong result upon using FIRST_VALUE with a window frame
+#
+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;
+i fst_1f last_1f fst_1p1f fst_1p1f fst_2p1p fst_2p1p fst_1f2f fst_1f2f
+1 1 2 1 2 NULL NULL 2 3
+2 2 3 1 3 1 1 3 4
+3 3 4 2 4 1 2 4 5
+4 4 5 3 5 2 3 5 6
+5 5 6 4 6 3 4 6 7
+6 6 7 5 7 4 5 7 8
+7 7 8 6 8 5 6 8 9
+8 8 9 7 9 6 7 9 10
+9 9 10 8 10 7 8 10 10
+10 10 10 9 10 8 9 NULL NULL
+drop table t1;
diff --git a/mysql-test/r/win_i_s.result b/mysql-test/r/win_i_s.result
new file mode 100644
index 00000000000..8678c455b45
--- /dev/null
+++ b/mysql-test/r/win_i_s.result
@@ -0,0 +1,38 @@
+show status like '%window%';
+Variable_name Value
+Feature_window_functions 0
+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;
+a b rank() over (order by a)
+1 10 1
+2 20 2
+3 30 3
+show status like '%window%';
+Variable_name Value
+Feature_window_functions 1
+select a, b, rank() over (order by a), sum(a) over (order by a) from t1;
+a b rank() over (order by a) sum(a) over (order by a)
+1 10 1 1
+2 20 2 3
+3 30 3 6
+show status like '%window%';
+Variable_name Value
+Feature_window_functions 2
+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;
+r1 r2
+1 1
+1 2
+1 3
+2 1
+2 2
+2 3
+3 1
+3 2
+3 3
+show status like '%window%';
+Variable_name Value
+Feature_window_functions 4
+drop table t1;
diff --git a/mysql-test/r/win_insert_select.result b/mysql-test/r/win_insert_select.result
new file mode 100644
index 00000000000..bb25d052840
--- /dev/null
+++ b/mysql-test/r/win_insert_select.result
@@ -0,0 +1,93 @@
+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;
+c1 c2
+1 manual_insert_1
+4 manual_insert_2
+11 should repeat 2 times [11-12]
+12 should repeat 2 times [11-12]
+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;
+c1 c2
+11 dense_rank_insert
+12 dense_rank_insert
+1 manual_insert_1
+4 manual_insert_2
+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;
+c1 c2
+1 manual_insert_1
+4 manual_insert_2
+101 rank_insert
+102 rank_insert
+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;
+c1 c2
+1 manual_insert_1
+4 manual_insert_2
+101 ntile_insert
+102 ntile_insert
+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;
+c1 c2
+1 manual_insert_1
+4 manual_insert_2
+1000 percent_rank_insert
+1001 percent_rank_insert
+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;
+c1 c2
+1001 count_insert
+1002 count_insert
+1 manual_insert_1
+4 manual_insert_2
+DELETE FROM t1;
+EXECUTE populate_table;
+#
+# Test how avg interacts when the results need to be rounded.
+#
+SELECT 1000 + (avg(c1) over(order by c1)) as avg_expr, c1, "This will be inserted into t1" from t1;
+avg_expr c1 This will be inserted into t1
+1001.0000 1 This will be inserted into t1
+1002.5000 4 This will be inserted into 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;
+c1 c2
+1001 avg_insert
+1003 avg_insert
+1 manual_insert_1
+4 manual_insert_2
+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;
+c1 c2
+1 manual_insert_1
+4 manual_insert_2
+1001 sum_insert
+1005 sum_insert
+DROP table t1;
diff --git a/mysql-test/r/win_lead_lag.result b/mysql-test/r/win_lead_lag.result
new file mode 100644
index 00000000000..5ead58fa11a
--- /dev/null
+++ b/mysql-test/r/win_lead_lag.result
@@ -0,0 +1,229 @@
+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;
+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)
+1 2 2 3 1 NULL NULL
+2 3 3 4 2 1 NULL
+3 4 4 5 3 2 1
+4 5 5 6 4 3 2
+5 6 6 7 5 4 3
+6 7 7 8 6 5 4
+7 8 8 9 7 6 5
+8 9 9 10 8 7 6
+9 10 10 11 9 8 7
+10 11 11 NULL 10 9 8
+11 NULL NULL NULL 11 10 9
+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;
+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)
+1 NULL NULL NULL 1 2 3
+2 1 1 NULL 2 3 4
+3 2 2 1 3 4 5
+4 3 3 2 4 5 6
+5 4 4 3 5 6 7
+6 5 5 4 6 7 8
+7 6 6 5 7 8 9
+8 7 7 6 8 9 10
+9 8 8 7 9 10 11
+10 9 9 8 10 11 NULL
+11 10 10 9 11 NULL NULL
+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;
+pk pk - 2 lag(pk, pk - 2) over (order by pk) lead(pk, pk - 2) over (order by pk)
+1 -1 2 NULL
+2 0 2 2
+3 1 2 4
+4 2 2 6
+5 3 2 8
+6 4 2 10
+7 5 2 NULL
+8 6 2 NULL
+9 7 2 NULL
+10 8 2 NULL
+11 9 2 NULL
+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;
+pk pk - 2 lag(pk, pk + 2) over (order by pk) lead(pk, pk + 2) over (order by pk)
+1 -1 NULL 4
+2 0 NULL 6
+3 1 NULL 8
+4 2 NULL 10
+5 3 NULL NULL
+6 4 NULL NULL
+7 5 NULL NULL
+8 6 NULL NULL
+9 7 NULL NULL
+10 8 NULL NULL
+11 9 NULL NULL
+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;
+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)
+1 0 2 2 3 1 NULL NULL
+2 0 3 3 NULL 2 1 NULL
+3 0 NULL NULL NULL 3 2 1
+4 1 5 5 6 4 NULL NULL
+5 1 6 6 NULL 5 4 NULL
+6 1 NULL NULL NULL 6 5 4
+7 2 8 8 9 7 NULL NULL
+8 2 9 9 10 8 7 NULL
+9 2 10 10 11 9 8 7
+10 2 11 11 NULL 10 9 8
+11 2 NULL NULL NULL 11 10 9
+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;
+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)
+1 0 NULL NULL NULL 1 2 3
+2 0 1 1 NULL 2 3 NULL
+3 0 2 2 1 3 NULL NULL
+4 1 NULL NULL NULL 4 5 6
+5 1 4 4 NULL 5 6 NULL
+6 1 5 5 4 6 NULL NULL
+7 2 NULL NULL NULL 7 8 9
+8 2 7 7 NULL 8 9 10
+9 2 8 8 7 9 10 11
+10 2 9 9 8 10 11 NULL
+11 2 10 10 9 11 NULL NULL
+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;
+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)
+1 0 -1 2 NULL 3 NULL
+2 0 0 2 2 NULL NULL
+3 0 1 2 NULL NULL 1
+4 1 2 NULL 6 5 NULL
+5 1 3 NULL NULL 6 4
+6 1 4 NULL NULL NULL 5
+7 2 5 NULL NULL 7 7
+8 2 6 NULL NULL 8 8
+9 2 7 NULL NULL 9 9
+10 2 8 NULL NULL 10 10
+11 2 9 NULL NULL 11 11
+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;
+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)
+1 0 -1 NULL NULL NULL 3
+2 0 0 NULL NULL NULL NULL
+3 0 1 NULL NULL 1 NULL
+4 1 2 NULL NULL NULL NULL
+5 1 3 NULL NULL NULL NULL
+6 1 4 NULL NULL NULL NULL
+7 2 5 NULL NULL NULL 11
+8 2 6 NULL NULL NULL NULL
+9 2 7 NULL NULL NULL NULL
+10 2 8 NULL NULL NULL NULL
+11 2 9 NULL NULL 7 NULL
+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;
+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)
+1 0 1 one 0.100 0.001 NULL NULL NULL NULL NULL
+2 0 2 two 0.200 0.002 0 1 one 0.100 0.001
+3 0 3 three 0.300 0.003 0 2 two 0.200 0.002
+4 1 2 three 0.400 0.004 NULL NULL NULL NULL NULL
+5 1 1 two 0.500 0.005 1 2 three 0.400 0.004
+6 1 1 one 0.600 0.006 1 1 two 0.500 0.005
+7 2 NULL n_one 0.500 0.007 NULL NULL NULL NULL NULL
+8 2 1 n_two NULL 0.008 2 NULL n_one 0.500 0.007
+9 2 2 NULL 0.700 0.009 2 1 n_two NULL 0.008
+10 2 0 n_four 0.800 0.01 2 2 NULL 0.700 0.009
+11 2 10 NULL 0.900 NULL 2 0 n_four 0.800 0.01
+select pk, a, b, a+b,
+lag(a + b) over (partition by a order by pk)
+from t1
+order by pk asc;
+pk a b a+b lag(a + b) over (partition by a order by pk)
+1 0 1 1 NULL
+2 0 2 2 1
+3 0 3 3 2
+4 1 2 3 NULL
+5 1 1 2 3
+6 1 1 2 2
+7 2 NULL NULL NULL
+8 2 1 3 NULL
+9 2 2 4 3
+10 2 0 2 4
+11 2 10 12 2
+select pk, a, b, a+b,
+lag(a + b) over (partition by a order by pk) + pk
+from t1
+order by pk asc;
+pk a b a+b lag(a + b) over (partition by a order by pk) + pk
+1 0 1 1 NULL
+2 0 2 2 3
+3 0 3 3 5
+4 1 2 3 NULL
+5 1 1 2 8
+6 1 1 2 8
+7 2 NULL NULL NULL
+8 2 1 3 NULL
+9 2 2 4 12
+10 2 0 2 14
+11 2 10 12 13
+drop table t1;
diff --git a/mysql-test/r/win_min_max.result b/mysql-test/r/win_min_max.result
new file mode 100644
index 00000000000..b3a90262bf7
--- /dev/null
+++ b/mysql-test/r/win_min_max.result
@@ -0,0 +1,864 @@
+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);
+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;
+pk a b min max
+101 0 10 10 10
+102 0 10 10 10
+103 1 10 10 10
+104 1 10 10 10
+105 2 20 20 20
+106 2 20 20 20
+107 2 20 10 20
+108 2 10 10 20
+109 4 20 20 20
+110 4 20 20 20
+111 5 NULL 1 1
+112 5 1 1 1
+113 5 NULL 1 1
+114 5 NULL NULL NULL
+115 5 NULL NULL NULL
+116 6 1 1 1
+117 6 1 1 1
+118 6 1 1 1
+119 6 1 1 1
+120 6 1 1 1
+121 6 1 1 1
+122 6 1 1 1
+123 6 1 1 1
+124 6 1 1 1
+125 6 1 1 1
+126 6 1 1 1
+127 6 1 1 1
+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;
+pk a c min max
+101 0 1.1 1.1 2.1
+102 0 2.1 1.1 2.1
+103 1 3.1 3.1 4.1
+104 1 4.1 3.1 4.1
+105 2 6.1 6.1 7.1
+106 2 7.1 6.1 8.15
+107 2 8.15 5.1 8.15
+108 2 5.1 5.1 8.15
+109 4 9.15 9.15 10.15
+110 4 10.15 9.15 10.15
+111 5 11.15 11.15 12.25
+112 5 12.25 11.15 13.35
+113 5 13.35 12.25 14.5
+114 5 14.5 13.35 15.65
+115 5 15.65 14.5 15.65
+116 6 NULL 10 10
+117 6 10 1.1 10
+118 6 1.1 1.1 10
+119 6 NULL 1.1 1.1
+120 6 NULL NULL NULL
+121 6 NULL 2.2 2.2
+122 6 2.2 2.2 20.1
+123 6 20.1 -10.4 20.1
+124 6 -10.4 -10.4 20.1
+125 6 NULL -10.4 -10.4
+126 6 NULL NULL NULL
+127 6 NULL NULL NULL
+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');
+# 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;
+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)
+1 0 1 one one one one one
+2 0 2 two one two one two
+3 0 3 three one two one two
+4 1 20 four four two four four
+5 1 10 five five two five four
+6 1 40 six five two five six
+7 1 30 seven five two five six
+8 4 300 eight eight two eight eight
+9 4 100 nine eight two eight nine
+10 4 200 ten eight two eight ten
+11 4 200 eleven eight two eight ten
+# 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;
+pk a b c min1 max1 min2 max2
+1 0 1 one NULL NULL NULL NULL
+2 0 2 two NULL NULL NULL NULL
+3 0 3 three NULL NULL NULL NULL
+4 1 20 four NULL NULL NULL NULL
+5 1 10 five NULL NULL NULL NULL
+6 1 40 six NULL NULL NULL NULL
+7 1 30 seven NULL NULL NULL NULL
+8 4 300 eight NULL NULL NULL NULL
+9 4 100 nine NULL NULL NULL NULL
+10 4 200 ten NULL NULL NULL NULL
+11 4 200 eleven NULL NULL NULL NULL
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one NULL NULL NULL NULL
+2 0 2 two NULL NULL NULL NULL
+3 0 3 three NULL NULL NULL NULL
+4 1 20 four NULL NULL NULL NULL
+5 1 10 five NULL NULL NULL NULL
+6 1 40 six NULL NULL NULL NULL
+7 1 30 seven NULL NULL NULL NULL
+8 4 300 eight NULL NULL NULL NULL
+9 4 100 nine NULL NULL NULL NULL
+10 4 200 ten NULL NULL NULL NULL
+11 4 200 eleven NULL NULL NULL NULL
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one NULL NULL NULL NULL
+2 0 2 two NULL NULL NULL NULL
+3 0 3 three NULL NULL NULL NULL
+4 1 20 four NULL NULL NULL NULL
+5 1 10 five NULL NULL NULL NULL
+6 1 40 six NULL NULL NULL NULL
+7 1 30 seven NULL NULL NULL NULL
+8 4 300 eight NULL NULL NULL NULL
+9 4 100 nine NULL NULL NULL NULL
+10 4 200 ten NULL NULL NULL NULL
+11 4 200 eleven NULL NULL NULL NULL
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one NULL NULL NULL NULL
+2 0 2 two NULL NULL NULL NULL
+3 0 3 three NULL NULL NULL NULL
+4 1 20 four NULL NULL NULL NULL
+5 1 10 five NULL NULL NULL NULL
+6 1 40 six NULL NULL NULL NULL
+7 1 30 seven NULL NULL NULL NULL
+8 4 300 eight NULL NULL NULL NULL
+9 4 100 nine NULL NULL NULL NULL
+10 4 200 ten NULL NULL NULL NULL
+11 4 200 eleven NULL NULL NULL NULL
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one NULL NULL NULL NULL
+2 0 2 two NULL NULL NULL NULL
+3 0 3 three NULL NULL NULL NULL
+4 1 20 four NULL NULL NULL NULL
+5 1 10 five NULL NULL NULL NULL
+6 1 40 six NULL NULL NULL NULL
+7 1 30 seven NULL NULL NULL NULL
+8 4 300 eight NULL NULL NULL NULL
+9 4 100 nine NULL NULL NULL NULL
+10 4 200 ten NULL NULL NULL NULL
+11 4 200 eleven NULL NULL NULL NULL
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one NULL NULL NULL NULL
+2 0 2 two NULL NULL NULL NULL
+3 0 3 three NULL NULL NULL NULL
+4 1 20 four NULL NULL NULL NULL
+5 1 10 five NULL NULL NULL NULL
+6 1 40 six NULL NULL NULL NULL
+7 1 30 seven NULL NULL NULL NULL
+8 4 300 eight NULL NULL NULL NULL
+9 4 100 nine NULL NULL NULL NULL
+10 4 200 ten NULL NULL NULL NULL
+11 4 200 eleven NULL NULL NULL NULL
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one NULL NULL NULL NULL
+2 0 2 two NULL NULL NULL NULL
+3 0 3 three NULL NULL NULL NULL
+4 1 20 four NULL NULL NULL NULL
+5 1 10 five NULL NULL NULL NULL
+6 1 40 six NULL NULL NULL NULL
+7 1 30 seven NULL NULL NULL NULL
+8 4 300 eight NULL NULL NULL NULL
+9 4 100 nine NULL NULL NULL NULL
+10 4 200 ten NULL NULL NULL NULL
+11 4 200 eleven NULL NULL NULL NULL
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one NULL NULL NULL NULL
+2 0 2 two NULL NULL NULL NULL
+3 0 3 three NULL NULL NULL NULL
+4 1 20 four NULL NULL NULL NULL
+5 1 10 five NULL NULL NULL NULL
+6 1 40 six NULL NULL NULL NULL
+7 1 30 seven NULL NULL NULL NULL
+8 4 300 eight NULL NULL NULL NULL
+9 4 100 nine NULL NULL NULL NULL
+10 4 200 ten NULL NULL NULL NULL
+11 4 200 eleven NULL NULL NULL NULL
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one NULL NULL NULL NULL
+2 0 2 two NULL NULL NULL NULL
+3 0 3 three NULL NULL NULL NULL
+4 1 20 four NULL NULL NULL NULL
+5 1 10 five NULL NULL NULL NULL
+6 1 40 six NULL NULL NULL NULL
+7 1 30 seven NULL NULL NULL NULL
+8 4 300 eight NULL NULL NULL NULL
+9 4 100 nine NULL NULL NULL NULL
+10 4 200 ten NULL NULL NULL NULL
+11 4 200 eleven NULL NULL NULL NULL
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one NULL NULL NULL NULL
+2 0 2 two NULL NULL NULL NULL
+3 0 3 three NULL NULL NULL NULL
+4 1 20 four NULL NULL NULL NULL
+5 1 10 five NULL NULL NULL NULL
+6 1 40 six NULL NULL NULL NULL
+7 1 30 seven NULL NULL NULL NULL
+8 4 300 eight NULL NULL NULL NULL
+9 4 100 nine NULL NULL NULL NULL
+10 4 200 ten NULL NULL NULL NULL
+11 4 200 eleven NULL NULL NULL NULL
+# 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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 1 1 1
+2 0 2 two 2 2 2 2
+3 0 3 three 3 3 3 3
+4 1 20 four 20 20 20 20
+5 1 10 five 10 10 10 10
+6 1 40 six 40 40 40 40
+7 1 30 seven 30 30 30 30
+8 4 300 eight 300 300 300 300
+9 4 100 nine 100 100 100 100
+10 4 200 ten 200 200 200 200
+11 4 200 eleven 200 200 200 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 1 1 1
+2 0 2 two 2 2 2 2
+3 0 3 three 3 3 3 3
+4 1 20 four 20 20 20 20
+5 1 10 five 10 10 10 10
+6 1 40 six 40 40 40 40
+7 1 30 seven 30 30 30 30
+8 4 300 eight 300 300 300 300
+9 4 100 nine 100 100 100 100
+10 4 200 ten 200 200 200 200
+11 4 200 eleven 200 200 200 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 1 1 1
+2 0 2 two 2 2 2 2
+3 0 3 three 3 3 3 3
+4 1 20 four 20 20 20 20
+5 1 10 five 10 10 10 10
+6 1 40 six 40 40 40 40
+7 1 30 seven 30 30 30 30
+8 4 300 eight 300 300 300 300
+9 4 100 nine 100 100 100 100
+10 4 200 ten 200 200 200 200
+11 4 200 eleven 200 200 200 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one NULL NULL NULL NULL
+2 0 2 two 1 1 1 1
+3 0 3 three 2 2 2 2
+4 1 20 four 3 3 NULL NULL
+5 1 10 five 20 20 20 20
+6 1 40 six 10 10 10 10
+7 1 30 seven 40 40 40 40
+8 4 300 eight 30 30 NULL NULL
+9 4 100 nine 300 300 300 300
+10 4 200 ten 100 100 100 100
+11 4 200 eleven 200 200 200 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 2 2 2 2
+2 0 2 two 3 3 3 3
+3 0 3 three 20 20 NULL NULL
+4 1 20 four 10 10 10 10
+5 1 10 five 40 40 40 40
+6 1 40 six 30 30 30 30
+7 1 30 seven 300 300 NULL NULL
+8 4 300 eight 100 100 100 100
+9 4 100 nine 200 200 200 200
+10 4 200 ten 200 200 200 200
+11 4 200 eleven NULL NULL NULL NULL
+# 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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 20 20 NULL NULL
+2 0 2 two 10 10 NULL NULL
+3 0 3 three 40 40 NULL NULL
+4 1 20 four 30 30 30 30
+5 1 10 five 300 300 NULL NULL
+6 1 40 six 100 100 NULL NULL
+7 1 30 seven 200 200 NULL NULL
+8 4 300 eight 200 200 200 200
+9 4 100 nine NULL NULL NULL NULL
+10 4 200 ten NULL NULL NULL NULL
+11 4 200 eleven NULL NULL NULL NULL
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one NULL NULL NULL NULL
+2 0 2 two NULL NULL NULL NULL
+3 0 3 three NULL NULL NULL NULL
+4 1 20 four 1 1 NULL NULL
+5 1 10 five 2 2 NULL NULL
+6 1 40 six 3 3 NULL NULL
+7 1 30 seven 20 20 20 20
+8 4 300 eight 10 10 NULL NULL
+9 4 100 nine 40 40 NULL NULL
+10 4 200 ten 30 30 NULL NULL
+11 4 200 eleven 300 300 300 300
+# 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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 2 1 2
+2 0 2 two 2 3 2 3
+3 0 3 three 3 20 3 3
+4 1 20 four 10 20 10 20
+5 1 10 five 10 40 10 40
+6 1 40 six 30 40 30 40
+7 1 30 seven 30 300 30 30
+8 4 300 eight 100 300 100 300
+9 4 100 nine 100 200 100 200
+10 4 200 ten 200 200 200 200
+11 4 200 eleven 200 200 200 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 2 1 2
+2 0 2 two 2 3 2 3
+3 0 3 three 3 20 3 3
+4 1 20 four 10 20 10 20
+5 1 10 five 10 40 10 40
+6 1 40 six 30 40 30 40
+7 1 30 seven 30 300 30 30
+8 4 300 eight 100 300 100 300
+9 4 100 nine 100 200 100 200
+10 4 200 ten 200 200 200 200
+11 4 200 eleven 200 200 200 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 1 1 1
+2 0 2 two 1 2 1 2
+3 0 3 three 2 3 2 3
+4 1 20 four 3 20 20 20
+5 1 10 five 10 20 10 20
+6 1 40 six 10 40 10 40
+7 1 30 seven 30 40 30 40
+8 4 300 eight 30 300 300 300
+9 4 100 nine 100 300 100 300
+10 4 200 ten 100 200 100 200
+11 4 200 eleven 200 200 200 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 1 1 1
+2 0 2 two 1 2 1 2
+3 0 3 three 2 3 2 3
+4 1 20 four 3 20 20 20
+5 1 10 five 10 20 10 20
+6 1 40 six 10 40 10 40
+7 1 30 seven 30 40 30 40
+8 4 300 eight 30 300 300 300
+9 4 100 nine 100 300 100 300
+10 4 200 ten 100 200 100 200
+11 4 200 eleven 200 200 200 200
+# 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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 20 1 3
+2 0 2 two 2 20 2 3
+3 0 3 three 3 40 3 3
+4 1 20 four 10 40 10 40
+5 1 10 five 10 300 10 40
+6 1 40 six 30 300 30 40
+7 1 30 seven 30 300 30 30
+8 4 300 eight 100 300 100 300
+9 4 100 nine 100 200 100 200
+10 4 200 ten 200 200 200 200
+11 4 200 eleven 200 200 200 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 2 1 2
+2 0 2 two 1 3 1 3
+3 0 3 three 1 20 1 3
+4 1 20 four 2 20 10 20
+5 1 10 five 3 40 10 40
+6 1 40 six 10 40 10 40
+7 1 30 seven 10 300 10 40
+8 4 300 eight 30 300 100 300
+9 4 100 nine 30 300 100 300
+10 4 200 ten 100 300 100 300
+11 4 200 eleven 100 200 100 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 1 1 1
+2 0 2 two 1 2 1 2
+3 0 3 three 1 3 1 3
+4 1 20 four 1 20 20 20
+5 1 10 five 2 20 10 20
+6 1 40 six 3 40 10 40
+7 1 30 seven 10 40 10 40
+8 4 300 eight 10 300 300 300
+9 4 100 nine 30 300 100 300
+10 4 200 ten 30 300 100 300
+11 4 200 eleven 100 300 100 300
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 1 1 1
+2 0 2 two 1 2 1 2
+3 0 3 three 1 3 1 3
+4 1 20 four 1 20 20 20
+5 1 10 five 2 20 10 20
+6 1 40 six 3 40 10 40
+7 1 30 seven 10 40 10 40
+8 4 300 eight 10 300 300 300
+9 4 100 nine 30 300 100 300
+10 4 200 ten 30 300 100 300
+11 4 200 eleven 100 300 100 300
+# 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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 1 1 1
+2 0 2 two 2 2 2 2
+3 0 3 three 3 3 3 3
+4 1 20 four 20 20 20 20
+5 1 10 five 10 10 10 10
+6 1 40 six 40 40 40 40
+7 1 30 seven 30 30 30 30
+8 4 300 eight 300 300 300 300
+9 4 100 nine 100 100 100 100
+10 4 200 ten 200 200 200 200
+11 4 200 eleven 200 200 200 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 1 1 1
+2 0 2 two 2 2 2 2
+3 0 3 three 3 3 3 3
+4 1 20 four 20 20 20 20
+5 1 10 five 10 10 10 10
+6 1 40 six 40 40 40 40
+7 1 30 seven 30 30 30 30
+8 4 300 eight 300 300 300 300
+9 4 100 nine 100 100 100 100
+10 4 200 ten 200 200 200 200
+11 4 200 eleven 200 200 200 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 1 1 1
+2 0 2 two 2 2 2 2
+3 0 3 three 3 3 3 3
+4 1 20 four 20 20 20 20
+5 1 10 five 10 10 10 10
+6 1 40 six 40 40 40 40
+7 1 30 seven 30 30 30 30
+8 4 300 eight 300 300 300 300
+9 4 100 nine 100 100 100 100
+10 4 200 ten 200 200 200 200
+11 4 200 eleven 200 200 200 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one NULL NULL NULL NULL
+2 0 2 two 1 1 1 1
+3 0 3 three 2 2 2 2
+4 1 20 four 3 3 NULL NULL
+5 1 10 five 20 20 20 20
+6 1 40 six 10 10 10 10
+7 1 30 seven 40 40 40 40
+8 4 300 eight 30 30 NULL NULL
+9 4 100 nine 300 300 300 300
+10 4 200 ten 100 100 100 100
+11 4 200 eleven 200 200 200 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 2 2 2 2
+2 0 2 two 3 3 3 3
+3 0 3 three 20 20 NULL NULL
+4 1 20 four 10 10 10 10
+5 1 10 five 40 40 40 40
+6 1 40 six 30 30 30 30
+7 1 30 seven 300 300 NULL NULL
+8 4 300 eight 100 100 100 100
+9 4 100 nine 200 200 200 200
+10 4 200 ten 200 200 200 200
+11 4 200 eleven NULL NULL NULL NULL
+# 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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 20 20 NULL NULL
+2 0 2 two 10 10 NULL NULL
+3 0 3 three 40 40 NULL NULL
+4 1 20 four 30 30 30 30
+5 1 10 five 300 300 NULL NULL
+6 1 40 six 100 100 NULL NULL
+7 1 30 seven 200 200 NULL NULL
+8 4 300 eight 200 200 200 200
+9 4 100 nine NULL NULL NULL NULL
+10 4 200 ten NULL NULL NULL NULL
+11 4 200 eleven NULL NULL NULL NULL
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one NULL NULL NULL NULL
+2 0 2 two NULL NULL NULL NULL
+3 0 3 three NULL NULL NULL NULL
+4 1 20 four 1 1 NULL NULL
+5 1 10 five 2 2 NULL NULL
+6 1 40 six 3 3 NULL NULL
+7 1 30 seven 20 20 20 20
+8 4 300 eight 10 10 NULL NULL
+9 4 100 nine 40 40 NULL NULL
+10 4 200 ten 30 30 NULL NULL
+11 4 200 eleven 300 300 300 300
+# 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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 2 1 2
+2 0 2 two 2 3 2 3
+3 0 3 three 3 20 3 3
+4 1 20 four 10 20 10 20
+5 1 10 five 10 40 10 40
+6 1 40 six 30 40 30 40
+7 1 30 seven 30 300 30 30
+8 4 300 eight 100 300 100 300
+9 4 100 nine 100 200 100 200
+10 4 200 ten 200 200 200 200
+11 4 200 eleven 200 200 200 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 2 1 2
+2 0 2 two 2 3 2 3
+3 0 3 three 3 20 3 3
+4 1 20 four 10 20 10 20
+5 1 10 five 10 40 10 40
+6 1 40 six 30 40 30 40
+7 1 30 seven 30 300 30 30
+8 4 300 eight 100 300 100 300
+9 4 100 nine 100 200 100 200
+10 4 200 ten 200 200 200 200
+11 4 200 eleven 200 200 200 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 1 1 1
+2 0 2 two 1 2 1 2
+3 0 3 three 2 3 2 3
+4 1 20 four 3 20 20 20
+5 1 10 five 10 20 10 20
+6 1 40 six 10 40 10 40
+7 1 30 seven 30 40 30 40
+8 4 300 eight 30 300 300 300
+9 4 100 nine 100 300 100 300
+10 4 200 ten 100 200 100 200
+11 4 200 eleven 200 200 200 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 1 1 1
+2 0 2 two 1 2 1 2
+3 0 3 three 2 3 2 3
+4 1 20 four 3 20 20 20
+5 1 10 five 10 20 10 20
+6 1 40 six 10 40 10 40
+7 1 30 seven 30 40 30 40
+8 4 300 eight 30 300 300 300
+9 4 100 nine 100 300 100 300
+10 4 200 ten 100 200 100 200
+11 4 200 eleven 200 200 200 200
+# 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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 20 1 3
+2 0 2 two 2 20 2 3
+3 0 3 three 3 40 3 3
+4 1 20 four 10 40 10 40
+5 1 10 five 10 300 10 40
+6 1 40 six 30 300 30 40
+7 1 30 seven 30 300 30 30
+8 4 300 eight 100 300 100 300
+9 4 100 nine 100 200 100 200
+10 4 200 ten 200 200 200 200
+11 4 200 eleven 200 200 200 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 2 1 2
+2 0 2 two 1 3 1 3
+3 0 3 three 1 20 1 3
+4 1 20 four 2 20 10 20
+5 1 10 five 3 40 10 40
+6 1 40 six 10 40 10 40
+7 1 30 seven 10 300 10 40
+8 4 300 eight 30 300 100 300
+9 4 100 nine 30 300 100 300
+10 4 200 ten 100 300 100 300
+11 4 200 eleven 100 200 100 200
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 1 1 1
+2 0 2 two 1 2 1 2
+3 0 3 three 1 3 1 3
+4 1 20 four 1 20 20 20
+5 1 10 five 2 20 10 20
+6 1 40 six 3 40 10 40
+7 1 30 seven 10 40 10 40
+8 4 300 eight 10 300 300 300
+9 4 100 nine 30 300 100 300
+10 4 200 ten 30 300 100 300
+11 4 200 eleven 100 300 100 300
+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;
+pk a b c min1 max1 min2 max2
+1 0 1 one 1 1 1 1
+2 0 2 two 1 2 1 2
+3 0 3 three 1 3 1 3
+4 1 20 four 1 20 20 20
+5 1 10 five 2 20 10 20
+6 1 40 six 3 40 10 40
+7 1 30 seven 10 40 10 40
+8 4 300 eight 10 300 300 300
+9 4 100 nine 30 300 100 300
+10 4 200 ten 30 300 100 300
+11 4 200 eleven 100 300 100 300
+drop table t2;
+drop table t1;
diff --git a/mysql-test/r/win_nth_value.result b/mysql-test/r/win_nth_value.result
new file mode 100644
index 00000000000..abda1a2377f
--- /dev/null
+++ b/mysql-test/r/win_nth_value.result
@@ -0,0 +1,120 @@
+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;
+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)
+1 1 NULL NULL NULL NULL
+2 1 2 NULL NULL NULL
+3 1 2 NULL NULL NULL
+4 1 2 NULL NULL NULL
+5 1 2 NULL NULL NULL
+6 1 2 NULL NULL NULL
+7 1 2 NULL NULL NULL
+8 1 2 NULL NULL NULL
+9 1 2 NULL NULL NULL
+10 1 2 NULL NULL NULL
+11 1 2 NULL NULL NULL
+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;
+pk nth_value(pk, pk) over (order by pk) nth_value(pk / 0.1, pk) over (order by pk)
+1 1 10.0000
+2 2 20.0000
+3 3 30.0000
+4 4 40.0000
+5 5 50.0000
+6 6 60.0000
+7 7 70.0000
+8 8 80.0000
+9 9 90.0000
+10 10 100.0000
+11 11 110.0000
+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;
+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)
+1 0 1 1
+2 0 2 1
+3 0 3 1
+4 1 NULL NULL
+5 1 NULL 5
+6 1 NULL 5
+7 2 NULL NULL
+8 2 NULL NULL
+9 2 NULL 9
+10 2 NULL 9
+11 2 NULL 9
+select pk,
+a,
+nth_value(pk, 1) over (partition by a order by pk ROWS between 1 preceding and 1 following)
+from t1;
+pk a nth_value(pk, 1) over (partition by a order by pk ROWS between 1 preceding and 1 following)
+1 0 1
+2 0 1
+3 0 2
+4 1 4
+5 1 4
+6 1 5
+7 2 7
+8 2 7
+9 2 8
+10 2 9
+11 2 10
+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;
+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)
+1 0 0 0 0 1 1 1 NULL NULL NULL NULL NULL NULL
+2 0 0 0 0 1 1 1 NULL NULL NULL NULL NULL NULL
+3 0 0 0 0 1 1 1 NULL NULL NULL NULL NULL NULL
+4 1 0 0 0 1 1 1 2 2 2 2 2 NULL
+5 1 0 0 0 1 1 1 2 2 2 2 2 NULL
+6 1 0 0 0 1 1 1 2 2 2 2 2 NULL
+7 2 1 1 1 2 2 2 2 2 NULL NULL NULL NULL
+8 2 1 1 1 2 2 2 2 2 NULL NULL NULL NULL
+9 2 1 1 1 2 2 2 2 2 NULL NULL NULL NULL
+10 2 1 1 1 2 2 2 2 2 NULL NULL NULL NULL
+11 2 1 1 1 2 2 2 2 2 NULL NULL NULL NULL
+drop table t1;
diff --git a/mysql-test/r/win_ntile.result b/mysql-test/r/win_ntile.result
new file mode 100644
index 00000000000..41cb1a594bf
--- /dev/null
+++ b/mysql-test/r/win_ntile.result
@@ -0,0 +1,435 @@
+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);
+select pk, a, b, ntile(-1) over (order by a)
+from t1;
+ERROR HY000: Argument of NTILE must be greater than 0
+select pk, a, b,
+ntile(0) over (order by a)
+from t1;
+ERROR HY000: Argument of NTILE must be greater than 0
+select pk, a, b,
+ntile(1) over (order by pk)
+from t1;
+pk a b ntile(1) over (order by pk)
+11 0 10 1
+12 0 10 1
+13 1 10 1
+14 1 10 1
+15 2 20 1
+16 2 20 1
+17 2 20 1
+18 2 10 1
+19 4 20 1
+20 4 20 1
+select pk, a, b,
+ntile(2) over (order by pk)
+from t1;
+pk a b ntile(2) over (order by pk)
+11 0 10 1
+12 0 10 1
+13 1 10 1
+14 1 10 1
+15 2 20 1
+16 2 20 2
+17 2 20 2
+18 2 10 2
+19 4 20 2
+20 4 20 2
+select pk, a, b,
+ntile(3) over (order by pk)
+from t1;
+pk a b ntile(3) over (order by pk)
+11 0 10 1
+12 0 10 1
+13 1 10 1
+14 1 10 1
+15 2 20 2
+16 2 20 2
+17 2 20 2
+18 2 10 3
+19 4 20 3
+20 4 20 3
+select pk, a, b,
+ntile(4) over (order by pk)
+from t1;
+pk a b ntile(4) over (order by pk)
+11 0 10 1
+12 0 10 1
+13 1 10 1
+14 1 10 2
+15 2 20 2
+16 2 20 2
+17 2 20 3
+18 2 10 3
+19 4 20 4
+20 4 20 4
+select pk, a, b,
+ntile(5) over (order by pk)
+from t1;
+pk a b ntile(5) over (order by pk)
+11 0 10 1
+12 0 10 1
+13 1 10 2
+14 1 10 2
+15 2 20 3
+16 2 20 3
+17 2 20 4
+18 2 10 4
+19 4 20 5
+20 4 20 5
+select pk, a, b,
+ntile(6) over (order by pk)
+from t1;
+pk a b ntile(6) over (order by pk)
+11 0 10 1
+12 0 10 1
+13 1 10 2
+14 1 10 2
+15 2 20 3
+16 2 20 3
+17 2 20 4
+18 2 10 4
+19 4 20 5
+20 4 20 6
+select pk, a, b,
+ntile(7) over (order by pk)
+from t1;
+pk a b ntile(7) over (order by pk)
+11 0 10 1
+12 0 10 1
+13 1 10 2
+14 1 10 2
+15 2 20 3
+16 2 20 3
+17 2 20 4
+18 2 10 5
+19 4 20 6
+20 4 20 7
+select pk, a, b,
+ntile(8) over (order by pk)
+from t1;
+pk a b ntile(8) over (order by pk)
+11 0 10 1
+12 0 10 1
+13 1 10 2
+14 1 10 2
+15 2 20 3
+16 2 20 4
+17 2 20 5
+18 2 10 6
+19 4 20 7
+20 4 20 8
+select pk, a, b,
+ntile(9) over (order by pk)
+from t1;
+pk a b ntile(9) over (order by pk)
+11 0 10 1
+12 0 10 1
+13 1 10 2
+14 1 10 3
+15 2 20 4
+16 2 20 5
+17 2 20 6
+18 2 10 7
+19 4 20 8
+20 4 20 9
+select pk, a, b,
+ntile(10) over (order by pk)
+from t1;
+pk a b ntile(10) over (order by pk)
+11 0 10 1
+12 0 10 2
+13 1 10 3
+14 1 10 4
+15 2 20 5
+16 2 20 6
+17 2 20 7
+18 2 10 8
+19 4 20 9
+20 4 20 10
+select pk, a, b,
+ntile(11) over (order by pk)
+from t1;
+pk a b ntile(11) over (order by pk)
+11 0 10 1
+12 0 10 2
+13 1 10 3
+14 1 10 4
+15 2 20 5
+16 2 20 6
+17 2 20 7
+18 2 10 8
+19 4 20 9
+20 4 20 10
+select pk, a, b,
+ntile(20) over (order by pk)
+from t1;
+pk a b ntile(20) over (order by pk)
+11 0 10 1
+12 0 10 2
+13 1 10 3
+14 1 10 4
+15 2 20 5
+16 2 20 6
+17 2 20 7
+18 2 10 8
+19 4 20 9
+20 4 20 10
+select pk, a, b,
+ntile(1) over (partition by b order by pk)
+from t1;
+pk a b ntile(1) over (partition by b order by pk)
+11 0 10 1
+12 0 10 1
+13 1 10 1
+14 1 10 1
+18 2 10 1
+15 2 20 1
+16 2 20 1
+17 2 20 1
+19 4 20 1
+20 4 20 1
+select pk, a, b,
+ntile(2) over (partition by b order by pk)
+from t1;
+pk a b ntile(2) over (partition by b order by pk)
+11 0 10 1
+12 0 10 1
+13 1 10 1
+14 1 10 2
+18 2 10 2
+15 2 20 1
+16 2 20 1
+17 2 20 1
+19 4 20 2
+20 4 20 2
+select pk, a, b,
+ntile(3) over (partition by b order by pk)
+from t1;
+pk a b ntile(3) over (partition by b order by pk)
+11 0 10 1
+12 0 10 1
+13 1 10 2
+14 1 10 2
+18 2 10 3
+15 2 20 1
+16 2 20 1
+17 2 20 2
+19 4 20 2
+20 4 20 3
+select pk, a, b,
+ntile(4) over (partition by b order by pk)
+from t1;
+pk a b ntile(4) over (partition by b order by pk)
+11 0 10 1
+12 0 10 1
+13 1 10 2
+14 1 10 3
+18 2 10 4
+15 2 20 1
+16 2 20 1
+17 2 20 2
+19 4 20 3
+20 4 20 4
+select pk, a, b,
+ntile(5) over (partition by b order by pk)
+from t1;
+pk a b ntile(5) over (partition by b order by pk)
+11 0 10 1
+12 0 10 2
+13 1 10 3
+14 1 10 4
+18 2 10 5
+15 2 20 1
+16 2 20 2
+17 2 20 3
+19 4 20 4
+20 4 20 5
+select pk, a, b,
+ntile(6) over (partition by b order by pk)
+from t1;
+pk a b ntile(6) over (partition by b order by pk)
+11 0 10 1
+12 0 10 2
+13 1 10 3
+14 1 10 4
+18 2 10 5
+15 2 20 1
+16 2 20 2
+17 2 20 3
+19 4 20 4
+20 4 20 5
+select pk, a, b,
+ntile(7) over (partition by b order by pk)
+from t1;
+pk a b ntile(7) over (partition by b order by pk)
+11 0 10 1
+12 0 10 2
+13 1 10 3
+14 1 10 4
+18 2 10 5
+15 2 20 1
+16 2 20 2
+17 2 20 3
+19 4 20 4
+20 4 20 5
+select pk, a, b,
+ntile(8) over (partition by b order by pk)
+from t1;
+pk a b ntile(8) over (partition by b order by pk)
+11 0 10 1
+12 0 10 2
+13 1 10 3
+14 1 10 4
+18 2 10 5
+15 2 20 1
+16 2 20 2
+17 2 20 3
+19 4 20 4
+20 4 20 5
+select pk, a, b,
+ntile(9) over (partition by b order by pk)
+from t1;
+pk a b ntile(9) over (partition by b order by pk)
+11 0 10 1
+12 0 10 2
+13 1 10 3
+14 1 10 4
+18 2 10 5
+15 2 20 1
+16 2 20 2
+17 2 20 3
+19 4 20 4
+20 4 20 5
+select pk, a, b,
+ntile(10) over (partition by b order by pk)
+from t1;
+pk a b ntile(10) over (partition by b order by pk)
+11 0 10 1
+12 0 10 2
+13 1 10 3
+14 1 10 4
+18 2 10 5
+15 2 20 1
+16 2 20 2
+17 2 20 3
+19 4 20 4
+20 4 20 5
+select pk, a, b,
+ntile(11) over (partition by b order by pk)
+from t1;
+pk a b ntile(11) over (partition by b order by pk)
+11 0 10 1
+12 0 10 2
+13 1 10 3
+14 1 10 4
+18 2 10 5
+15 2 20 1
+16 2 20 2
+17 2 20 3
+19 4 20 4
+20 4 20 5
+select pk, a, b,
+ntile(20) over (partition by b order by pk)
+from t1;
+pk a b ntile(20) over (partition by b order by pk)
+11 0 10 1
+12 0 10 2
+13 1 10 3
+14 1 10 4
+18 2 10 5
+15 2 20 1
+16 2 20 2
+17 2 20 3
+19 4 20 4
+20 4 20 5
+select pk, a, b,
+ntile(1 + 3) over (partition by b order by pk)
+from t1;
+pk a b ntile(1 + 3) over (partition by b order by pk)
+11 0 10 1
+12 0 10 1
+13 1 10 2
+14 1 10 3
+18 2 10 4
+15 2 20 1
+16 2 20 1
+17 2 20 2
+19 4 20 3
+20 4 20 4
+select pk, a, b,
+ntile((select 4)) over (partition by b order by pk)
+from t1;
+pk a b ntile((select 4)) over (partition by b order by pk)
+11 0 10 1
+12 0 10 1
+13 1 10 2
+14 1 10 3
+18 2 10 4
+15 2 20 1
+16 2 20 1
+17 2 20 2
+19 4 20 3
+20 4 20 4
+select t1.a from t1 where pk = 11;
+a
+0
+select pk, a, b,
+ntile((select a from t1 where pk=11)) over (partition by b order by pk)
+from t1;
+ERROR HY000: Argument of NTILE must be greater than 0
+select t1.a from t1 where pk = 13;
+a
+1
+select pk, a, b,
+ntile((select a from t1 where pk=13)) over (partition by b order by pk)
+from t1;
+pk a b ntile((select a from t1 where pk=13)) over (partition by b order by pk)
+11 0 10 1
+12 0 10 1
+13 1 10 1
+14 1 10 1
+18 2 10 1
+15 2 20 1
+16 2 20 1
+17 2 20 1
+19 4 20 1
+20 4 20 1
+explain
+select pk, a, b,
+ntile((select a from t1 where pk=13)) over (partition by b order by pk)
+from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using temporary
+2 SUBQUERY t1 const PRIMARY PRIMARY 4 const 1
+select a from t1;
+a
+0
+0
+1
+1
+2
+2
+2
+2
+4
+4
+select pk, a, b,
+ntile((select a from t1)) over (partition by b order by pk)
+from t1;
+ERROR 21000: Subquery returns more than 1 row
+drop table t1;
diff --git a/mysql-test/r/win_orderby.result b/mysql-test/r/win_orderby.result
new file mode 100644
index 00000000000..bf4a40a4db3
--- /dev/null
+++ b/mysql-test/r/win_orderby.result
@@ -0,0 +1,26 @@
+drop table if exists t0,t1;
+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;
+pk count(a) over (order by pk rows between 2 preceding and 2 following)
+30 3
+29 4
+28 5
+27 5
+drop table t0,t1;
diff --git a/mysql-test/r/win_percent_cume.result b/mysql-test/r/win_percent_cume.result
new file mode 100644
index 00000000000..d38c95c9ea7
--- /dev/null
+++ b/mysql-test/r/win_percent_cume.result
@@ -0,0 +1,62 @@
+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;
+pk a b percent_rank() over (order by a) cume_dist() over (order by a)
+1 0 10 0.0000000000 0.2000000000
+2 0 10 0.0000000000 0.2000000000
+3 1 10 0.2222222222 0.4000000000
+4 1 10 0.2222222222 0.4000000000
+8 2 10 0.4444444444 0.8000000000
+5 2 20 0.4444444444 0.8000000000
+6 2 20 0.4444444444 0.8000000000
+7 2 20 0.4444444444 0.8000000000
+9 4 20 0.8888888889 1.0000000000
+10 4 20 0.8888888889 1.0000000000
+select pk, a, b,
+percent_rank() over (order by pk),
+cume_dist() over (order by pk)
+from t1 order by pk;
+pk a b percent_rank() over (order by pk) cume_dist() over (order by pk)
+1 0 10 0.0000000000 0.1000000000
+2 0 10 0.1111111111 0.2000000000
+3 1 10 0.2222222222 0.3000000000
+4 1 10 0.3333333333 0.4000000000
+5 2 20 0.4444444444 0.5000000000
+6 2 20 0.5555555556 0.6000000000
+7 2 20 0.6666666667 0.7000000000
+8 2 10 0.7777777778 0.8000000000
+9 4 20 0.8888888889 0.9000000000
+10 4 20 1.0000000000 1.0000000000
+select pk, a, b,
+percent_rank() over (partition by a order by a),
+cume_dist() over (partition by a order by a)
+from t1;
+pk a b percent_rank() over (partition by a order by a) cume_dist() over (partition by a order by a)
+1 0 10 0.0000000000 1.0000000000
+2 0 10 0.0000000000 1.0000000000
+3 1 10 0.0000000000 1.0000000000
+4 1 10 0.0000000000 1.0000000000
+8 2 10 0.0000000000 1.0000000000
+5 2 20 0.0000000000 1.0000000000
+6 2 20 0.0000000000 1.0000000000
+7 2 20 0.0000000000 1.0000000000
+9 4 20 0.0000000000 1.0000000000
+10 4 20 0.0000000000 1.0000000000
+drop table t1;
diff --git a/mysql-test/r/win_rank.result b/mysql-test/r/win_rank.result
new file mode 100644
index 00000000000..725683d3869
--- /dev/null
+++ b/mysql-test/r/win_rank.result
@@ -0,0 +1,104 @@
+#
+# Try DENSE_RANK() function
+#
+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;
+pk a b rank dense_rank
+1 0 10 1 1
+2 0 10 1 1
+3 1 10 3 2
+4 1 10 3 2
+8 2 10 5 3
+5 2 20 5 3
+6 2 20 5 3
+7 2 20 5 3
+9 4 20 9 4
+10 4 20 9 4
+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;
+pk a b rank dense_rank
+1 0 10 1 1
+2 0 10 1 1
+3 1 10 3 2
+4 1 10 3 2
+8 2 10 5 3
+5 2 20 1 1
+6 2 20 1 1
+7 2 20 1 1
+9 4 20 4 2
+10 4 20 4 2
+drop table t1;
+#
+# Test with null values in the table.
+#
+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;
+s1 s2 rank dense_rank
+1 a 5 3
+NULL NULL 1 1
+1 NULL 5 3
+NULL a 1 1
+NULL c 1 1
+2 b 7 4
+-1 4 2
+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;
+s1 s2 rank dense_rank
+1 a 2 2
+NULL NULL 1 1
+1 NULL 2 2
+NULL a 1 1
+NULL c 1 1
+2 b 1 1
+-1 1 1
+select *, rank() over (order by s2) as rank,
+dense_rank() over (order by s2) as dense_rank
+from t2;
+s1 s2 rank dense_rank
+1 a 4 3
+NULL NULL 1 1
+1 NULL 1 1
+NULL a 4 3
+NULL c 7 5
+2 b 6 4
+-1 3 2
+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;
+s1 s2 rank dense_rank
+1 a 2 2
+NULL NULL 1 1
+1 NULL 1 1
+NULL a 2 2
+NULL c 3 3
+2 b 1 1
+-1 1 1
+drop table t2;
diff --git a/mysql-test/r/win_std.result b/mysql-test/r/win_std.result
new file mode 100644
index 00000000000..36d99eec425
--- /dev/null
+++ b/mysql-test/r/win_std.result
@@ -0,0 +1,293 @@
+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');
+# First try some invalid queries.
+select std(c) over (order by a)
+from t2;
+std(c) over (order by a)
+0
+0
+0
+0
+0
+0
+# Empty frame.
+select std(b) over (order by a rows between 2 following and 1 following)
+from t2;
+std(b) over (order by a rows between 2 following and 1 following)
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+select std(b) over (order by a range between 2 following and 1 following)
+from t2;
+std(b) over (order by a range between 2 following and 1 following)
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+select std(b) over (order by a rows between 1 preceding and 2 preceding)
+from t2;
+std(b) over (order by a rows between 1 preceding and 2 preceding)
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+select std(b) over (order by a range between 1 preceding and 2 preceding)
+from t2;
+std(b) over (order by a range between 1 preceding and 2 preceding)
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+select std(b) over (order by a rows between 1 following and 0 following)
+from t2;
+std(b) over (order by a rows between 1 following and 0 following)
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+select std(b) over (order by a range between 1 following and 0 following)
+from t2;
+std(b) over (order by a range between 1 following and 0 following)
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+select std(b) over (order by a rows between 1 following and 0 preceding)
+from t2;
+std(b) over (order by a rows between 1 following and 0 preceding)
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+select std(b) over (order by a range between 1 following and 0 preceding)
+from t2;
+std(b) over (order by a range between 1 following and 0 preceding)
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+select std(b) over (order by a rows between 0 following and 1 preceding)
+from t2;
+std(b) over (order by a rows between 0 following and 1 preceding)
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+select std(b) over (order by a range between 0 following and 1 preceding)
+from t2;
+std(b) over (order by a range between 0 following and 1 preceding)
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+# 1 row frame.
+select std(b) over (order by a rows between current row and current row)
+from t2;
+std(b) over (order by a rows between current row and current row)
+0.0000
+0.0000
+0.0000
+0.0000
+0.0000
+0.0000
+select std(b) over (order by a rows between 0 preceding and current row)
+from t2;
+std(b) over (order by a rows between 0 preceding and current row)
+0.0000
+0.0000
+0.0000
+0.0000
+0.0000
+0.0000
+select std(b) over (order by a rows between 0 preceding and 0 preceding)
+from t2;
+std(b) over (order by a rows between 0 preceding and 0 preceding)
+0.0000
+0.0000
+0.0000
+0.0000
+0.0000
+0.0000
+select std(b) over (order by a rows between 0 preceding and 0 following)
+from t2;
+std(b) over (order by a rows between 0 preceding and 0 following)
+0.0000
+0.0000
+0.0000
+0.0000
+0.0000
+0.0000
+select std(b) over (order by a rows between 0 following and 0 preceding)
+from t2;
+std(b) over (order by a rows between 0 following and 0 preceding)
+0.0000
+0.0000
+0.0000
+0.0000
+0.0000
+0.0000
+select std(b) over (order by a rows between 0 following and current row)
+from t2;
+ERROR HY000: Unacceptable combination of window frame bound specifications
+select std(b) over (order by a rows between current row and 0 following)
+from t2;
+std(b) over (order by a rows between current row and 0 following)
+0.0000
+0.0000
+0.0000
+0.0000
+0.0000
+0.0000
+# Only peers frame.
+select a, b, std(b) over (order by a range between 0 preceding and 0 preceding)
+from t2;
+a b std(b) over (order by a range between 0 preceding and 0 preceding)
+0 1 0.8165
+0 2 0.8165
+0 3 0.8165
+1 1 0.4714
+1 1 0.4714
+1 2 0.4714
+select a, b, std(b) over (order by a range between 0 preceding and current row)
+from t2;
+a b std(b) over (order by a range between 0 preceding and current row)
+0 1 0.8165
+0 2 0.8165
+0 3 0.8165
+1 1 0.4714
+1 1 0.4714
+1 2 0.4714
+select a, b, std(b) over (order by a range between current row and 0 preceding)
+from t2;
+ERROR HY000: Unacceptable combination of window frame bound specifications
+select a, b, std(b) over (order by a range between current row and 0 following)
+from t2;
+a b std(b) over (order by a range between current row and 0 following)
+0 1 0.8165
+0 2 0.8165
+0 3 0.8165
+1 1 0.4714
+1 1 0.4714
+1 2 0.4714
+select a, b, std(b) over (order by a range between 0 following and 0 following)
+from t2;
+a b std(b) over (order by a range between 0 following and 0 following)
+0 1 0.8165
+0 2 0.8165
+0 3 0.8165
+1 1 0.4714
+1 1 0.4714
+1 2 0.4714
+# 2 rows frame.
+select pk, a, b, std(b) over (order by a, b, pk rows between 1 preceding and current row)
+from t2;
+pk a b std(b) over (order by a, b, pk rows between 1 preceding and current row)
+1 0 1 0.0000
+2 0 2 0.5000
+3 0 3 0.5000
+4 1 1 1.0000
+5 1 1 0.0000
+6 1 2 0.5000
+select pk, a, b, std(b) over (order by a, b, pk rows between 1 preceding and 0 preceding)
+from t2;
+pk a b std(b) over (order by a, b, pk rows between 1 preceding and 0 preceding)
+1 0 1 0.0000
+2 0 2 0.5000
+3 0 3 0.5000
+4 1 1 1.0000
+5 1 1 0.0000
+6 1 2 0.5000
+select pk, a, b, std(b) over (order by a, b, pk rows between current row and 1 following)
+from t2;
+pk a b std(b) over (order by a, b, pk rows between current row and 1 following)
+1 0 1 0.5000
+2 0 2 0.5000
+3 0 3 1.0000
+4 1 1 0.0000
+5 1 1 0.5000
+6 1 2 0.0000
+select pk, a, b, std(b) over (order by a, b, pk rows between 0 following and 1 following)
+from t2;
+pk a b std(b) over (order by a, b, pk rows between 0 following and 1 following)
+1 0 1 0.5000
+2 0 2 0.5000
+3 0 3 1.0000
+4 1 1 0.0000
+5 1 1 0.5000
+6 1 2 0.0000
+# 2 peers frame.
+select pk, a, b, std(b) over (order by a range between 1 preceding and current row)
+from t2;
+pk a b std(b) over (order by a range between 1 preceding and current row)
+1 0 1 0.8165
+2 0 2 0.8165
+3 0 3 0.8165
+4 1 1 0.7454
+5 1 1 0.7454
+6 1 2 0.7454
+select pk, a, b, std(b) over (order by a range between 1 preceding and 0 preceding)
+from t2;
+pk a b std(b) over (order by a range between 1 preceding and 0 preceding)
+1 0 1 0.8165
+2 0 2 0.8165
+3 0 3 0.8165
+4 1 1 0.7454
+5 1 1 0.7454
+6 1 2 0.7454
+select pk, a, b, std(b) over (order by a range between current row and 1 following)
+from t2;
+pk a b std(b) over (order by a range between current row and 1 following)
+1 0 1 0.7454
+2 0 2 0.7454
+3 0 3 0.7454
+4 1 1 0.4714
+5 1 1 0.4714
+6 1 2 0.4714
+select pk, a, b, std(b) over (order by a range between 0 following and 1 following)
+from t2;
+pk a b std(b) over (order by a range between 0 following and 1 following)
+1 0 1 0.7454
+2 0 2 0.7454
+3 0 3 0.7454
+4 1 1 0.4714
+5 1 1 0.4714
+6 1 2 0.4714
+drop table t1;
+drop table t2;
diff --git a/mysql-test/r/win_sum.result b/mysql-test/r/win_sum.result
new file mode 100644
index 00000000000..66a48fe8293
--- /dev/null
+++ b/mysql-test/r/win_sum.result
@@ -0,0 +1,95 @@
+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);
+select pk, a, b, sum(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
+from t1;
+pk a b sum(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
+101 0 10 20
+102 0 10 20
+103 1 10 20
+104 1 10 20
+105 2 20 40
+106 2 20 60
+107 2 20 50
+108 2 10 30
+109 4 20 40
+110 4 20 40
+111 5 NULL 1
+112 5 1 1
+113 5 NULL 1
+114 5 NULL NULL
+115 5 NULL NULL
+116 6 1 2
+117 6 1 3
+118 6 1 3
+119 6 1 3
+120 6 1 3
+121 6 1 3
+122 6 1 3
+123 6 1 3
+124 6 1 3
+125 6 1 3
+126 6 1 3
+127 6 1 2
+select pk, a, c, sum(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
+from t1;
+pk a c sum(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
+101 0 1.1 3.2
+102 0 2.1 3.2
+103 1 3.1 7.199999999999999
+104 1 4.1 7.199999999999999
+105 2 6.1 13.2
+106 2 7.1 21.35
+107 2 8.15 20.35
+108 2 5.1 13.250000000000002
+109 4 9.15 19.3
+110 4 10.15 19.3
+111 5 11.15 23.4
+112 5 12.25 36.75
+113 5 13.35 40.1
+114 5 14.5 43.5
+115 5 15.65 30.15
+116 6 NULL 10
+117 6 10 11.1
+118 6 1.1 11.1
+119 6 NULL 1.0999999999999996
+120 6 NULL NULL
+121 6 NULL 2.1999999999999997
+122 6 2.2 22.3
+123 6 20.1 11.9
+124 6 -10.4 9.7
+125 6 NULL -10.400000000000002
+126 6 NULL NULL
+127 6 NULL NULL
+drop table t1;
diff --git a/mysql-test/r/xa.result b/mysql-test/r/xa.result
index 0bf9b07bb2f..6ae4a06399c 100644
--- a/mysql-test/r/xa.result
+++ b/mysql-test/r/xa.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction");
drop table if exists t1, t2;
create table t1 (a int) engine=innodb;
xa start 'test1';
@@ -28,6 +29,8 @@ begin;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state
create table t2 (a int);
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state
+connect con1,localhost,root,,;
+connection con1;
xa start 'testa','testb';
ERROR XAE08: XAER_DUPID: The XID already exists
xa start 'testa','testb', 123;
@@ -41,6 +44,7 @@ ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction
xa recover;
formatID gtrid_length bqual_length data
11 5 5 testb 0@P`
+connection default;
xa prepare 'testa','testb';
xa recover;
formatID gtrid_length bqual_length data
@@ -54,16 +58,24 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
select * from t1;
a
20
+disconnect con1;
+connection default;
drop table t1;
drop table if exists t1;
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;
update t1 set c = 'bb' where a = 2;
+connection con2;
update t1 set c = 'aa' where a = 1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
select count(*) from t1;
@@ -72,7 +84,13 @@ count(*)
xa end 'a','c';
ERROR XA102: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected
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;
#
# BUG#51342 - more xid crashing
@@ -108,20 +126,28 @@ xa prepare 'a';
xa commit 'a';
CREATE TABLE t1(a INT, KEY(a)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1),(2);
+connect con1,localhost,root,,;
BEGIN;
UPDATE t1 SET a=3 WHERE a=1;
+connection default;
BEGIN;
UPDATE t1 SET a=4 WHERE a=2;
+connection con1;
UPDATE t1 SET a=5 WHERE a=2;
+connection default;
UPDATE t1 SET a=5 WHERE a=1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
ROLLBACK;
+connection con1;
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;
UPDATE t1 SET a=5 WHERE a=2;
+connection default;
UPDATE t1 SET a=5 WHERE a=1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
XA END 'xid1';
@@ -130,6 +156,7 @@ XA ROLLBACK 'xid1';
XA START 'xid1';
XA END 'xid1';
XA ROLLBACK 'xid1';
+disconnect con1;
DROP TABLE t1;
#
# Bug#56448 Assertion failed: ! is_set() with second xa end
@@ -148,24 +175,25 @@ XA ROLLBACK 'x';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a)) engine=InnoDB;
INSERT INTO t1 VALUES (1, 1), (2, 2);
-# Connection con1
+connect con1, localhost, root;
XA START 'a';
UPDATE t1 SET b= 3 WHERE a=1;
-# Connection default
+connection default;
XA START 'b';
UPDATE t1 SET b=4 WHERE a=2;
# Sending:
UPDATE t1 SET b=5 WHERE a=1;
-# Connection con1
+connection con1;
UPDATE t1 SET b=6 WHERE a=2;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
XA COMMIT 'a';
ERROR XA102: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected
-# Connection default
+connection default;
# Reaping: UPDATE t1 SET b=5 WHERE a=1
XA END 'b';
XA ROLLBACK 'b';
DROP TABLE t1;
+disconnect con1;
#
# Bug#11766752 59936: multiple xa assertions - transactional
# statement fuzzer
@@ -220,24 +248,46 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
START TRANSACTION;
INSERT INTO t1 VALUES (1);
-# Connection con2
+connect con2,localhost,root;
XA START 'xid1';
# Sending:
INSERT INTO t2 SELECT a FROM t1;
-# Connection default
+connection default;
# Waiting until INSERT ... is blocked
DELETE FROM t1;
-# Connection con2
+connection con2;
# Reaping: INSERT INTO t2 SELECT a FROM t1
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
XA COMMIT 'xid1';
ERROR XA102: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected
-# Connection default
+connection default;
COMMIT;
-# Connection con2
+connection con2;
XA START 'xid1';
XA END 'xid1';
XA PREPARE 'xid1';
XA ROLLBACK 'xid1';
-# Connection default
+connection default;
DROP TABLE t1, t2;
+disconnect con2;
+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';
+INSERT INTO t1 SELECT * FROM t2;
+connection default;
+REPLACE INTO t2 SELECT * FROM t2;
+connection con1;
+disconnect con1;
+connect con2,localhost,root,,test;
+INSERT INTO t3 VALUES (1);
+XA BEGIN 'xid3';
+disconnect con2;
+connection default;
+XA END 'xid1';
+XA ROLLBACK 'xid1';
+DROP TABLE t1, t2, t3;
diff --git a/mysql-test/r/xa_sync.result b/mysql-test/r/xa_sync.result
index 769a13d1773..1482ff5cacf 100644
--- a/mysql-test/r/xa_sync.result
+++ b/mysql-test/r/xa_sync.result
@@ -2,23 +2,41 @@
# MDEV-7793 - Race condition between XA COMMIT/ROLLBACK and disconnect
#
# Note that this test is meaningful only with valgrind.
+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';
XA COMMIT 'xatest';
+connection default;
SET debug_sync='now WAIT_FOR parked';
+disconnect con1;
# Waiting for thread to get deleted
SET debug_sync='now SIGNAL go';
+connection con2;
ERROR XAE04: XAER_NOTA: Unknown XID
+disconnect con2;
+connection default;
SET debug_sync='RESET';
+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';
XA ROLLBACK 'xatest';
+connection default;
SET debug_sync='now WAIT_FOR parked';
+disconnect con1;
# Waiting for thread to get deleted
SET debug_sync='now SIGNAL go';
+connection con2;
ERROR XAE04: XAER_NOTA: Unknown XID
+disconnect con2;
+connection default;
SET debug_sync='RESET';
diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result
index 375b2c62827..2cd70c08a94 100644
--- a/mysql-test/r/xml.result
+++ b/mysql-test/r/xml.result
@@ -1288,3 +1288,24 @@ DROP TABLE t1;
#
# End of 10.0 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-10134 Add full support for DEFAULT
+#
+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;
+b
+bbb
+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;
+b
+<a><b>xxx</b></a>
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/xtradb_mrr.result b/mysql-test/r/xtradb_mrr.result
index c238d0530af..f49207c0e41 100644
--- a/mysql-test/r/xtradb_mrr.result
+++ b/mysql-test/r/xtradb_mrr.result
@@ -313,7 +313,7 @@ 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';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range a a 9 NULL 99 Using index condition; Rowid-ordered scan
+1 SIMPLE t2 range a a 9 NULL 100 Using index condition; Rowid-ordered scan
select count(length(a) + length(filler)) from t2 force index (a) where a>='a-1000-a' and a <'a-1001-a';
count(length(a) + length(filler))
100
@@ -782,7 +782,7 @@ INSERT INTO t1 VALUES
('MS','Microsoft'),
('IB','IBM- Inc.'),
('GO','Google Inc.');
-INSERT INTO t2 VALUES
+INSERT IGNORE INTO t2 VALUES
('AB','Sweden'),
('JA','USA'),
('MS','United States of America'),